From d2ca2ffb15f04aab7210757d7c7dabb33ab720d0 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Tue, 5 May 2015 20:04:15 +0200 Subject: [PATCH gnumach 07/10] document --- i386/i386/locore.S | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/i386/i386/locore.S b/i386/i386/locore.S index 99fbfb6..4c2a253 100644 --- a/i386/i386/locore.S +++ b/i386/i386/locore.S @@ -1184,6 +1184,18 @@ syscall_addr: /* set error code - read user space */ jmp _take_trap /* treat as a trap */ +/* + * SYSENTER-based system calls. + * + * Calling convention: + * %eax - syscall number + * %ebx - syscall argument 1 + * %ecx - syscall argument 2 + * %edx - syscall argument 3 + * %esi - syscall argument 4 + * %edi - userspace return address + * %ebp - userspace stack pointer + */ /* User stub for calling the kernel using the sysenter instruction. */ .globl user_sysenter_stub_start @@ -1191,9 +1203,9 @@ user_sysenter_stub_start: push %ebp mov %esp, %ebp pushf - push %ebx + push %ebx /* Store callee-saved registers. */ push %esi - push %edi /* xxxmore callee-saved registers? */ + push %edi mov 8(%ebp), %eax /* Move syscall number into %eax. */ mov 12(%ebp), %ebx /* Move first argument into %ebx. */ mov 16(%ebp), %ecx /* Move second argument into %ecx. */ @@ -1216,14 +1228,9 @@ user_sysenter_stub_end: /* * SYSENTER entry point. * - * Calling convention: - * %eax - syscall number - * %ebx - syscall argument 1 - * %ecx - syscall argument 2 - * %edx - syscall argument 3 - * %esi - syscall argument 4 - * %edi - userspace return address - * %ebp - userspace stack pointer + * Control enters at `sysenter_entry' with %esp pointing to the + * per-cpu sysenter stack. We store all arguments here. We keep %ebp + * pointing to the top of this structure to copy the arguments. * * sysenter stack layout: * -- 2.1.4