diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-05-05 21:30:11 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2015-05-05 21:30:11 +0200 |
commit | c3db6ba396f3c687cd94cc4e59d314e7ffb40db7 (patch) | |
tree | 2ff1818b9ffbb2c96e6d384cf0411fe6cda74891 /debian/patches/sysenter0010-fix-error-handling.patch | |
parent | b5efbbaa049953cee6b4e4ad88378e49e4e2adda (diff) |
add patch series
Diffstat (limited to 'debian/patches/sysenter0010-fix-error-handling.patch')
-rw-r--r-- | debian/patches/sysenter0010-fix-error-handling.patch | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/debian/patches/sysenter0010-fix-error-handling.patch b/debian/patches/sysenter0010-fix-error-handling.patch new file mode 100644 index 0000000..53e4681 --- /dev/null +++ b/debian/patches/sysenter0010-fix-error-handling.patch @@ -0,0 +1,76 @@ +From 56c1cfd4797af7367c5d830d5125baa75d4f0bdb Mon Sep 17 00:00:00 2001 +From: Justus Winter <4winter@informatik.uni-hamburg.de> +Date: Tue, 5 May 2015 21:25:58 +0200 +Subject: [PATCH gnumach 10/10] fix error handling + +--- + i386/i386/locore.S | 38 ++++++++++++++++++++++++++++---------- + 1 file changed, 28 insertions(+), 10 deletions(-) + +diff --git a/i386/i386/locore.S b/i386/i386/locore.S +index 0d08be5..d8241a7 100644 +--- a/i386/i386/locore.S ++++ b/i386/i386/locore.S +@@ -1305,11 +1305,12 @@ ENTRY(sysenter_entry) + xchgl %ebx, %esp /* switch to kernel stack */ + /* %ebx points to user registers */ + negl %eax /* get system call number */ +- /* xxx sysenter_mach_call_range */ +- jl mach_call_range /* out of range if it was positive */ +- cmpl EXT(mach_trap_count),%eax /* check system call table bounds */ +- /* xxx sysenter_mach_call_range */ +- jg mach_call_range /* error if out of range */ ++ jl sysenter_mach_call_range ++ /* out of range if it was positive */ ++ cmpl EXT(mach_trap_count),%eax ++ /* check system call table bounds */ ++ jg sysenter_mach_call_range ++ /* error if out of range */ + + shll $4,%eax /* manual indexing */ + movl EXT(mach_trap_table)(%eax),%ecx +@@ -1339,6 +1340,7 @@ se_args_5plus: + + movl $USER_DS,%edx /* use user data segment for accesses */ + mov %dx,%fs ++ movl %esp,%edx /* save kernel ESP for error recovery */ + + 0: subl $4,%esi + RECOVER(sysenter_mach_call_addr_push) +@@ -1370,12 +1372,28 @@ return_from_sysenter: /* return here */ + sti /* xxx: sti/cli where ? */ + sysexit + ++/* ++ * Address out of range. Change to page fault. ++ * %esi holds failing address. ++ */ + sysenter_mach_call_addr_push: +- movl %ebx,%esp /* clean parameters from stack */ +- /* xxx signal page-fault */ +- jmp sysenter_mach_call_addr_push +-#undef SE_STACK_POINTER +-#undef SE_RETURN_ADDRESS ++ movl %edx,%esp /* clean parameters from stack */ ++ movl %esi,R_CR2(%ebx) /* set fault address */ ++ movl $(T_PAGE_FAULT),R_TRAPNO(%ebx) ++ /* set page-fault trap */ ++ movl $(T_PF_USER),R_ERR(%ebx) ++ /* set error code - read user space */ ++ jmp _take_trap /* treat as a trap */ ++ ++/* ++ * System call out of range. Treat as invalid-instruction trap. ++ * (? general protection?) ++ */ ++sysenter_mach_call_range: ++ movl $(T_INVALID_OPCODE),R_TRAPNO(%ebx) ++ /* set invalid-operation trap */ ++ movl $0,R_ERR(%ebx) /* clear error code */ ++ jmp _take_trap /* treat as a trap */ + + .data + DATA(cpu_features) +-- +2.1.4 + |