Skip to content

Commit

Permalink
remove obsolete saving of DS/ES registers
Browse files Browse the repository at this point in the history
On x86_64, DS/ES are not longer as segmenet registers.
During a system call it isn't reguired to save these registers.

This PR based on feedback from the Heinrich-Heine-Universität
Düsseldorf.
  • Loading branch information
stlankes committed Nov 9, 2023
1 parent b219fe2 commit c9f2b78
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions src/arch/x86_64/kernel/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,12 @@ pub unsafe extern "C" fn syscall_handler() {
"push r9",
"push r10",
"push r11",
// save ds/es and set to kernel data descriptor \n\t\
"mov rcx, ds",
"push rcx",
"mov rcx, es",
"push rcx",
"mov rcx, {kernel_ds}",
"mov ds, rcx",
"mov es, rcx",
// copy 4th argument to rcx to adhere x86_64 ABI \n\t\
"mov rcx, r10",
"sti",
"call [{sys_handler}+8*rax]",
// restore context, see x86_64 ABI \n\t\
"cli",
"pop rcx",
"mov es, rcx",
"pop rcx",
"mov ds, rcx",
"pop r11",
"pop r10",
"pop r9",
Expand All @@ -49,6 +37,5 @@ pub unsafe extern "C" fn syscall_handler() {
"pop rcx",
"sysretq",
sys_handler = sym SYSHANDLER_TABLE,
kernel_ds = const 0x10,
options(noreturn));
}

0 comments on commit c9f2b78

Please sign in to comment.