2014-11-26 Matthew Fortune <Matthew.Fortune@imgtec.com>

* mips/crt0.S: Remove .set noreorder throughout.
        (zerobss): Open code the bltu macro instruction so that the
        zero-loop does not have a NOP in the branch delay slot.
This commit is contained in:
Jeff Johnston 2014-11-27 00:28:09 +00:00
parent 93d15b36ef
commit 84b2a020da
2 changed files with 24 additions and 35 deletions

View File

@ -1,3 +1,9 @@
2014-11-26 Matthew Fortune <Matthew.Fortune@imgtec.com>
* mips/crt0.S: Remove .set noreorder throughout.
(zerobss): Open code the bltu macro instruction so that the
zero-loop does not have a NOP in the branch delay slot.
2014-11-13 Nick Clifton <nickc@redhat.com> 2014-11-13 Nick Clifton <nickc@redhat.com>
* msp430/Makefile.in (CRT_OBJS): Add crt_high_bss.o. * msp430/Makefile.in (CRT_OBJS): Add crt_high_bss.o.

View File

@ -57,13 +57,14 @@
.globl _start .globl _start
.ent _start .ent _start
_start: _start:
.set noreorder
#ifdef __mips_embedded_pic #ifdef __mips_embedded_pic
#define PICBASE start_PICBASE #define PICBASE start_PICBASE
.set noreorder
PICBASE = .+8 PICBASE = .+8
bal PICBASE bal PICBASE
nop nop
move s0,$31 move s0,$31
.set reorder
#endif #endif
#if __mips<3 #if __mips<3
# define STATUS_MASK (SR_CU1|SR_PE) # define STATUS_MASK (SR_CU1|SR_PE)
@ -89,9 +90,7 @@ _start:
/* Avoid hazard from FPU enable and other SR changes. */ /* Avoid hazard from FPU enable and other SR changes. */
LA (t0, hardware_hazard_hook) LA (t0, hardware_hazard_hook)
beq t0,zero,1f beq t0,zero,1f
nop jalr t0
jal t0
nop
1: 1:
/* Check for FPU presence. Don't check if we know that soft_float is /* Check for FPU presence. Don't check if we know that soft_float is
@ -105,11 +104,8 @@ _start:
mfc1 t1,fp1 mfc1 t1,fp1
nop nop
bne t0,t2,1f /* check for match */ bne t0,t2,1f /* check for match */
nop
bne t1,zero,1f /* double check */ bne t1,zero,1f /* double check */
nop
j 2f /* FPU is present. */ j 2f /* FPU is present. */
nop
#endif #endif
1: 1:
/* FPU is not present. Set status register to say that. */ /* FPU is not present. Set status register to say that. */
@ -119,9 +115,7 @@ _start:
/* Avoid hazard from FPU disable. */ /* Avoid hazard from FPU disable. */
LA (t0, hardware_hazard_hook) LA (t0, hardware_hazard_hook)
beq t0,zero,2f beq t0,zero,2f
nop jalr t0
jal t0
nop
2: 2:
@ -129,7 +123,6 @@ _start:
doesn't get confused. */ doesn't get confused. */
LA (v0, 3f) LA (v0, 3f)
jr v0 jr v0
nop
3: 3:
LA (gp, _gp) # set the global data pointer LA (gp, _gp) # set the global data pointer
.end _start .end _start
@ -145,21 +138,20 @@ _start:
zerobss: zerobss:
LA (v0, _fbss) LA (v0, _fbss)
LA (v1, _end) LA (v1, _end)
3: beq v0,v1,2f
sw zero,0(v0) 1:
bltu v0,v1,3b addiu v0,v0,4
addiu v0,v0,4 # executed in delay slot sw zero,-4(v0)
bne v0,v1,1b
2:
la t0, __lstack # make a small stack so we la t0, __lstack # make a small stack so we
addiu sp, t0, STARTUP_STACK_SIZE # can run some C code addiu sp, t0, STARTUP_STACK_SIZE # can run some C code
la a0, __memsize # get the usable memory size la a0, __memsize # get the usable memory size
jal get_mem_info jal get_mem_info
nop
/* setup the stack pointer */ /* setup the stack pointer */
LA (t0, __stack) # is __stack set ? LA (t0, __stack) # is __stack set ?
bne t0,zero,4f bne t0,zero,4f
nop
/* NOTE: a0[0] contains the amount of memory available, and /* NOTE: a0[0] contains the amount of memory available, and
not the last memory address. */ not the last memory address. */
@ -189,19 +181,14 @@ zerobss:
init: init:
LA (t9, hardware_init_hook) # init the hardware if needed LA (t9, hardware_init_hook) # init the hardware if needed
beq t9,zero,6f beq t9,zero,6f
nop jalr t9
jal t9
nop
6: 6:
LA (t9, software_init_hook) # init the hardware if needed LA (t9, software_init_hook) # init the hardware if needed
beq t9,zero,7f beq t9,zero,7f
nop jalr t9
jal t9
nop
7: 7:
LA (a0, _fini) LA (a0, _fini)
jal atexit jal atexit
nop
#ifdef GCRT0 #ifdef GCRT0
.globl _ftext .globl _ftext
@ -209,12 +196,10 @@ init:
LA (a0, _ftext) LA (a0, _ftext)
LA (a1, _etext) LA (a1, _etext)
jal monstartup jal monstartup
nop
#endif #endif
jal _init # run global constructors jal _init # run global constructors
nop
addiu a1,sp,32 # argv = sp + 32 addiu a1,sp,32 # argv = sp + 32
addiu a2,sp,40 # envp = sp + 40 addiu a2,sp,40 # envp = sp + 40
@ -225,13 +210,13 @@ init:
sw zero,(a1) sw zero,(a1)
sw zero,(a2) sw zero,(a2)
#endif #endif
jal main # call the program start function
move a0,zero # set argc to 0 move a0,zero # set argc to 0
jal main # call the program start function
# fall through to the "exit" routine # fall through to the "exit" routine
move a0,v0 # pass through the exit code
jal exit # call libc exit to run the G++ jal exit # call libc exit to run the G++
# destructors # destructors
move a0,v0 # pass through the exit code
.end init .end init
@ -257,27 +242,25 @@ _exit:
/* Need to reinit PICBASE, since we might be called via exit() /* Need to reinit PICBASE, since we might be called via exit()
rather than via a return path which would restore old s0. */ rather than via a return path which would restore old s0. */
#define PICBASE exit_PICBASE #define PICBASE exit_PICBASE
.set noreorder
PICBASE = .+8 PICBASE = .+8
bal PICBASE bal PICBASE
nop nop
move s0,$31 move s0,$31
.set reorder
#endif #endif
#ifdef GCRT0 #ifdef GCRT0
LA (t0, _mcleanup) LA (t0, _mcleanup)
jal t0 jalr t0
nop
#endif #endif
LA (t0, hardware_exit_hook) LA (t0, hardware_exit_hook)
beq t0,zero,1f beq t0,zero,1f
nop jalr t0
jal t0
nop
1: 1:
# break instruction can cope with 0xfffff, but GAS limits the range: # break instruction can cope with 0xfffff, but GAS limits the range:
break 1023 break 1023
b 7b # but loop back just in-case b 7b # but loop back just in-case
nop
.end _exit .end _exit
/* Assume the PICBASE set up above is no longer valid below here. */ /* Assume the PICBASE set up above is no longer valid below here. */