mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-23 15:07:38 -04:00
SH1: More compact init code, only doing the special vector copy for debug builds. All: Added correct section flags for .init.text
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7640 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
09b4743707
commit
b4f0afd429
1 changed files with 33 additions and 39 deletions
|
@ -19,7 +19,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
|
||||||
.section .init.text
|
.section .init.text,"ax",@progbits
|
||||||
.global start
|
.global start
|
||||||
start:
|
start:
|
||||||
#if CONFIG_CPU == TCC730
|
#if CONFIG_CPU == TCC730
|
||||||
|
@ -319,15 +319,13 @@ vectors:
|
||||||
|
|
||||||
/* Fill in code here */
|
/* Fill in code here */
|
||||||
#else
|
#else
|
||||||
/* Platform: Archos Jukebox
|
/* Platform: Archos Jukebox */
|
||||||
* We begin with some tricks. If we have built our code to be loaded
|
|
||||||
* via the standalone GDB stub, we will have out VBR at some other
|
|
||||||
* location than 0x9000000. We must copy the trap vectors for the
|
|
||||||
* GDB stub to our vector table.
|
|
||||||
* If, on the other hand, we are running standalone we will have
|
|
||||||
* the VBR at 0x9000000, and the copy will not do any harm.
|
|
||||||
*/
|
|
||||||
mov.l vbr_k,r1
|
mov.l vbr_k,r1
|
||||||
|
#ifdef DEBUG
|
||||||
|
/* If we have built our code to be loaded via the standalone GDB
|
||||||
|
* stub, we will have out VBR at some other location than 0x9000000.
|
||||||
|
* We must copy the trap vectors for the GDB stub to our vector table. */
|
||||||
mov.l orig_vbr_k,r2
|
mov.l orig_vbr_k,r2
|
||||||
|
|
||||||
/* Move the invalid instruction vector (4) */
|
/* Move the invalid instruction vector (4) */
|
||||||
|
@ -389,35 +387,31 @@ vectors:
|
||||||
shll2 r0
|
shll2 r0
|
||||||
mov.l @(r0,r2),r3
|
mov.l @(r0,r2),r3
|
||||||
mov.l r3,@(r0,r1)
|
mov.l r3,@(r0,r1)
|
||||||
|
#endif /* DEBUG */
|
||||||
ldc r1,vbr
|
ldc r1,vbr
|
||||||
|
|
||||||
/* Now let's get on with the normal business */
|
/* Now let's get on with the normal business */
|
||||||
mov.l stack_k,r15
|
mov.l stackend_k,r15
|
||||||
|
|
||||||
/* zero out bss */
|
/* zero out bss */
|
||||||
mov.l edata_k,r0
|
mov.l edata_k,r0
|
||||||
mov.l end_k,r1
|
mov.l end_k,r1
|
||||||
mov #0,r2
|
mov #0,r2
|
||||||
start_l:
|
edata_l: /* backwards is faster and shorter */
|
||||||
mov.l r2,@r0
|
mov.l r2,@-r1
|
||||||
add #4,r0
|
cmp/hi r0,r1
|
||||||
cmp/ge r1,r0
|
bt edata_l
|
||||||
bf start_l
|
|
||||||
nop
|
|
||||||
|
|
||||||
/* copy the .iram section */
|
/* copy the .iram section */
|
||||||
mov.l iramcopy_k,r0
|
mov.l iramcopy_k,r0
|
||||||
mov.l iram_k,r1
|
mov.l iram_k,r1
|
||||||
mov.l iramend_k,r2
|
mov.l iramend_k,r2
|
||||||
copy_l:
|
iramcopy_l:
|
||||||
mov.l @r0,r3
|
mov.l @r0+,r3
|
||||||
mov.l r3,@r1
|
mov.l r3,@r1
|
||||||
add #4,r0
|
|
||||||
add #4,r1
|
add #4,r1
|
||||||
cmp/ge r2,r1
|
cmp/hi r1,r2
|
||||||
bf copy_l
|
bt iramcopy_l
|
||||||
nop
|
|
||||||
|
|
||||||
/* copy the .data section, for rombased execution */
|
/* copy the .data section, for rombased execution */
|
||||||
mov.l datacopy_k,r0
|
mov.l datacopy_k,r0
|
||||||
|
@ -426,25 +420,22 @@ copy_l:
|
||||||
/* Don't copy if src and dest are equal */
|
/* Don't copy if src and dest are equal */
|
||||||
cmp/eq r0,r1
|
cmp/eq r0,r1
|
||||||
bt nodatacopy
|
bt nodatacopy
|
||||||
copy_l2:
|
data_l:
|
||||||
mov.l @r0,r3
|
mov.l @r0+,r3
|
||||||
mov.l r3,@r1
|
mov.l r3,@r1
|
||||||
add #4,r0
|
|
||||||
add #4,r1
|
add #4,r1
|
||||||
cmp/ge r2,r1
|
cmp/hi r1,r2
|
||||||
bf copy_l2
|
bt data_l
|
||||||
nop
|
|
||||||
nodatacopy:
|
nodatacopy:
|
||||||
|
|
||||||
/* Munge the main thread stack */
|
/* Munge the main thread stack */
|
||||||
mov.l stack_k,r2
|
mov.l stackbegin_k,r0
|
||||||
mov.l deadbeef_k,r0
|
mov.l stackend_k,r1
|
||||||
mov.l stackbegin_k,r1
|
mov.l deadbeef_k,r2
|
||||||
munge_loop:
|
munge_l: /* backwards is faster and shorter */
|
||||||
mov.l r0,@r1
|
mov.l r2,@-r1
|
||||||
add #4,r1
|
cmp/hi r0,r1
|
||||||
cmp/ge r2,r1
|
bt munge_l
|
||||||
bf munge_loop
|
|
||||||
nop
|
|
||||||
|
|
||||||
mov #0,r0
|
mov #0,r0
|
||||||
ldc r0,gbr
|
ldc r0,gbr
|
||||||
|
@ -455,9 +446,10 @@ munge_loop:
|
||||||
nop
|
nop
|
||||||
.hoo:
|
.hoo:
|
||||||
bra .hoo
|
bra .hoo
|
||||||
|
nop
|
||||||
|
|
||||||
.align 2
|
.align 2
|
||||||
stack_k:
|
stackend_k:
|
||||||
.long _stackend
|
.long _stackend
|
||||||
stackbegin_k:
|
stackbegin_k:
|
||||||
.long _stackbegin
|
.long _stackbegin
|
||||||
|
@ -483,8 +475,10 @@ main_k:
|
||||||
.long _main
|
.long _main
|
||||||
vbr_k:
|
vbr_k:
|
||||||
.long vectors
|
.long vectors
|
||||||
|
#ifdef DEBUG
|
||||||
orig_vbr_k:
|
orig_vbr_k:
|
||||||
.long 0x9000000
|
.long 0x9000000
|
||||||
|
#endif
|
||||||
|
|
||||||
.section .resetvectors
|
.section .resetvectors
|
||||||
vectors:
|
vectors:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue