Rev 1129 | Rev 1427 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1129 | Rev 1392 | ||
|---|---|---|---|
| Line 38... | Line 38... | ||
| 38 | (c)->pc = (sysarg_t) (_pc); \ |
38 | (c)->pc = (sysarg_t) (_pc); \ |
| 39 | (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ |
39 | (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ |
| 40 | (c)->tls = (sysarg_t) (ptls); |
40 | (c)->tls = (sysarg_t) (ptls); |
| 41 | #endif /* context_set */ |
41 | #endif /* context_set */ |
| 42 | 42 | ||
| - | 43 | typedef enum { |
|
| - | 44 | PS_TO_MANAGER, |
|
| - | 45 | PS_FROM_MANAGER, |
|
| - | 46 | PS_PREEMPT |
|
| - | 47 | } pschange_type; |
|
| - | 48 | ||
| 43 | typedef sysarg_t pstid_t; |
49 | typedef sysarg_t pstid_t; |
| 44 | 50 | ||
| 45 | struct psthread_data { |
51 | struct psthread_data { |
| 46 | link_t link; |
52 | link_t link; |
| 47 | context_t ctx; |
53 | context_t ctx; |
| Line 59... | Line 65... | ||
| 59 | 65 | ||
| 60 | extern int context_save(context_t *c); |
66 | extern int context_save(context_t *c); |
| 61 | extern void context_restore(context_t *c) __attribute__ ((noreturn)); |
67 | extern void context_restore(context_t *c) __attribute__ ((noreturn)); |
| 62 | 68 | ||
| 63 | pstid_t psthread_create(int (*func)(void *), void *arg); |
69 | pstid_t psthread_create(int (*func)(void *), void *arg); |
| 64 | int psthread_schedule_next(void); |
- | |
| 65 | int psthread_join(pstid_t psthrid); |
70 | int psthread_join(pstid_t psthrid); |
| 66 | psthread_data_t * psthread_setup(tcb_t *tcb); |
71 | psthread_data_t * psthread_setup(void); |
| 67 | void psthread_teardown(psthread_data_t *pt); |
72 | void psthread_teardown(psthread_data_t *pt); |
| - | 73 | int psthread_schedule_next_adv(pschange_type ctype); |
|
| - | 74 | void psthread_add_ready(pstid_t ptid); |
|
| - | 75 | void psthread_add_manager(pstid_t psthrid); |
|
| - | 76 | void psthread_remove_manager(void); |
|
| - | 77 | ||
| - | 78 | static inline int psthread_schedule_next() { |
|
| - | 79 | return psthread_schedule_next_adv(PS_PREEMPT); |
|
| - | 80 | } |
|
| 68 | 81 | ||
| 69 | 82 | ||
| 70 | #endif |
83 | #endif |