Module Name:    src
Committed By:   reinoud
Date:           Fri Sep  2 14:56:48 UTC 2011

Modified Files:
        src/sys/arch/usermode/dev: cpu.c
        src/sys/arch/usermode/include: pcb.h

Log Message:
Update trapframe and add system call switchframe


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/usermode/dev/cpu.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/usermode/include/pcb.h

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/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.23 src/sys/arch/usermode/dev/cpu.c:1.24
--- src/sys/arch/usermode/dev/cpu.c:1.23	Mon Aug 29 12:46:58 2011
+++ src/sys/arch/usermode/dev/cpu.c	Fri Sep  2 14:56:48 2011
@@ -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 <jmcne...@invisible.ca>
@@ -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

Index: src/sys/arch/usermode/include/pcb.h
diff -u src/sys/arch/usermode/include/pcb.h:1.6 src/sys/arch/usermode/include/pcb.h:1.7
--- src/sys/arch/usermode/include/pcb.h:1.6	Mon Aug 29 12:37:53 2011
+++ src/sys/arch/usermode/include/pcb.h	Fri Sep  2 14:56:48 2011
@@ -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 <jmcne...@invisible.ca>
@@ -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;

Reply via email to