diff options
author | Christian Cunningham <cc@localhost> | 2022-02-22 23:27:39 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-02-22 23:27:39 -0700 |
commit | b5021c723a5ee267982c4779bb1b1d644e4d2d5c (patch) | |
tree | 5c65cc4e784c0ee930ea255293aeb67abcf1f723 /src | |
parent | 8ffc1b0fd55aff5fa1014cd99db4dbb695d51a4c (diff) |
Started multithreading
Diffstat (limited to 'src')
-rw-r--r-- | src/boot.S | 19 | ||||
-rw-r--r-- | src/sys/kernel.S | 32 |
2 files changed, 45 insertions, 6 deletions
@@ -13,11 +13,11 @@ reset: mrc p15, #0, r1, c0, c0, #5 and r1, r1, #3 cmp r1, #1 - beq core1run + beq runcore1 cmp r1, #2 - beq core2run + beq runcore2 cmp r1, #3 - bge core3run + bge runcore3 init_core 0 @@ -52,14 +52,17 @@ reset: ldr r3, =kernel_main blx r3 -core1run: +runcore1: init_core 1 + core_task 1 b io_halt -core2run: +runcore2: init_core 2 + core_task 2 b io_halt -core3run: +runcore3: init_core 3 + core_task 3 b io_halt .globl io_halt @@ -88,9 +91,13 @@ irq_handler: .word irq fiq_handler: .word fiq .section .data +.globl mbox_core0 mbox_core0: .word 0 +.globl mbox_core1 mbox_core1: .word 0 +.globl mbox_core2 mbox_core2: .word 0 +.globl mbox_core3 mbox_core3: .word 0 .section .bss.estacks diff --git a/src/sys/kernel.S b/src/sys/kernel.S index 3ffc6a5..6452a4f 100644 --- a/src/sys/kernel.S +++ b/src/sys/kernel.S @@ -1,11 +1,19 @@ .section ".text.kernel" +.include "macros.inc" + .globl kernel_main kernel_main: ///https://wiki.osdev.org/ARM_Paging // Query the ID_MMFR0 register mrc p15, 0, r0, c0, c1, 4 bl sysinit + + assign_ctask testf, 2 + assign_ctask testf, 1 + assign_ctask testf, 2 + assign_ctask testf, 3 + assign_ctask testf, 1 // Intentional undefined instruction // .word 0xf7f0a000 cpsie aif, #0x10 @@ -13,3 +21,27 @@ kernel_main: 1: wfe b 1b + +testf: + push {lr} + cmp r0, #2 + blo 1f + beq 2f + bgt 3f +1: + ldr r0, =t1 + bl uart_print + pop {pc} +2: + ldr r0, =t2 + bl uart_print + pop {pc} +3: + ldr r0, =t3 + bl uart_print + pop {pc} + +.section .data +t1: .asciz "C1\n" +t2: .asciz "C2\n" +t3: .asciz "C3\n" |