summaryrefslogtreecommitdiff
path: root/debian/patches/sysenter0008-document-check-for-sysenter-at-the-right-location.patch
blob: 8386235078b286736bc4d7d67c09da2adf9bc49c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From 2a53b2da8c31676ddf53564ac95a01fcb78f2d20 Mon Sep 17 00:00:00 2001
From: Justus Winter <4winter@informatik.uni-hamburg.de>
Date: Tue, 5 May 2015 20:34:50 +0200
Subject: [PATCH gnumach 08/10] document, check for sysenter at the right
 location

---
 i386/i386/locore.S | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/i386/i386/locore.S b/i386/i386/locore.S
index 4c2a253..8b4d766 100644
--- a/i386/i386/locore.S
+++ b/i386/i386/locore.S
@@ -521,6 +521,9 @@ _return_to_user:
  */
 
 _return_from_kernel:
+	cmpl	$0x7fffffff, R_TRAPNO(%esp)	/* YYY */
+	je	return_from_sysenter
+
 _kret_popl_gs:
 	popl	%gs			/* restore segment registers */
 _kret_popl_fs:
@@ -592,8 +595,6 @@ 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 */
-	cmpl	$0x7fffffff, R_TRAPNO(%esp)	/* YYY */
-	je	return_from_sysenter
 	jmp	_return_from_trap
 
 ENTRY(call_continuation)
@@ -1231,6 +1232,7 @@ user_sysenter_stub_end:
  * 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:
  *
@@ -1291,11 +1293,10 @@ ENTRY(sysenter_entry)
 
 	/* Populate trap save area.  */
 	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	%eax			/* %eax: unused */
+	pushl	SE_STACK_POINTER(%ebp)  /* %ecx: for sysexit */
+	pushl	SE_RETURN_ADDRESS(%ebp)	/* %edx: for sysexit */
+	subl	$(5 * 4), %esp		/* unused */
 	pushl	SE_DS(%ebp)		/* copy the segment registers */
 	pushl	SE_ES(%ebp)
 	pushl	SE_FS(%ebp)
@@ -1363,8 +1364,8 @@ se_args_0:
 	movl	%ebx, %esp		/* clean parameters from stack */
 	popl	%esp			/* switch to pcb stack */
 	movl	%eax, R_EAX(%esp)	/* save return value */
-return_from_sysenter:
-	/* xxx: process ast */
+	jmp	_return_from_trap	/* check for AST, then... */
+return_from_sysenter:			/* return here */
 	popl	%gs			/* restore segment registers */
 	popl	%fs
 	popl	%es
-- 
2.1.4