1 #ifndef __LUNAIX_SWITCH_H
2 #define __LUNAIX_SWITCH_H
4 #define SWITCH_MODE_NORMAL 0
5 #define SWITCH_MODE_FAST 1
6 #define SWITCH_MODE_GIVEUP 2
10 #include <lunaix/types.h>
12 struct signpost_result
19 * @brief Decide how current thread should perform the context switch
20 * back to it's previously saved context.
22 * Return a user stack pointer perform a temporary fast redirected
24 * No redirection is required if such pointer is null.
26 * This function might never return if the decision is made to give up
29 * NOTE: This function might have side effects, it can only be
30 * called within the twilight zone of context restore. (after entering
31 * do_switch and before returning from exception)
39 redirect_switch(struct signpost_result* res, ptr_t stack)
41 res->mode = SWITCH_MODE_FAST;
46 continue_switch(struct signpost_result* res)
48 res->mode = SWITCH_MODE_NORMAL;
53 giveup_switch(struct signpost_result* res)
55 res->mode = SWITCH_MODE_GIVEUP;
60 #endif /* __LUNAIX_SWITCH_H */