Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/usermode Sanitise thunk_makecontext() allowing upto...



details:   https://anonhg.NetBSD.org/src/rev/bb41a5d32c01
branches:  trunk
changeset: 769433:bb41a5d32c01
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Fri Sep 09 20:04:43 2011 +0000

description:
Sanitise thunk_makecontext() allowing upto 3 random arguments

diffstat:

 sys/arch/usermode/include/thunk.h  |  6 +++---
 sys/arch/usermode/usermode/thunk.c |  9 ++++++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diffs (57 lines):

diff -r d8e3df60b10d -r bb41a5d32c01 sys/arch/usermode/include/thunk.h
--- a/sys/arch/usermode/include/thunk.h Fri Sep 09 18:48:34 2011 +0000
+++ b/sys/arch/usermode/include/thunk.h Fri Sep 09 20:04:43 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.31 2011/09/09 18:41:16 reinoud Exp $ */
+/* $NetBSD: thunk.h,v 1.32 2011/09/09 20:04:43 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -83,8 +83,8 @@
 
 int    thunk_getcontext(ucontext_t *);
 int    thunk_setcontext(const ucontext_t *);
-void   thunk_makecontext(ucontext_t *ucp, void (*func)(void), int nargs,
-               void (*arg1)(void *), void *arg2);
+void   thunk_makecontext(ucontext_t *ucp, void (*func)(void), 
+               int nargs, void *arg1, void *arg2, void *arg3);
 int    thunk_swapcontext(ucontext_t *, ucontext_t *);
 
 int    thunk_tcgetattr(int, struct thunk_termios *);
diff -r d8e3df60b10d -r bb41a5d32c01 sys/arch/usermode/usermode/thunk.c
--- a/sys/arch/usermode/usermode/thunk.c        Fri Sep 09 18:48:34 2011 +0000
+++ b/sys/arch/usermode/usermode/thunk.c        Fri Sep 09 20:04:43 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.35 2011/09/09 18:41:16 reinoud Exp $ */
+/* $NetBSD: thunk.c,v 1.36 2011/09/09 20:04:43 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifdef __NetBSD__
-__RCSID("$NetBSD: thunk.c,v 1.35 2011/09/09 18:41:16 reinoud Exp $");
+__RCSID("$NetBSD: thunk.c,v 1.36 2011/09/09 20:04:43 reinoud Exp $");
 #endif
 
 #include <sys/types.h>
@@ -254,7 +254,7 @@
 
 void
 thunk_makecontext(ucontext_t *ucp, void (*func)(void), 
-    int nargs, void (*arg1)(void *), void *arg2)
+    int nargs, void *arg1, void *arg2, void *arg3)
 {
        switch (nargs) {
        case 0:
@@ -266,6 +266,9 @@
        case 2:
                makecontext(ucp, func, 2, arg1, arg2);
                break;
+       case 3:
+               makecontext(ucp, func, 3, arg1, arg2, arg3);
+               break;
        default:
                printf("%s: nargs (%d) too big\n", __func__, nargs);
                abort();



Home | Main Index | Thread Index | Old Index