--- a/test/lib-arm/crt0.s Wed Aug 13 10:32:00 2008 +0000 +++ b/test/lib-arm/crt0.s Fri May 29 18:47:05 2015 +1000 @@ -5,8 +5,17 @@ .global ___exit .global _atexit start: + b real_entry + b exception_entry + b exception_entry /* SWI - not used so jump to general exception */ + b exception_entry + b exception_entry + b exception_entry /* Not a vector, but if we ever get here... */ + b irq_entry + b fiq_entry /* Start by setting up a stack */ +real_entry: /* Set up the stack pointer to a fixed value */ ldr r3, .LC0 mov sp, r3 @@ -18,7 +27,20 @@ However, it ensures that this simple crt0 world will not immediately cause an overflow event: */ sub sl, sp, #64 << 10 /* Still assumes 256bytes below sl */ + b .LB0 +.syscall: + .word -1 /* Syscall # */ + .word 0 /* Arguments */ + .word 0 + .word 0 + +irq_counter: + .word 0 +fiq_counter: + .word 0 + +.LB0: /* Zero-out the BSS segment */ mov a2, #0 /* Second arg: fill value */ mov fp, a2 /* Null frame pointer */ @@ -28,17 +50,8 @@ ldr a3, .LC2 sub a3, a3, a1 /* Third arg: length of block */ bl memset - b .LB0 - .word 0 /* padding */ - -.syscall: - .word -1 /* Syscall # */ - .word 0 /* Arguments */ - .word 0 - .word 0 /* Enter main with no arguments for now */ -.LB0: mov r0, #0 /* no arguments */ mov r1, #0 /* no argv either */ bl main @@ -47,7 +60,26 @@ /* For Thumb, constants must be after the code since only positive offsets are supported for PC relative addresses. */ + +exception_entry: + mov r13, #-2 + str r13, .syscall +.die: + b .die +irq_entry: + /* Increment IRQ counter and return */ + ldr r13, irq_counter + add r13, r13, #1 + str r13, irq_counter + subs r15, r14, #4 +fiq_entry: + /* Increment FIQ counter and return */ + ldr r13, fiq_counter + add r13, r13, #1 + str r13, fiq_counter + subs r15, r14, #4 + .align 0 .LC0: .word _stack