From 8aa5a238e8a29135db4385cd4e4d7cb29f631754 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 22 Sep 2013 23:47:27 +0800 Subject: [PATCH] Kernel/armv7 - Hack to prevent two multiple running _start - Fixes qemu causing corruption --- KernelLand/Kernel/arch/armv7/start.S | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/KernelLand/Kernel/arch/armv7/start.S b/KernelLand/Kernel/arch/armv7/start.S index 8193b31c..1fe0fd86 100644 --- a/KernelLand/Kernel/arch/armv7/start.S +++ b/KernelLand/Kernel/arch/armv7/start.S @@ -16,8 +16,17 @@ ivt_unused: b . @ 0x14 Not Used ivt_irq: b IRQHandler @ 0x18 IRQ ivt_fiq: b . @ 0x1C FIQ (Fast interrupt) +init_lock: .long 0 + +.extern SHORTLOCK .globl _start _start: + ldr r1, =init_lock + mov r0, #1 + swp r0, r0, [r1] + tst r0,r0 + bne .smp_halt + ldr r2, =UART0_PADDR mov r1, #'A' str r1, [r2] @@ -116,6 +125,8 @@ _start: ldr r0, =kmain mov pc, r0 1: b 1b @ Infinite loop +.smp_halt: +1: b 1b .comm irqstack, 0x1000 @ ; 4KiB Stack .comm abortstack, 0x1000 @ ; 4KiB Stack -- 2.20.1