OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [libgloss/] [or32/] [crt0.S] - Diff between revs 243 and 399

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 243 Rev 399
Line 58... Line 58...
        l.mfspr r5,r0,SPR_EPCR_BASE     /* Source of the interrupt */   ;\
        l.mfspr r5,r0,SPR_EPCR_BASE     /* Source of the interrupt */   ;\
        l.jal   printf                                                  ;\
        l.jal   printf                                                  ;\
        l.sw    8(r1),r5                                                ;\
        l.sw    8(r1),r5                                                ;\
                                                                        ;\
                                                                        ;\
        l.ori   r3,r0,0xffff            /* Failure RC */                ;\
        l.ori   r3,r0,0xffff            /* Failure RC */                ;\
        l.jal   _exit                                                   ;\
        l.jal   exit                                                    ;\
        l.nop                                                           ;\
        l.nop                                                           ;\
                                                                        ;\
                                                                        ;\
        l.rfe                           /* Never executed we hope */
        l.rfe                           /* Never executed we hope */
 
 
 
 
Line 108... Line 108...
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
        .section .vectors,"ax"
        .section .vectors,"ax"
 
 
        /* 0x100: RESET exception */
        /* 0x100: RESET exception */
        .org    0x100
        .org    0x100
_reset:
__reset:
        /* Jump to program initialisation code */
        /* Jump to program initialisation code */
        l.j     _start
        l.j     _start
        l.nop
        l.nop
 
 
        /* 0x200: BUS exception is special, because during startup we use it
        /* 0x200: BUS exception is special, because during startup we use it
Line 122... Line 122...
           this code must be copied into the bus error vector each time. It is
           this code must be copied into the bus error vector each time. It is
           position independent to allow this copying.
           position independent to allow this copying.
 
 
           We use registers we know will not interfere in this case. */
           We use registers we know will not interfere in this case. */
        .org    0x200
        .org    0x200
_buserr:
__buserr:
        l.nop                           /* Will be overwritten */
        l.nop                           /* Will be overwritten */
        l.nop
        l.nop
        l.nop
        l.nop
        l.nop
        l.nop
 
 
_buserr_std:
__buserr_std:
        UNHANDLED_EXCEPTION (.L200)
        UNHANDLED_EXCEPTION (.L200)
 
 
_buserr_special:
__buserr_special:
        l.mfspr r24,r0,SPR_EPCR_BASE
        l.mfspr r24,r0,SPR_EPCR_BASE
        l.addi  r24,r24,4               /* Return one instruction on */
        l.addi  r24,r24,4               /* Return one instruction on */
        l.mtspr r0,r24,SPR_EPCR_BASE
        l.mtspr r0,r24,SPR_EPCR_BASE
        l.rfe
        l.rfe
 
 
Line 270... Line 270...
        .type   _start,@function
        .type   _start,@function
 
 
_start:
_start:
        /* Finding the end of stack means we need to handle the bus
        /* Finding the end of stack means we need to handle the bus
           error. Patch in some special handler code. */
           error. Patch in some special handler code. */
        l.movhi r30,hi(_buserr)         /* Where to copy to */
        l.movhi r30,hi(__buserr)        /* Where to copy to */
        l.ori   r30,r30,lo(_buserr)
        l.ori   r30,r30,lo(__buserr)
        l.movhi r28,hi(_buserr_std)     /* Where to stop copying */
        l.movhi r28,hi(__buserr_std)    /* Where to stop copying */
        l.ori   r28,r28,lo(_buserr_std)
        l.ori   r28,r28,lo(__buserr_std)
        l.movhi r26,hi(_buserr_special) /* Where to copy from */
        l.movhi r26,hi(__buserr_special)/* Where to copy from */
        l.ori   r26,r26,lo(_buserr_special)
        l.ori   r26,r26,lo(__buserr_special)
 
 
.L11:   l.sfeq  r28,r30
.L11:   l.sfeq  r28,r30
        l.bf    .L12
        l.bf    .L12
        l.nop
        l.nop
 
 
Line 323... Line 323...
        /* Initialise stack and frame pointer (set to same value) */
        /* Initialise stack and frame pointer (set to same value) */
        l.add   r1,r30,r0
        l.add   r1,r30,r0
        l.add   r2,r30,r0
        l.add   r2,r30,r0
 
 
        /* Clear out the bus error vector special code. */
        /* Clear out the bus error vector special code. */
        l.movhi r30,hi(_buserr)
        l.movhi r30,hi(__buserr)
        l.ori   r30,r30,lo(_buserr)
        l.ori   r30,r30,lo(__buserr)
        l.movhi r28,hi(_buserr_std)
        l.movhi r28,hi(__buserr_std)
        l.ori   r28,r28,lo(_buserr_std)
        l.ori   r28,r28,lo(__buserr_std)
        l.movhi r26,0x1500              /* l.nop 0 */
        l.movhi r26,0x1500              /* l.nop 0 */
        l.ori   r26,r26,0x0000
        l.ori   r26,r26,0x0000
 
 
.L5:    l.sfeq  r28,r30
.L5:    l.sfeq  r28,r30
        l.bf    .L6
        l.bf    .L6
Line 451... Line 451...
        l.sfltu r28,r30
        l.sfltu r28,r30
        l.bf    .L1
        l.bf    .L1
        l.addi  r28,r28,4               /* Delay slot */
        l.addi  r28,r28,4               /* Delay slot */
 
 
        /* Call global and static constructors */
        /* Call global and static constructors */
        l.jal   init
        l.jal   __init
        l.nop
        l.nop
 
 
        /* Set up destructors to be called from exit if main never returns */
        /* Set up destructors to be called from exit if main never returns */
        l.movhi r3,hi(fini)
        l.movhi r3,hi(__fini)
        l.jal   atexit
        l.jal   atexit
        l.ori   r3,r3,lo(fini)          /* Delay slot */
        l.ori   r3,r3,lo(__fini)        /* Delay slot */
 
 
        /* Initialise UART in a C function. If the UART isn't present, we'll */
        /* Initialise UART in a C function. If the UART isn't present, we'll */
        /* link against a dummy function. */
        /* link against a dummy function. */
        l.jal    _uart_init
        l.jal    __uart_init
        l.nop
        l.nop
 
 
        /* Jump to main program entry point (argc = argv = envp = 0) */
        /* Jump to main program entry point (argc = argv = envp = 0) */
        l.or    r3,r0,r0
        l.or    r3,r0,r0
        l.or    r4,r0,r0
        l.or    r4,r0,r0
        l.jal   main
        l.jal   main
        l.or    r5,r0,r0                /* Delay slot */
        l.or    r5,r0,r0                /* Delay slot */
 
 
        /* If program exits, call exit routine */
        /* If program exits, call exit routine */
        l.jal   _exit
        l.jal   exit
        l.addi  r3,r11,0                /* Delay slot */
        l.addi  r3,r11,0                /* Delay slot */
 
 
        /* Loop forever */
        /* Loop forever */
.L2:    l.j     .L2
.L2:    l.j     .L2
        l.nop
        l.nop

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.