From 00929a1561b0f510a582f9876affa96e4fccb72a Mon Sep 17 00:00:00 2001 From: Scott Wood Date: Fri, 30 May 2008 21:31:51 -0500 Subject: [PATCH] Change x86 syscalls to direct branches, and define abi for additional syscalls. Signed-off-by: Scott Wood --- doc/abi/x86 | 16 ++++++++++++---- kernel/arch/x86/entry.S | 21 +++++---------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/doc/abi/x86 b/doc/abi/x86 index 1f9dbef..7a11bd1 100644 --- a/doc/abi/x86 +++ b/doc/abi/x86 @@ -4,7 +4,7 @@ Out-of-Process Method Invocation: Caller: eax: pointer to parameter info block (PIB) - Call the 32-bit address stored at 0x7fff0000 to invoke the method. + Call 0x7fff0000 to invoke the method. Upon return: ebx, esi, edi, ebp, esp: preserved @@ -13,7 +13,7 @@ Out-of-Process Method Invocation: function will search for an exception handling function that covers the calling address. If none is found, it will assume that it is a language without exception - handling, and return the exception to the caller in eax. + handling, an5Ad return the exception to the caller in eax. edx: length of exception segment, if any ecx: may be clobbered @@ -23,9 +23,17 @@ Out-of-Process Method Invocation: requested esp: NULL. - Jump to the 32-bit address stored at 0x7fff0004 to return. + Jump to 0x7fff0080 to return. Upon return: eax: pointer to exception, or NULL if none edx: length of exception segment, if any - ebx, esi, edi, ebp, esp: may be clobbered + ebx, ecx, esi, edi, ebp, esp: may be clobbered + +Other system calls: + eax, edx, ecx: syscall arguments. + + Call 0x7fff0000 + 0x80 * syscallnum + + eax: return value + edx, ecx: may be clobbered diff --git a/kernel/arch/x86/entry.S b/kernel/arch/x86/entry.S index 997487e..8d4ede4 100644 --- a/kernel/arch/x86/entry.S +++ b/kernel/arch/x86/entry.S @@ -14,7 +14,7 @@ #include -#define ROSHARED_PTR(x) (x - x86_syscall_ptr + 0x7fff0000) +#define ROSHARED_PTR(x) (x - roshared + 0x7fff0000) .org 0 .code32 @@ -406,19 +406,7 @@ arch_new_user_thread: iret .section ".roshared","ax" - .align 4096 - - // The vsyscall table must be the first thing in roshared - // (at vaddr 0x7fff0000). - - .global x86_syscall_ptr -x86_syscall_ptr: - .long ROSHARED_PTR(x86_shared_int98) - - .global x86_sysret_ptr -x86_sysret_ptr: - .long ROSHARED_PTR(x86_shared_int99) - +roshared: x86_shared_int98: // FIXME: This must be unpreemptible by traps pushl %gs @@ -437,12 +425,12 @@ x86_shared_int98_ret: popl %gs ret + . = roshared + 0x80 x86_shared_int99: int $0x99 ret .global test_user_ptr - .align 4 test_user_ptr: .long ROSHARED_PTR(test_user) @@ -459,7 +447,8 @@ test_objlist: test_user: movl $ROSHARED_PTR(test_pib), %eax - call *0x7fff0000 + movl $0x7fff0000, %ecx + call *%ecx 1: jmp 1b .section ".rwshared","a" -- 2.39.2