1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-23 08:26:17 +04:00

save fsbase to TrapFrame on x86_64

This commit is contained in:
WangRunji 2019-02-24 23:59:02 +08:00
parent 254663e976
commit 7a704673d7
2 changed files with 17 additions and 0 deletions

View File

@ -20,6 +20,14 @@ __alltraps:
push r14 push r14
push r15 push r15
# push fs.base
xor rax, rax
mov ecx, 0xC0000100
rdmsr # msr[ecx] => edx:eax
shl rdx, 32
or rdx, rax
push rdx
mov rdi, rsp mov rdi, rsp
call rust_trap call rust_trap
@ -29,6 +37,13 @@ trap_ret:
mov rdi, rsp mov rdi, rsp
call set_return_rsp call set_return_rsp
# pop fs.base
pop rax
mov rdx, rax
shr rdx, 32
mov ecx, 0xC0000100
wrmsr # msr[ecx] <= edx:eax
pop r15 pop r15
pop r14 pop r14
pop r13 pop r13

View File

@ -2,6 +2,8 @@
#[repr(C)] #[repr(C)]
pub struct TrapFrame { pub struct TrapFrame {
// Pushed by __alltraps at 'trap.asm' // Pushed by __alltraps at 'trap.asm'
pub fsbase: usize,
pub r15: usize, pub r15: usize,
pub r14: usize, pub r14: usize,
pub r13: usize, pub r13: usize,