diff options
author | Christian Cunningham <cc@localhost> | 2022-02-01 17:19:16 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2022-02-01 17:19:16 -0700 |
commit | 36f2d87ee57e841be5fe60f6430bdd167f9f03af (patch) | |
tree | 4668df28fa099cb1111cd7b4657ce7ef4c5db290 | |
parent | 352c8713ddb99f4b9f3c73b5b6b8bc9e83f6b6bd (diff) |
Added spinlock condition
-rw-r--r-- | Common.mk | 2 | ||||
-rw-r--r-- | include/cpu/atomic/swap.h | 3 | ||||
-rw-r--r-- | linker.ld | 2 | ||||
-rw-r--r-- | src/exceptions/svc.S | 5 |
4 files changed, 5 insertions, 7 deletions
@@ -26,7 +26,7 @@ ifeq ($(BSP),2) CFLAGS += -DBSP23 endif -CFLAGS += -DVERSION="\"0.0s\"" +CFLAGS += -DVERSION="\"0.1a\"" .PHONY: clean run run-debug debug export tree diff --git a/include/cpu/atomic/swap.h b/include/cpu/atomic/swap.h index ebaaa1d..57a5add 100644 --- a/include/cpu/atomic/swap.h +++ b/include/cpu/atomic/swap.h @@ -13,7 +13,8 @@ static inline void atm_lock(unsigned long pid, unsigned long* addr) { unsigned long tmp, current_lock_value; asm volatile( -"1: ldrex %0, [%3]\n" +"1: clrex\n" +" ldrex %0, [%3]\n" " cmp %0, #0\n" " wfene\n" " strexeq %1, %2, [%3]\n" @@ -13,7 +13,7 @@ SECTIONS KEEP(*(.text.kernel)) *(.text*) } - . = ALIGN(4096); /* align to page size */ + . = 0x208000; /* 2MiB Kernel/ Boot */ __text_end = .; __data_start = .; diff --git a/src/exceptions/svc.S b/src/exceptions/svc.S index a5e9982..d1fcbc0 100644 --- a/src/exceptions/svc.S +++ b/src/exceptions/svc.S @@ -5,9 +5,6 @@ svc: stmfd sp!, {r0-r12,lr} ldr r0, [lr, #-4] bic r0, #0xFF000000 - // SVC #0 returns to supervisor mode - // TODO: Make supervisor mode return to a specific location - // (rather than to a user location) such as the kernel loop cmp r0, #3 bgt svc_exit beq svc_000003 @@ -27,7 +24,7 @@ svc_000002: b schedule svc_000003: ldr r3, =scheduler - ldr r2, [r3, #0] + ldr r2, [r3, #0] // struct Thread* rthread ldr r1, [r2, #8] // sp_base cmp r1, #-1 beq svc_exit |