Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/usermode Remove the need for a siginfo structure in...



details:   https://anonhg.NetBSD.org/src/rev/c0892b6f990c
branches:  trunk
changeset: 772029:c0892b6f990c
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Wed Dec 14 18:51:39 2011 +0000

description:
Remove the need for a siginfo structure in illegal instruction handling.

diffstat:

 sys/arch/usermode/include/machdep.h  |   4 ++--
 sys/arch/usermode/usermode/machdep.c |  15 ++++++++-------
 sys/arch/usermode/usermode/trap.c    |   6 +++---
 3 files changed, 13 insertions(+), 12 deletions(-)

diffs (85 lines):

diff -r 421989dda512 -r c0892b6f990c sys/arch/usermode/include/machdep.h
--- a/sys/arch/usermode/include/machdep.h       Wed Dec 14 17:06:28 2011 +0000
+++ b/sys/arch/usermode/include/machdep.h       Wed Dec 14 18:51:39 2011 +0000
@@ -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 <reinoud%netbsd.org@localhost>
@@ -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,
diff -r 421989dda512 -r c0892b6f990c sys/arch/usermode/usermode/machdep.c
--- a/sys/arch/usermode/usermode/machdep.c      Wed Dec 14 17:06:28 2011 +0000
+++ b/sys/arch/usermode/usermode/machdep.c      Wed Dec 14 18:51:39 2011 +0000
@@ -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 <reinoud%netbsd.org@localhost>
@@ -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 @@
 }
 
 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 */
diff -r 421989dda512 -r c0892b6f990c sys/arch/usermode/usermode/trap.c
--- a/sys/arch/usermode/usermode/trap.c Wed Dec 14 17:06:28 2011 +0000
+++ b/sys/arch/usermode/usermode/trap.c Wed Dec 14 18:51:39 2011 +0000
@@ -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 <reinoud%netbsd.org@localhost>
@@ -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 @@
        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;



Home | Main Index | Thread Index | Old Index