4 #include "kernel_offset.h"
\r
6 #include "asm_hc1x.sx"
\r
7 #include "context.sx"
\r
10 .extern os_proc_start_extended
\r
12 #define IRQ_ENABLE() cpsie i
\r
13 #define IRQ_DISABLE() cpsid i
\r
16 .global Os_ArchSwapContextToW
\r
17 .global Os_ArchSwapContextTo
\r
18 .global Os_ArchSwapContext
\r
19 .global Os_ArchSetSpAndCall
\r
23 /* void Os_ArchSetSpAndCall(void *sp, void (*f)(void) ); */
\r
24 Os_ArchSetSpAndCall:
\r
25 MOVE_ARG 1, x // f --> X
\r
26 MOVE_ARG 0, sp // sp (D) --> SP
\r
30 Os_ArchSwapContextToW:
\r
33 b Os_ArchSwapContextTo
\r
36 /* void Os_ArchSwapContext(void *old, void *new); */
\r
38 Os_ArchSwapContext_get_args:
\r
39 MOVE_ARG 0, x // old --> X
\r
40 MOVE_ARG 1, y // new --> Y
\r
42 SAVE_CONTEXT_FROM_FUNCTION
\r
44 sts PCB_STACK_CURR_P, x // SP --> old->stack.curr
\r
45 bra Os_ArchSwapContextTo_do
\r
48 /* void Os_ArchSwapContextTo(void *old, void *new); */
\r
49 Os_ArchSwapContextTo:
\r
50 Os_ArchSwapContextTo_get_args:
\r
51 // Get stack for new task
\r
52 MOVE_ARG 1, y // new --> Y
\r
54 Os_ArchSwapContextTo_do:
\r
55 // Set current process
\r
56 sty os_sys // new (Y) --> os_sys.curr_pcb
\r
58 lds PCB_STACK_CURR_P, y // new->stack.curr --> SP
\r
60 RESTORE_CONTEXT_FOR_FUNCTION
\r