#define ASM
#include "config.h"
#include "cpu.h"

    .global start
    .global _newstart
#ifdef BOOTLOADER
    .section .blreloc,"ax","%progbits"
start:
    msr     cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */
    ldr     r2, =_relocstart
    ldr     r3, =_relocend
    ldr     r4, =_reloccopy
1:
    cmp     r3, r2
    ldrhi   r1, [r4], #4
    strhi   r1, [r2], #4
    bhi     1b
    .ltorg
#endif
    .section .intvect,"ax",%progbits
    /* Exception vectors */
#ifndef BOOTLOADER
start:
#endif
    b _newstart
    ldr pc, =undef_instr_handler
    ldr pc, =software_int_handler
    ldr pc, =prefetch_abort_handler
    ldr pc, =data_abort_handler
    ldr pc, =reserved_handler
    ldr pc, =irq_handler
    ldr pc, =fiq_handler
    .ltorg

_newstart:
    ldr pc, =newstart2

    .section .init.text,"ax",%progbits
newstart2: