8 #include <arch/vcore.h>
11 /*****************************************************************************/
12 /* TODO: This is a complete hack, but necessary for vcore stuff tow ork for now
13 * The issue is that exit sometimes calls sys_yield(), and we can't recover from
14 * that properly under our vcore model (we shouldn't though). We really need to
15 * rethink what sys_yield 'should' do when in multicore mode, or else come up
16 * with a different syscall entirely. */
20 #define exit(status) ros_syscall(SYS_proc_destroy, getpid(), status, 0, 0, 0, 0)
21 /*****************************************************************************/
23 #define LOG2_MAX_VCORES 6
24 #define MAX_VCORES (1 << LOG2_MAX_VCORES)
26 #define TRANSITION_STACK_PAGES 2
27 #define TRANSITION_STACK_SIZE (TRANSITION_STACK_PAGES*PGSIZE)
29 /* 2L-Scheduler operations. Can be 0. */
31 void (*preempt_pending)(void);
33 extern struct schedule_ops *sched_ops;
35 /* Defined by glibc; Must be implemented by a user level threading library */
36 extern void vcore_entry();
38 /* Utility Functions */
39 void *allocate_tls(void);
41 /* Vcore API functions */
44 int vcore_request(size_t k);
45 void vcore_yield(void);
46 size_t max_vcores(void);
47 size_t num_vcores(void);
48 bool check_preempt_pending(uint32_t vcoreid);
50 static inline void enable_notifs(uint32_t vcoreid)
52 __procdata.vcore_preempt_data[vcoreid].notif_enabled = TRUE;
55 static inline void disable_notifs(uint32_t vcoreid)
57 __procdata.vcore_preempt_data[vcoreid].notif_enabled = FALSE;