Defines new struct user_context (XCC)
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 11 Apr 2013 01:32:03 +0000 (18:32 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 11 Apr 2013 01:33:21 +0000 (18:33 -0700)
Changes some #includes to get everyone calling ros/trapframe.h instead
of ros/arch/trapframe.h.

14 files changed:
kern/arch/i686/ros/trapframe.h
kern/arch/i686/trap.h
kern/arch/riscv/ros/trapframe.h
kern/arch/riscv/trap.h
kern/arch/sparc/ros/trapframe.h
kern/arch/sparc/trap.h
kern/include/ros/event.h
kern/include/ros/trapframe.h [new file with mode: 0644]
user/c3po/threads/ucontext.h
user/parlib/include/i686/arch.h
user/parlib/include/i686/vcore.h
user/parlib/include/riscv/vcore.h
user/parlib/include/sparc/vcore.h
user/pthread/pthread.c

index ba574fd..8b49f55 100644 (file)
@@ -1,7 +1,11 @@
 /*  Mostly from JOS.   See COPYRIGHT for copyright information. */
 
-#ifndef ROS_INCLUDE_ARCH_TRAPFRAME_H
-#define ROS_INCLUDE_ARCH_TRAPFRAME_H
+#ifndef ROS_INC_ARCH_TRAPFRAME_H
+#define ROS_INC_ARCH_TRAPFRAME_H
+
+#ifndef ROS_INC_TRAPFRAME_H
+#error "Do not include include ros/arch/trapframe.h directly"
+#endif
 
 #include <ros/common.h>
 
@@ -39,6 +43,13 @@ typedef struct trapframe {
        uint16_t tf_padding6;
 } trapframe_t;
 
+/* Temporary aliasing */
+#define hw_trapframe trapframe
+
+struct sw_trapframe {
+       /* TODO */
+};
+
 /* TODO: consider using a user-space specific trapframe, since they don't need
  * all of this information.  Might do that eventually, but til then: */
 #define user_trapframe trapframe
@@ -137,4 +148,4 @@ typedef struct ancillary_state {
        __uint128_t             reserv5;
 } __attribute__((aligned(16))) ancillary_state_t;
 
-#endif /* !ROS_INCLUDE_ARCH_TRAPFRAME_H */
+#endif /* ROS_INC_ARCH_TRAPFRAME_H */
index fc6a287..fd8bf7f 100644 (file)
@@ -59,7 +59,7 @@
 
 #include <ros/common.h>
 #include <arch/mmu.h>
-#include <arch/ros/trapframe.h>
+#include <ros/trapframe.h>
 
 /* The kernel's interrupt descriptor table */
 extern gatedesc_t idt[];
index 23092eb..34d84e2 100644 (file)
@@ -1,5 +1,9 @@
-#ifndef ROS_INCLUDE_ARCH_TRAPFRAME_H
-#define ROS_INCLUDE_ARCH_TRAPFRAME_H
+#ifndef ROS_INC_ARCH_TRAPFRAME_H
+#define ROS_INC_ARCH_TRAPFRAME_H
+
+#ifndef ROS_INC_TRAPFRAME_H
+#error "Do not include include ros/arch/trapframe.h directly"
+#endif
 
 #include <ros/common.h>
 #include <stdint.h>
@@ -13,6 +17,13 @@ typedef struct trapframe
   long cause;
 } trapframe_t;
 
+/* Temporary aliasing */
+#define hw_trapframe trapframe
+
+struct sw_trapframe {
+       /* TODO */
+};
+
 /* TODO: consider using a user-space specific trapframe, since they don't need
  * all of this information.  Will do that eventually, but til then: */
 #define user_trapframe trapframe
@@ -23,4 +34,4 @@ typedef struct ancillary_state
        uint32_t fsr;
 } ancillary_state_t;
 
-#endif /* !ROS_INCLUDE_ARCH_TRAPFRAME_H */
+#endif /* ROS_INC_ARCH_TRAPFRAME_H */
index f39934c..1e0f9ef 100644 (file)
@@ -9,7 +9,7 @@
 
 #ifndef __ASSEMBLER__
 
-#include <ros/arch/trapframe.h>
+#include <ros/trapframe.h>
 #include <arch/arch.h>
 
 /* Kernel message interrupt vector.  ignored, for the most part */
