Search
lxdream.org :: lxdream/test/lib-arm/crt0.s :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/lib-arm/crt0.s
changeset 821:4398dafeb77d
prev812:8cc61d5ea1f8
author nkeynes
date Wed Aug 20 11:25:46 2008 +0000 (12 years ago)
permissions -rw-r--r--
last change Setup the interrupt/exception vectors properly in the arm crt0
Use fully guarded memcpy_to_aica for program transfer
file annotate diff log raw
1.1 --- a/test/lib-arm/crt0.s Wed Aug 13 10:32:00 2008 +0000
1.2 +++ b/test/lib-arm/crt0.s Wed Aug 20 11:25:46 2008 +0000
1.3 @@ -5,8 +5,17 @@
1.4 .global ___exit
1.5 .global _atexit
1.6 start:
1.7 + b real_entry
1.8 + b exception_entry
1.9 + b exception_entry /* SWI - not used so jump to general exception */
1.10 + b exception_entry
1.11 + b exception_entry
1.12 + b exception_entry /* Not a vector, but if we ever get here... */
1.13 + b irq_entry
1.14 + b fiq_entry
1.15
1.16 /* Start by setting up a stack */
1.17 +real_entry:
1.18 /* Set up the stack pointer to a fixed value */
1.19 ldr r3, .LC0
1.20 mov sp, r3
1.21 @@ -18,7 +27,20 @@
1.22 However, it ensures that this simple crt0 world will not
1.23 immediately cause an overflow event: */
1.24 sub sl, sp, #64 << 10 /* Still assumes 256bytes below sl */
1.25 + b .LB0
1.26
1.27 +.syscall:
1.28 + .word -1 /* Syscall # */
1.29 + .word 0 /* Arguments */
1.30 + .word 0
1.31 + .word 0
1.32 +
1.33 +irq_counter:
1.34 + .word 0
1.35 +fiq_counter:
1.36 + .word 0
1.37 +
1.38 +.LB0:
1.39 /* Zero-out the BSS segment */
1.40 mov a2, #0 /* Second arg: fill value */
1.41 mov fp, a2 /* Null frame pointer */
1.42 @@ -28,17 +50,8 @@
1.43 ldr a3, .LC2
1.44 sub a3, a3, a1 /* Third arg: length of block */
1.45 bl memset
1.46 - b .LB0
1.47 - .word 0 /* padding */
1.48 -
1.49 -.syscall:
1.50 - .word -1 /* Syscall # */
1.51 - .word 0 /* Arguments */
1.52 - .word 0
1.53 - .word 0
1.54
1.55 /* Enter main with no arguments for now */
1.56 -.LB0:
1.57 mov r0, #0 /* no arguments */
1.58 mov r1, #0 /* no argv either */
1.59 bl main
1.60 @@ -47,7 +60,26 @@
1.61
1.62 /* For Thumb, constants must be after the code since only
1.63 positive offsets are supported for PC relative addresses. */
1.64 +
1.65 +exception_entry:
1.66 + mov r13, #-2
1.67 + str r13, .syscall
1.68 +.die:
1.69 + b .die
1.70
1.71 +irq_entry:
1.72 + /* Increment IRQ counter and return */
1.73 + ldr r13, irq_counter
1.74 + add r13, r13, #1
1.75 + str r13, irq_counter
1.76 + subs r15, r14, #4
1.77 +fiq_entry:
1.78 + /* Increment FIQ counter and return */
1.79 + ldr r13, fiq_counter
1.80 + add r13, r13, #1
1.81 + str r13, fiq_counter
1.82 + subs r15, r14, #4
1.83 +
1.84 .align 0
1.85 .LC0:
1.86 .word _stack
.