diff options
Diffstat (limited to 'demo_functionality.c')
-rw-r--r-- | demo_functionality.c | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/demo_functionality.c b/demo_functionality.c index 1ef91a1..217a858 100644 --- a/demo_functionality.c +++ b/demo_functionality.c @@ -6,6 +6,7 @@ #include "strings.h" #include "paging.h" #include "armclock.h" +#include "scheduler.h" void demo_paging_support(void) { @@ -64,7 +65,7 @@ extern char _binary_ramfs_img_end, _binary_ramfs_img_size; -void demo_setup_PL0(void) +void __attribute__((noreturn)) demo_setup_PL0(void) { // find PL_0_test.img im ramfs struct ramfile PL_0_test_img; @@ -112,30 +113,9 @@ void demo_setup_PL0(void) PL_0_test_img.file_contents, PL_0_test_img.file_size); puts("copied PL0 code to it's section"); -} - -void demo_go_unprivileged(void) -{ - uint32_t PL0_regs[14] = {0}; - PL0_regs[13] = VIRTUAL_PL0_MEMORY_START; // the new pc - PSR_t new_SPSR = read_CPSR(); - new_SPSR.fields.PSR_MODE_4_0 = MODE_USER; - new_SPSR.fields.PSR_IRQ_MASK_BIT = 0; - write_SPSR(new_SPSR); + puts("All ready! scheduling!"); - puts("All ready, jumping to PL0 code"); - - armclk_irq_settimeout(0x00100000); - - asm volatile("cps %[sysmode]\n\r" - "mov sp, %[stackaddr]\n\r" - "cps %[supmode]\n\r" - "ldm %[contextaddr], {r0 - r12, pc} ^" :: - [sysmode]"I" (MODE_SYSTEM), - [supmode]"I" (MODE_SUPERVISOR), - [stackaddr]"r" ((PL0_SECTION_NUMBER + 1) << 20), - [contextaddr]"r" (PL0_regs) : "memory"); - - __builtin_unreachable(); + schedule_new(VIRTUAL_PL0_MEMORY_START, // the new pc + VIRTUAL_PL0_MEMORY_END); // the new sp } |