From 3a8ed19bf83f11ff00c4904fab2cc083b7e33478 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Wed, 5 Jan 2022 14:01:29 -0800 Subject: Cleaned up/ Standardized --- src/cpu/atomic/swap.h | 1 + src/cpu/irq.S | 82 --------------------------------------------------- src/cpu/irq.c | 4 +-- 3 files changed, 2 insertions(+), 85 deletions(-) delete mode 100644 src/cpu/irq.S (limited to 'src/cpu') diff --git a/src/cpu/atomic/swap.h b/src/cpu/atomic/swap.h index 3584d4e..cbed62c 100644 --- a/src/cpu/atomic/swap.h +++ b/src/cpu/atomic/swap.h @@ -8,6 +8,7 @@ /// https://www.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/3_Processes.html /// https://developer.arm.com/documentation/dht0008/a/arm-synchronization-primitives/practical-uses/implementing-a-semaphore?lang=en +// TODO: Once scheduling works, have a failed lock put thread in waiting state static inline void atm_lock(unsigned long pid, unsigned long* addr) { unsigned long tmp, current_lock_value; diff --git a/src/cpu/irq.S b/src/cpu/irq.S deleted file mode 100644 index fbb6ab7..0000000 --- a/src/cpu/irq.S +++ /dev/null @@ -1,82 +0,0 @@ -a_irq_handler: - push {lr} - cpsid i // Disable IRQ - // r2 = CORE0_INTERRUPT_SOURCE - // if r2 & 0b100000000 - mov r2, #0x40000000 - ldr r3, [r2, #0x60] - tst r3, #256 - beq a_irq_handler.timer - // r2 = IRQ_PEND2 - // r2 & 1 << 25 - mov r2, #0xB208 - movt r2, #0x3F00 - ldr r3, [r2] - tst r3, #0x2000000 - beq a_irq_handler.exit - mov r2, #0x1040 - movt r2, #0x3F20 - ldr r3, [r2] - tst r3, #16 - beq a_irq_handler.exit - mov r2, #0x1000 - movt r2, #0x3F20 - ldrb r0, [r2] - push {r0} - - // If 't' was pressed - // disable timer - cmp r0, #0x74 - bne a_irq_handler.ttimer - mrc p15, #0, r0, c14, c3, #1 - cmp r0, #0 - beq a_irq_handler.etimer - // Disable - mov r0, #0 - mcr p15, 0, r0, c14, c3, 1 - b a_irq_handler.ttimer -a_irq_handler.etimer: - // Enable - ldr r0, =cntfrq - bl write_cntv_tval - mov r0, #1 - mcr p15, 0, r0, c14, c3, 1 - // Otherwise continue -a_irq_handler.ttimer: - pop {r0} - bl uart_char - ldr r0, =imsg - bl uart_string - cpsie i // Enable IRQ - pop {pc} -a_irq_handler.timer: - - // r2 = CORE0_INTERRUPT_SOURCE - // if r2 & 0b1000 - mov r2, #0x40000000 - ldr r3, [r2, #0x60] - tst r3, #8 - beq a_irq_handler.exit - bl c_timer - //ldr r0, =imsg - //bl uart_string -a_irq_handler.exit: - cpsie i // Enable IRQ - pop {pc} - -.globl a_fiq_handler -a_fiq_handler: - push {lr} - cpsie f // Disable FIQ - bl c_timer - ldr r0, =fmsg - bl uart_string -a_fiq_handler.exit: - cpsie f // Enable FIQ - pop {pc} - -.section ".data" -imsg: - .asciz " asm_irq_handler\n" -fmsg: - .asciz " asm_fiq_handler\n" diff --git a/src/cpu/irq.c b/src/cpu/irq.c index dbd4c10..4a96018 100644 --- a/src/cpu/irq.c +++ b/src/cpu/irq.c @@ -2,14 +2,12 @@ #include "../drivers/uart.h" #include "../graphics/drawer.h" #include "../sys/core.h" +#include "../sys/kernel.h" #include "../sys/timer.h" #include "../util/mutex.h" #include "../util/status.h" #include "../util/time.h" -extern unsigned long cmdidx; -extern char cmd[2048]; - void localtest(void); void c_irq_handler(void) -- cgit v1.2.1