4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-06 14:30:38 +08:00

2014-03-21 Sabrini Ni <sabrinanitw@gmail.com>

* nds32/crt0.S: Tweak initialization sqeuence.
        * nds32/crt1.S: Ditto.
This commit is contained in:
Jeff Johnston 2014-03-21 21:16:40 +00:00
parent 7f6278bc08
commit c94fff60f1
3 changed files with 55 additions and 38 deletions

View File

@ -1,3 +1,8 @@
2014-03-21 Sabrini Ni <sabrinanitw@gmail.com>
* nds32/crt0.S: Tweak initialization sqeuence.
* nds32/crt1.S: Ditto.
2014-03-21 Sabrini Ni <sabrinanitw@gmail.com> 2014-03-21 Sabrini Ni <sabrinanitw@gmail.com>
* nds32/_argv.S: Replace syscall with break. * nds32/_argv.S: Replace syscall with break.

View File

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2013 Andes Technology Corporation. Copyright (c) 2013-2014 Andes Technology Corporation.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -47,29 +47,22 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
##------------------------------------------------------------------------------ ##------------------------------------------------------------------------------
.section .text .section .text
.weak _SDA_BASE_ .weak _SDA_BASE_
.weak _FP_BASE_
.global _start .global _start
.type _start, @function .type _start, @function
.align 2 .align 2
_start: _start:
.L_hw_config: /* The initialization sequence really does matter !!!
#if __NDS32_EX9_EXT__ The global pointer must be
/* Initialize the table base of EX9 instruction. */ initialized precedence over all others. */
mfsr $r0, $MSC_CFG /* Check if support EIT. */
srli $r0, $r0, 24
andi $r0, $r0, 0x1
beqz $r0, .L_fp_gp_init
la $r0, $_ITB_BASE_ /* Init ITB. */
mtusr $r0, $ITB
#endif
.L_fp_gp_init: .L_init_gp:
/* Initialization for $gp. The _SDA_BASE_ location /* Initialization for global pointer. The symbol _SDA_BASE_ is
stands for Small Data Access. */ determined by Linker. SDA stands for Small Data Access. */
la $gp, _SDA_BASE_ la $gp, _SDA_BASE_
.L_stack_init: .L_init_sp:
/* Initialization for $sp and make sure it is 8-byte aligned. */ /* Initialization for stack pointe. The symbol _stack is defined
in linker script. Make sure $sp is 8-byte aligned. */
la $sp, _stack la $sp, _stack
#if __NDS32_ISA_V3__ #if __NDS32_ISA_V3__
bitci $sp, $sp, #7 bitci $sp, $sp, #7
@ -78,8 +71,21 @@ _start:
and $sp, $sp, $r0 and $sp, $sp, $r0
#endif #endif
.L_bss_clear: #if __NDS32_EX9_EXT__
/* Clear bss section. .L_init_itb:
/* Initialization for Instruction Table Base (ITB).
The symbol $_ITB_BASE_ is determined by Linker.
Set $ITB only if MSC_CFG.EIT (cr4.b'24) is set. */
mfsr $r0, $MSC_CFG
srli $r0, $r0, 24
andi $r0, $r0, 0x1
beqz $r0, .L_zero_out_bss /* Fall through ? */
la $r0, $_ITB_BASE_
mtusr $r0, $ITB
#endif
.L_zero_out_bss:
/* Zero out the bss section.
Equivalence C code for follow part: Equivalence C code for follow part:
if (_end == _edata) goto .L_call_main if (_end == _edata) goto .L_call_main
unsinged int *ptr = _edata; unsinged int *ptr = _edata;

View File

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2013 Andes Technology Corporation. Copyright (c) 2013-2014 Andes Technology Corporation.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -47,29 +47,22 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
##------------------------------------------------------------------------------ ##------------------------------------------------------------------------------
.section .text .section .text
.weak _SDA_BASE_ .weak _SDA_BASE_
.weak _FP_BASE_
.global _start .global _start
.type _start, @function .type _start, @function
.align 2 .align 2
_start: _start:
.L_hw_config: /* The initialization sequence really does matter !!!
#if __NDS32_EX9_EXT__ The global pointer must be
/* Initialize the table base of EX9 instruction. */ initialized precedence over all others. */
mfsr $r0, $MSC_CFG /* Check if support EIT. */
srli $r0, $r0, 24
andi $r0, $r0, 0x1
beqz $r0, .L_fp_gp_init
la $r0, $_ITB_BASE_ /* Init ITB. */
mtusr $r0, $ITB
#endif
.L_fp_gp_init: .L_init_gp:
/* Initialization for $gp. The _SDA_BASE_ location /* Initialization for global pointer. The symbol _SDA_BASE_ is
stands for Small Data Access. */ determined by Linker. SDA stands for Small Data Access. */
la $gp, _SDA_BASE_ la $gp, _SDA_BASE_
.L_stack_init: .L_init_sp:
/* Initialization for $sp and make sure it is 8-byte aligned. */ /* Initialization for stack pointe. The symbol _stack is defined
in linker script. Make sure $sp is 8-byte aligned. */
la $sp, _stack la $sp, _stack
#if __NDS32_ISA_V3__ #if __NDS32_ISA_V3__
bitci $sp, $sp, #7 bitci $sp, $sp, #7
@ -78,8 +71,21 @@ _start:
and $sp, $sp, $r0 and $sp, $sp, $r0
#endif #endif
.L_bss_clear: #if __NDS32_EX9_EXT__
/* Clear bss section. .L_init_itb:
/* Initialization for Instruction Table Base (ITB).
The symbol $_ITB_BASE_ is determined by Linker.
Set $ITB only if MSC_CFG.EIT (cr4.b'24) is set. */
mfsr $r0, $MSC_CFG
srli $r0, $r0, 24
andi $r0, $r0, 0x1
beqz $r0, .L_zero_out_bss /* Fall through ? */
la $r0, $_ITB_BASE_
mtusr $r0, $ITB
#endif
.L_zero_out_bss:
/* Zero out the bss section.
Equivalence C code for follow part: Equivalence C code for follow part:
if (_end == _edata) goto .L_call_main if (_end == _edata) goto .L_call_main
unsinged int *ptr = _edata; unsinged int *ptr = _edata;