index c7f2d42..1ea4c93 100644 (file)
@@ -1,5 +1,9 @@
-#ifndef ROS_INCLUDE_ARCH_TRAPFRAME_H
-#define ROS_INCLUDE_ARCH_TRAPFRAME_H
+#ifndef ROS_INC_ARCH_TRAPFRAME_H
+#define ROS_INC_ARCH_TRAPFRAME_H
+
+#ifndef ROS_INC_TRAPFRAME_H
+#error "Do not include include ros/arch/trapframe.h directly"
+#endif
 
 #include <ros/common.h>
 #include <stdint.h>
@@ -18,6 +22,13 @@ typedef struct trapframe
        uint64_t timestamp;
 } trapframe_t;
 
+/* Temporary aliasing */
+#define hw_trapframe trapframe
+
+struct sw_trapframe {
+       /* TODO */
+};
+
 /* TODO: consider using a user-space specific trapframe, since they don't need
  * all of this information.  Will do that eventually, but til then: */
 #define user_trapframe trapframe
@@ -28,4 +39,4 @@ typedef struct ancillary_state
        uint32_t fsr;
 } ancillary_state_t;
 
-#endif /* !ROS_INCLUDE_ARCH_TRAPFRAME_H */
+#endif /* ROS_INC_ARCH_TRAPFRAME_H */
index 30dc789..1e82a3d 100644 (file)
@@ -7,7 +7,7 @@
 #ifndef __ASSEMBLER__
 
 #include <ros/common.h>
-#include <ros/arch/trapframe.h>
+#include <ros/trapframe.h>
 #include <arch/ros/arch.h>
 #include <arch/sparc.h>
 
index 02c42bb..ea1e513 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <ros/common.h>
 #include <ros/atomic.h>
-#include <ros/arch/trapframe.h>
+#include <ros/trapframe.h>
 /* #include <ros/ucq.h> included below */
 
 /* Event Delivery Flags from the process to the kernel */
diff --git a/kern/include/ros/trapframe.h b/kern/include/ros/trapframe.h
new file mode 100644 (file)
index 0000000..729c9d9
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef ROS_INC_TRAPFRAME_H
+#define ROS_INC_TRAPFRAME_H
+
+#include <ros/arch/trapframe.h>
+
+#define ROS_HW_CTX                             1
+#define ROS_SW_CTX                             2
+
+/* User-space context, either from a hardware event (IRQ, trap, etc), or from a
+ * syscall.  Each arch defines its types. */
+struct user_context {
+       int                                                     type;
+       union {
+               struct hw_trapframe             hw_tf;
+               struct sw_trapframe             sw_tf;
+       } tf;
+};
+
+#endif /* ROS_INC_TRAPFRAME_H */
index 962e64c..0a81691 100644 (file)
@@ -2,7 +2,7 @@
 #define UCONTEXT_H
 
 #include <stdint.h>
-#include <ros/arch/trapframe.h>
+#include <ros/trapframe.h>
 #include <threadlib_internal.h>
 struct u_context {
        struct user_trapframe utf;
index e879b33..5bbac41 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef PARLIB_ARCH_H
 #define PARLIB_ARCH_H
 
-#include <ros/arch/trapframe.h>
+#include <ros/trapframe.h>
 #include <ros/arch/mmu.h>
 #include <ros/common.h>
 #include <string.h>
index 31b25d5..7ce94cd 100644 (file)
@@ -2,7 +2,7 @@
 #define PARLIB_ARCH_VCORE_H
 
 #include <ros/common.h>
-#include <ros/arch/trapframe.h>
+#include <ros/trapframe.h>
 #include <ros/procdata.h>
 #include <ros/syscall.h>
 #include <ros/arch/mmu.h>
index a558054..542fd9a 100644 (file)
@@ -2,7 +2,7 @@
 #define PARLIB_ARCH_VCORE_H
 
 #include <ros/common.h>
-#include <ros/arch/trapframe.h>
+#include <ros/trapframe.h>
 #include <arch/arch.h>
 #include <ros/syscall.h>
 #include <ros/procdata.h>
index a37a721..d0012a2 100644 (file)
@@ -2,7 +2,7 @@
 #define PARLIB_ARCH_VCORE_H
 
 #include <ros/common.h>
-#include <ros/arch/trapframe.h>
+#include <ros/trapframe.h>
 #include <arch/arch.h>
 #include <ros/syscall.h>
 #include <ros/procdata.h>
index b1062df..37ef272 100644 (file)
@@ -1,4 +1,4 @@
-#include <ros/arch/trapframe.h>
+#include <ros/trapframe.h>
 #include <pthread.h>
 #include <vcore.h>
 #include <mcs.h>