1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-23 00:16: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 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
call rust_trap
@ -29,6 +37,13 @@ trap_ret:
mov rdi, 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 r14
pop r13

View File

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