🆕 syscall模块,实现了第一个系统调用函数sys_printf

This commit is contained in:
fslongjin
2022-02-16 14:07:53 +08:00
parent 7238e3c13a
commit d3a5048f66
11 changed files with 219 additions and 8 deletions

View File

@ -99,6 +99,46 @@ Err_Code:
jmp ret_from_exception
//
//
ENTRY(system_call)
// sysenter
sti;
subq $0x38, %rsp
cld;
pushq %rax
movq %es, %rax
pushq %rax
movq %ds, %rax
pushq %rax
pushq %rbp
pushq %rdi
pushq %rsi
pushq %rdx
pushq %rcx
pushq %rbx
pushq %r8
pushq %r9
pushq %r10
pushq %r11
pushq %r12
pushq %r13
pushq %r14
pushq %r15
movq $0x10, %rdx
movq %rdx, %ds
movq %rdx, %es
// rspsystem_call_function
movq %rsp, %rdi
callq system_call_function
//
ENTRY(ret_from_system_call)
movq %rax, 0x80(%rsp) // raxrax