rt 0.19.1

A real-time operating system capable of full preemption
Documentation
@ vim:ft=arm

#include <rt/arch/pseudo.S>

    .syntax unified
    .section .text.start, "ax", %progbits
    .global start
    .type start, %function
start:
    // Disable interrupts. rt_start will re-enable them.
    cpsid i

    /* Initialize the first several words of the stack so they have valid ECC
     * for the init function. The remainder of the stacks will be initialized
     * as part of the zero table. */
    push {r0-r7}
    push {r0-r7}
    push {r0-r7}
    push {r0-r7}
    add sp, 128

    bl init

    mov32 r4, __copy_table__
    mov32 r5, __copy_table_end__
    b 2f
0:  ldmia r4!, {r0-r2}
    cbz r2, 2f
    add r2, r0
1:  ldmia r1!, {r6, r7}
    stmia r0!, {r6, r7}
    cmp r0, r2
    bne 1b
2:  cmp r4, r5
    bne 0b

    mov32 r4, __zero_table__
    mov32 r5, __zero_table_end__
    movs r6, 0
    movs r7, 0
    b 2f
0:  ldmia r4!, {r0, r1}
    cbz r1, 2f
    add r1, r0
1:  stmia r0!, {r6, r7}
    cmp r0, r1
    bne 1b
2:  cmp r4, r5
    bne 0b

    mov32 r4, __init_array__
    mov32 r5, __init_array_end__
    b 1f
0:  ldmia r4!, {r0}
    blx r0
1:  cmp r4, r5
    bne 0b

    bl rt_start

    .size start, .-start