进入用户模式(系统调用存在page fault的bug)

This commit is contained in:
fslongjin
2022-04-11 10:32:39 +08:00
parent c09c6d4e66
commit dacc29310f
9 changed files with 96 additions and 79 deletions

View File

@ -104,13 +104,15 @@ Err_Code:
//
//
ENTRY(system_call)
// sysenter
sti;
hlt
subq $0x38, %rsp
cld;
pushq %rax
movq %es, %rax
pushq %rax
@ -137,6 +139,7 @@ ENTRY(system_call)
// rspsystem_call_function
movq %rsp, %rdi
callq system_call_function
@ -145,33 +148,29 @@ ENTRY(system_call)
ENTRY(ret_from_system_call)
movq %rax, 0x80(%rsp) // raxrax
popq %r15
popq %r14
popq %r13
popq %r12
popq %r11
popq %r10
popq %r9
popq %r8
popq %rbx
popq %rcx
popq %rdx
popq %rsi
popq %rdi
popq %rbp
popq %rax // popds
movq %rax, %ds
popq %rax
movq %rax, %es
popq %rax
addq $0x38, %rsp
.byte 0x48
sysexit
popq %r15
popq %r14
popq %r13
popq %r12
popq %r11
popq %r10
popq %r9
popq %r8
popq %rbx
popq %rcx
popq %rdx
popq %rsi
popq %rdi
popq %rbp
popq %rax
movq %rax, %ds
popq %rax
movq %rax, %es
popq %rax
addq $0x38, %rsp
.byte 0x48
sysexit
// 0 #DE