diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2016-01-02 21:13:31 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2016-01-02 21:13:31 +0100 |
commit | baedda497d16c5096971eee83a0c467fe663fe6d (patch) | |
tree | 2f8925c68d94aed7d5fc7022462abbb359200b9e /os1_cm3.s | |
parent | 9129af503c8211d713c8a160a3b6f3f86b328639 (diff) | |
download | stm32f103-playground-baedda497d16c5096971eee83a0c467fe663fe6d.tar.gz stm32f103-playground-baedda497d16c5096971eee83a0c467fe663fe6d.tar.bz2 stm32f103-playground-baedda497d16c5096971eee83a0c467fe663fe6d.tar.xz stm32f103-playground-baedda497d16c5096971eee83a0c467fe663fe6d.zip |
o Moving around a lot of files.
Diffstat (limited to 'os1_cm3.s')
-rw-r--r-- | os1_cm3.s | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/os1_cm3.s b/os1_cm3.s deleted file mode 100644 index a9083dc..0000000 --- a/os1_cm3.s +++ /dev/null @@ -1,56 +0,0 @@ -.syntax unified -.cpu cortex-m3 -.thumb - -.section .text - -/* - -User threads use the process stack (PSP register), kernel and exception code use the main stack (MSP register). - -*/ - -.thumb_func -.global do_first_context_switch -// void do_first_context_switch(uint8_t *user_stack, void (task)(const void *arg)); -do_first_context_switch: - /* Set PSP to the user task's stack */ - msr psp, r0 - - // Set CONTROL.SPSEL=1 so that we run with two stacks - mov r0, #2 - msr control, r0 - isb - - // Restore the data from hardware_frame_t. - pop {r0 - r3, r12, lr} - // Pop PC and PSR. PSR is ignored, but we branch to the new PC - pop {r4, r5} - bx r4 - -/* -When this function is executed {r0-r3,r12,lr,pc} has been pushed to the stack pointed to by PSP. We push the rest of the -registers to the PSP. The current stack pointer is the MSP. - */ -.thumb_func -.global PendSV_Handler -PendSV_Handler: - // Save the rest of the context to the current process' stack - mrs r0, psp - stmdb r0!, {r4 - r11} - - // Call select_next_task_sp. after return, r0 points to a task_t - bl _Z16select_next_taskPh // task_t *select_next_task(uint8_t *current_stack) - - // load task_t.stack and task_t.lr into r1 and lr - ldm r0, {r1, lr} - - ldmia r1!, {r4 - r11} - msr psp, r1 - - // Return, let the CPU restore the hardware part of the context - bx lr -.pool -.size PendSV_Handler,.-PendSV_Handler - -.end |