Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/usermode Update trapframe and add system call switc...



details:   https://anonhg.NetBSD.org/src/rev/d8cb3c8ac48b
branches:  trunk
changeset: 769185:d8cb3c8ac48b
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Fri Sep 02 14:56:48 2011 +0000

description:
Update trapframe and add system call switchframe

diffstat:

 sys/arch/usermode/dev/cpu.c     |  15 +++++++++------
 sys/arch/usermode/include/pcb.h |  10 ++++++----
 2 files changed, 15 insertions(+), 10 deletions(-)

diffs (88 lines):

diff -r 13903f5fc73d -r d8cb3c8ac48b sys/arch/usermode/dev/cpu.c
--- a/sys/arch/usermode/dev/cpu.c       Fri Sep 02 14:55:22 2011 +0000
+++ b/sys/arch/usermode/dev/cpu.c       Fri Sep 02 14:56:48 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.23 2011/08/29 12:46:58 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.24 2011/09/02 14:56:48 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_cpu.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.23 2011/08/29 12:46:58 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.24 2011/09/02 14:56:48 reinoud Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -286,6 +286,7 @@
        panic("%s: shouldn't return", __func__);
 }
 
+extern void syscall(struct lwp *l);
 void
 cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize,
     void (*func)(void *), void *arg)
@@ -321,6 +322,8 @@
        pcb2->pcb_ucp.uc_flags = _UC_STACK | _UC_CPU;
        thunk_makecontext(&pcb2->pcb_ucp, (void (*)(void))cpu_lwp_trampoline,
            2, func, arg);
+       thunk_makecontext_1(&pcb2->pcb_syscall_ucp, (void (*)(void))syscall,
+               l2);
 }
 
 void
@@ -328,7 +331,6 @@
 {
 }
 
-int syscall(lwp_t *l, struct trapframe *tr);
 void
 cpu_startup(void)
 {
@@ -345,10 +347,11 @@
                panic("getcontext failed");
        uvm_lwp_setuarea(&lwp0, (vaddr_t)&lwp0pcb);
 
-       /* init trapframe (going nowhere!), maybe a panic func? */
-       lwp0pcb.pcb_tf.tf_syscall = syscall;
+       /* init switchframes */
        memcpy(&lwp0pcb.pcb_userland_ucp, &lwp0pcb.pcb_ucp, sizeof(ucontext_t));
-//     thunk_makecontext_trapframe2go(&lwp0pcb.pcb_userland_ucp, NULL, NULL);
+       memcpy(&lwp0pcb.pcb_syscall_ucp,  &lwp0pcb.pcb_ucp, sizeof(ucontext_t));
+       thunk_makecontext_1(&lwp0pcb.pcb_syscall_ucp, (void (*)(void))syscall,
+               &lwp0);
 }
 
 void
diff -r 13903f5fc73d -r d8cb3c8ac48b sys/arch/usermode/include/pcb.h
--- a/sys/arch/usermode/include/pcb.h   Fri Sep 02 14:55:22 2011 +0000
+++ b/sys/arch/usermode/include/pcb.h   Fri Sep 02 14:56:48 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcb.h,v 1.6 2011/08/29 12:37:53 reinoud Exp $ */
+/* $NetBSD: pcb.h,v 1.7 2011/09/02 14:56:48 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -37,15 +37,17 @@
  * XXX move to frame.h?
  */
 
+/* XXX NOT USED YET */
 typedef struct trapframe {
-       int             (*tf_syscall)(lwp_t *, struct trapframe *);
-       int              tf_reason;             /* XXX unused */
-       uintptr_t        tf_io[8];              /* to transport info */
+//     int             (*tf_syscall)(lwp_t *, struct trapframe *);
+//     int              tf_reason;             /* XXX unused */
+//     uintptr_t        tf_io[8];              /* to transport info */
 } trapframe_t;
 
 
 struct pcb {
        ucontext_t       pcb_ucp;               /* lwp switchframe */
+       ucontext_t       pcb_syscall_ucp;       /* syscall switchframe */
        ucontext_t       pcb_userland_ucp;      /* userland switchframe */
        bool             pcb_needfree;
        struct trapframe pcb_tf;



Home | Main Index | Thread Index | Old Index