Glibc syscalls now block properly (XCC)
[akaros.git] / kern / include / ros / syscall.h
index 128ff43..9cd2c5b 100644 (file)
@@ -1,55 +1,39 @@
-#ifndef ROS_INCLUDE_SYSCALL_H
-#define ROS_INCLUDE_SYSCALL_H
-
-#include <arch/types.h>
-#include <ros/ring_buffer.h>
-
-/* system call numbers */
-enum
-{
-       SYS_begofcalls, //Should always be first
-
-       SYS_null,
-       SYS_cache_buster,
-       SYS_cache_invalidate,
-       SYS_cputs,
-       SYS_cgetc,
-       SYS_getcpuid,
-       SYS_serial_write,
-       SYS_serial_read,
-       SYS_shared_page_alloc,
-       SYS_shared_page_free,
-       SYS_getenvid,
-       SYS_env_destroy,
-       SYS_yield,
-       SYS_proc_create,
-       SYS_proc_run,
-
-       SYS_endofcalls //Should always be last
+#ifndef ROS_INC_SYSCALL_H
+#define ROS_INC_SYSCALL_H
+
+#include <arch/arch.h>
+#include <ros/bits/syscall.h>
+#include <ros/arch/syscall.h>
+#include <ros/event.h>
+#include <ros/atomic.h>
+
+/* Flags for an individual syscall.
+ * Careful, sparc can't handle flags in byte 3. */
+#define SC_DONE                                        0x0001          /* SC is done */
+#define SC_PROGRESS                            0x0002          /* SC made progress */
+#define SC_UEVENT                              0x0004          /* user has an ev_q */
+#define SC_K_LOCK                              0x0008          /* kernel locked sysc */
+
+struct syscall {
+       unsigned int                            num;
+       int                                                     err;                    /* errno */
+       long                                            retval;
+       atomic_t                                        flags;
+       struct event_queue                      *ev_q;
+       void                                            *u_data;
+       long                                            arg0;
+       long                                            arg1;
+       long                                            arg2;
+       long                                            arg3;
+       long                                            arg4;
+       long                                            arg5;
 };
-#define NSYSCALLS (SYS_endofcalls -1)
-// syscall number starts at 1 and goes up to NSYSCALLS, without holes.
-#define INVALID_SYSCALL(syscallno) ((syscallno) > NSYSCALLS)
-
-/* For Buster Measurement Flags */
-#define BUSTER_SHARED                  0x0001
-#define BUSTER_STRIDED                 0x0002
-#define BUSTER_LOCKED                  0x0004
-#define BUSTER_PRINT_TICKS             0x0008
-#define BUSTER_JUST_LOCKS              0x0010 // unimplemented
 
-#define NUM_SYSCALL_ARGS 6
-typedef struct syscall_req {
-       uint32_t num;
-       uint32_t flags;
-       uint32_t args[NUM_SYSCALL_ARGS];
-} syscall_req_t;
+#ifndef ROS_KERNEL
 
-typedef struct syscall_rsp {
-       int32_t retval;
-} syscall_rsp_t;
+/* Temp hack, til the rest of glibc/userspace uses sys/syscall.h */
+#include <sys/syscall.h>
 
-// Generic Syscall Ring Buffer
-DEFINE_RING_TYPES(syscall, syscall_req_t, syscall_rsp_t);
+#endif /* ifndef ROS_KERNEL */
 
-#endif /* !ROS_INCLUDE_SYSCALL_H */
+#endif /* ROS_INC_SYSCALL_H */