Module Name: src
Committed By: reinoud
Date: Wed Dec 14 18:51:39 UTC 2011
Modified Files:
src/sys/arch/usermode/include: machdep.h
src/sys/arch/usermode/usermode: machdep.c trap.c
Log Message:
Remove the need for a siginfo structure in illegal instruction handling.
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/include/machdep.h
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/usermode/usermode/machdep.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/usermode/usermode/trap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/usermode/include/machdep.h
diff -u src/sys/arch/usermode/include/machdep.h:1.5 src/sys/arch/usermode/include/machdep.h:1.6
--- src/sys/arch/usermode/include/machdep.h:1.5 Wed Dec 14 04:12:22 2011
+++ src/sys/arch/usermode/include/machdep.h Wed Dec 14 18:51:39 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.h,v 1.5 2011/12/14 04:12:22 jmcneill Exp $ */
+/* $NetBSD: machdep.h,v 1.6 2011/12/14 18:51:39 reinoud Exp $ */
/*-
* Copyright (c) 2011 Reinoud Zandijk <[email protected]>
@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-int md_syscall_check_opcode(void *ptr);
+int md_syscall_check_opcode(ucontext_t *ucp);
void md_syscall_get_opcode(ucontext_t *ucp, uint32_t *opcode);
void md_syscall_get_syscallnumber(ucontext_t *ucp, uint32_t *code);
int md_syscall_getargs(lwp_t *l, ucontext_t *ucp, int nargs, int argsize,
Index: src/sys/arch/usermode/usermode/machdep.c
diff -u src/sys/arch/usermode/usermode/machdep.c:1.35 src/sys/arch/usermode/usermode/machdep.c:1.36
--- src/sys/arch/usermode/usermode/machdep.c:1.35 Tue Dec 13 20:59:20 2011
+++ src/sys/arch/usermode/usermode/machdep.c Wed Dec 14 18:51:39 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.35 2011/12/13 20:59:20 reinoud Exp $ */
+/* $NetBSD: machdep.c,v 1.36 2011/12/14 18:51:39 reinoud Exp $ */
/*-
* Copyright (c) 2011 Reinoud Zandijk <[email protected]>
@@ -32,7 +32,7 @@
#include "opt_urkelvisor.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.35 2011/12/13 20:59:20 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.36 2011/12/14 18:51:39 reinoud Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -274,15 +274,16 @@ md_syscall_set_returnargs(lwp_t *l, ucon
}
int
-md_syscall_check_opcode(void *ptr)
+md_syscall_check_opcode(ucontext_t *ucp)
{
- uint16_t *p16;
+ uint32_t opcode;
+
+ md_syscall_get_opcode(ucp, &opcode);
/* undefined instruction */
- p16 = (uint16_t *) ptr;
- if (*p16 == 0xff0f)
+ if (opcode == 0xff0f)
return 1;
- if (*p16 == 0xff0b)
+ if (opcode == 0xff0b)
return 1;
/* TODO int $80 and sysenter */
Index: src/sys/arch/usermode/usermode/trap.c
diff -u src/sys/arch/usermode/usermode/trap.c:1.44 src/sys/arch/usermode/usermode/trap.c:1.45
--- src/sys/arch/usermode/usermode/trap.c:1.44 Wed Dec 14 04:12:22 2011
+++ src/sys/arch/usermode/usermode/trap.c Wed Dec 14 18:51:39 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.44 2011/12/14 04:12:22 jmcneill Exp $ */
+/* $NetBSD: trap.c,v 1.45 2011/12/14 18:51:39 reinoud Exp $ */
/*-
* Copyright (c) 2011 Reinoud Zandijk <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.44 2011/12/14 04:12:22 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.45 2011/12/14 18:51:39 reinoud Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -228,7 +228,7 @@ illegal_instruction_handler(int sig, sig
memcpy(&pcb->pcb_userret_ucp, uct, sizeof(ucontext_t));
/* if its a syscall ... */
- if (md_syscall_check_opcode(info->si_addr)) {
+ if (md_syscall_check_opcode(uct)) {
/* switch to the syscall entry on return from signal */
memcpy(uct, &pcb->pcb_syscall_ucp, sizeof(ucontext_t));
return;