4 #include "kernel_offset.h"
\r
5 #include "arch_offset.h"
\r
16 /* r0 - pcb for old task
\r
17 * r1 pcb for new task
\r
19 * -------------- higher addr
\r
22 * 4 - Large or Small context indicator
\r
24 * ---------- <- JABBA
\r
27 .global os_arch_swap_context
\r
28 .type os_arch_swap_context, %function
\r
29 os_arch_swap_context:
\r
31 push {r4-r8,r10,r11,lr}
\r
36 mov.w r4,#SC_PATTERN
\r
37 str r4,[sp,#C_CONTEXT_OFFS]
\r
38 // str r2,[sp,#C_SP_OFF]
\r
39 // ---> We have saved NVGPR+C
\r
41 // store old stack for old task
\r
43 str r4,[r0,#PCB_STACK_CURR_P]
\r
46 .global os_arch_swap_context_to
\r
47 .type os_arch_swap_context_to, %function
\r
48 os_arch_swap_context_to:
\r
50 // Get stack for new task
\r
51 ldr r2,[r1,#PCB_STACK_CURR_P]
\r
56 // TODO: Fix this for all arch's..call pre,post hooks. Done here or after?
\r
57 // Set new current pcb
\r
59 str r1,[r5,#SYS_CURR_PCB_P]
\r
61 // Restore C context
\r
62 ldr r6,[sp,#C_CONTEXT_OFFS]
\r
68 // TODO: Jump to error handler
\r
74 pop {r4-r8,r10,r11,lr}
\r
75 // ehh, we are in handler mode so a bx instruction works here
\r
80 pop {r4-r8,r10,r11,lr}
\r
81 // ehh, we are in handler mode so a bx instruction works here
\r