Compiles with GCC
[akaros.git] / kern / include / smp.h
index 77909b4..36be0bb 100644 (file)
 /* SMP related functions */
 
 #include <arch/smp.h>
-#include <arch/types.h>
+#include <ros/common.h>
 #include <trap.h>
 #include <atomic.h>
+#include <process.h>
 #include <workqueue.h>
-
-// be careful changing this, esp if you go over 16
-#define NUM_HANDLER_WRAPPERS           5
-
-typedef struct HandlerWrapper {
-       checklist_t* cpu_list;
-       uint8_t vector;
-} handler_wrapper_t;
+#include <env.h>
 
 // will want this padded out to cacheline alignment
 struct per_cpu_info {
-       uint32_t lock;
-       struct workqueue workqueue;
+       spinlock_t lock;
+       bool preempt_pending;
+       struct workqueue TP(void*) workqueue;
+#ifdef __i386__
+       spinlock_t amsg_lock;
+       unsigned amsg_current;
+       active_message_t active_msgs[NUM_ACTIVE_MESSAGES];
+#endif
 };
-extern struct per_cpu_info  per_cpu_info[MAX_NUM_CPUS];
+extern struct per_cpu_info per_cpu_info[MAX_NUM_CPUS];
 extern volatile uint8_t num_cpus;
 
 /* SMP bootup functions */
@@ -36,11 +36,11 @@ void smp_boot(void);
 void smp_idle(void);
 
 /* SMP utility functions */
-int smp_call_function_self(isr_t handler, void* data,
+int smp_call_function_self(poly_isr_t handler, TV(t) data,
                            handler_wrapper_t** wait_wrapper);
-int smp_call_function_all(isr_t handler, void* data,
+int smp_call_function_all(poly_isr_t handler, TV(t) data,
                           handler_wrapper_t** wait_wrapper);
-int smp_call_function_single(uint8_t dest, isr_t handler, void* data,
+int smp_call_function_single(uint32_t dest, poly_isr_t handler, TV(t) data,
                              handler_wrapper_t** wait_wrapper);
 int smp_call_wait(handler_wrapper_t*SAFE wrapper);