diff options
Diffstat (limited to 'debian/patches/sysenter0002-use-pcb-stack.patch')
-rw-r--r-- | debian/patches/sysenter0002-use-pcb-stack.patch | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/debian/patches/sysenter0002-use-pcb-stack.patch b/debian/patches/sysenter0002-use-pcb-stack.patch new file mode 100644 index 0000000..1c591ce --- /dev/null +++ b/debian/patches/sysenter0002-use-pcb-stack.patch @@ -0,0 +1,84 @@ +From f022cb3771222d1effa738d4cb74c67ed61e86cc Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Mon, 4 May 2015 00:45:24 +0200 +Subject: [PATCH gnumach 02/10] use pcb stack + +--- + i386/i386/locore.S | 34 ++++++++++++++++++++++++---------- + 1 file changed, 24 insertions(+), 10 deletions(-) + +diff --git a/i386/i386/locore.S b/i386/i386/locore.S +index aa13c6b..f1ef044 100644 +--- a/i386/i386/locore.S ++++ b/i386/i386/locore.S +@@ -592,7 +592,9 @@ ENTRY(thread_syscall_return) + or $(KERNEL_STACK_SIZE-1),%ecx + movl -3-IKS_SIZE(%ecx),%esp /* switch back to PCB stack */ + movl %eax,R_EAX(%esp) /* save return value */ +- /* XXX make this work with sysenter */ ++ /* YYY make this work with sysenter */ ++ cmpl $0xffffffff, R_TRAPNO(%esp) ++ je return_from_sysenter + jmp _return_from_trap + + ENTRY(call_continuation) +@@ -1254,6 +1256,22 @@ ENTRY(sysenter_entry) + mov %esp, %ebp /* to access the sysenter stack */ + cld /* clear direction flag */ + ++ CPU_NUMBER(%edx) ++ movl CX(EXT(kernel_stack),%edx),%ebx ++ /* get current kernel stack */ ++ movl %ebx, %ecx ++ or $(KERNEL_STACK_SIZE-1),%ecx ++ movl -3-IKS_SIZE(%ecx), %esp /* switch to PCB stack */ ++ ++ /* Create trap save area. */ ++ subl $(6 * 4), %esp /* Unused. We save the ++ arguments in userspace. */ ++ pushl $0x7fffffff /* trap number */ ++ pushl $0x12345678 /* unused */ ++ pushl SE_STACK_POINTER(%ebp) /* ecx */ ++ pushl SE_RETURN_ADDRESS(%ebp) /* edx */ ++ subl $(5 * 4), %esp /* Unused. We save the ++ arguments in userspace. */ + pushl %ds /* save the segment registers */ + pushl %es + pushl %fs +@@ -1265,11 +1283,8 @@ ENTRY(sysenter_entry) + mov %cx,%fs + mov %cx,%gs + +- CPU_NUMBER(%edx) +- movl CX(EXT(kernel_stack),%edx),%ebx +- /* get current kernel stack */ +- xchgl %ebx, %esp /* switch stacks */ +- pushl %ebx /* save sysenter sp */ ++ xchgl %ebx, %esp /* switch to kernel stack */ ++ pushl %ebx /* save pcb stack pointer */ + movl %esp,%ebx /* save kernel sp for argument + unwinding */ + +@@ -1328,16 +1343,15 @@ se_args_0: + /* call procedure */ + cli /* xxx: sti/cli where ? */ + movl %ebx, %esp /* clean parameters from stack */ ++ popl %esp /* switch to pcb stack */ + return_from_sysenter: ++ movl %eax, R_EAX(%esp) /* save return value */ + /* xxx: process ast */ +- popl %esp /* restore sysenter sp */ + popl %gs /* restore segment registers */ + popl %fs + popl %es + popl %ds +- +- movl SE_RETURN_ADDRESS(%ebp), %edx +- movl SE_STACK_POINTER(%ebp), %ecx ++ popa + sti /* xxx: sti/cli where ? */ + sysexit + +-- +2.1.4 + |