1
0
Fork 0
forked from len0rd/rockbox

PortalPlayer: Loading of stack munge value into r4 was moved in r30741 to after the idle stack init loop, breaking the usage readout.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31068 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2011-11-27 07:01:47 +00:00
parent a99d9eca0b
commit 47452dcd5c

View file

@ -26,7 +26,7 @@
.global start .global start
start: start:
/* PortalPlayer bootloader and startup code based on startup.s from the iPodLinux /* PortalPlayer bootloader and startup code based on startup.s from the iPodLinux
* loader * loader
* *
* Copyright (c) 2003, Daniel Palffy (dpalffy (at) rainstorm.org) * Copyright (c) 2003, Daniel Palffy (dpalffy (at) rainstorm.org)
@ -65,7 +65,7 @@ start:
.equ SLEEP, 0x80000000 .equ SLEEP, 0x80000000
.equ WAKE, 0x00000000 .equ WAKE, 0x00000000
.equ CPUSLEEPING, 0x80000000 .equ CPUSLEEPING, 0x80000000
.equ COPSLEEPING, 0x80000000 .equ COPSLEEPING, 0x80000000
.equ CACHE_CTRL, 0x6000c000 .equ CACHE_CTRL, 0x6000c000
.equ MMAP_LOG, 0xf000f000 /* MMAP0 */ .equ MMAP_LOG, 0xf000f000 /* MMAP0 */
.equ MMAP_PHYS, 0xf000f004 .equ MMAP_PHYS, 0xf000f004
@ -90,7 +90,7 @@ start:
pad_skip: pad_skip:
/* Find out which processor we are - r0 should be preserved for the /* Find out which processor we are - r0 should be preserved for the
* duration of the init to avoid constant reloading of the processor ID. * duration of the init to avoid constant reloading of the processor ID.
* For each stage, CPU proceeds first, then COP. * For each stage, CPU proceeds first, then COP.
*/ */
ldr r0, =PROC_ID ldr r0, =PROC_ID
ldrb r0, [r0] ldrb r0, [r0]
@ -109,10 +109,10 @@ pad_skip:
and wait for the COP to finish. This ensures no threading activity and wait for the COP to finish. This ensures no threading activity
starts until it is safe. */ starts until it is safe. */
cmp r0, #0x55 cmp r0, #0x55
/* mask all interrupt sources before setting anything up */ /* mask all interrupt sources before setting anything up */
ldreq r2, =CPU_ICLR ldreq r2, =CPU_ICLR
ldrne r2, =COP_ICLR ldrne r2, =COP_ICLR
mvn r1, #0 mvn r1, #0
str r1, [r2] str r1, [r2]
@ -175,7 +175,7 @@ pad_skip:
ldr r3, =MMAP_PHYS ldr r3, =MMAP_PHYS
ldr r2, =MMAP_MASK /* ldr is more flexible */ ldr r2, =MMAP_MASK /* ldr is more flexible */
ldr r1, =MMAP_LOG ldr r1, =MMAP_LOG
mov pc, #0x40000000 mov pc, #0x40000000
remap_start: remap_start:
str r2, [r1] str r2, [r1]
@ -207,7 +207,7 @@ cpu_init:
ldr r3, [r4] ldr r3, [r4]
tst r3, #COPSLEEPING tst r3, #COPSLEEPING
beq 1b beq 1b
/* Vectors and IRAM copy is done first since they are reclaimed for /* Vectors and IRAM copy is done first since they are reclaimed for
* other uninitialized sections */ * other uninitialized sections */
@ -220,7 +220,7 @@ cpu_init:
ldrhi r5, [r4], #4 ldrhi r5, [r4], #4
strhi r5, [r2], #4 strhi r5, [r2], #4
bhi 1b bhi 1b
/* Copy the IRAM */ /* Copy the IRAM */
ldr r2, =_iramcopy ldr r2, =_iramcopy
ldr r3, =_iramstart ldr r3, =_iramstart
@ -262,6 +262,9 @@ cpu_init:
strhi r4, [r2], #4 strhi r4, [r2], #4
bhi 1b bhi 1b
/* Load stack munge value */
ldr r4, =0xdeadbeef
#if NUM_CORES > 1 #if NUM_CORES > 1
/* Set up idle stack and munge it with 0xdeadbeef */ /* Set up idle stack and munge it with 0xdeadbeef */
ldr r2, =cpu_idlestackbegin ldr r2, =cpu_idlestackbegin
@ -272,10 +275,10 @@ cpu_init:
bhi 1b bhi 1b
#endif #endif
/* Set up stack for IRQ mode */ /* Set up stack for IRQ mode */
msr cpsr_c, #0x92 /* IRQ disabled, FIQ enabled */ msr cpsr_c, #0x92 /* IRQ disabled, FIQ enabled */
ldr sp, =irq_stack ldr sp, =irq_stack
/* Set up stack for FIQ mode */ /* Set up stack for FIQ mode */
msr cpsr_c, #0xd1 /* IRQ/FIQ disabled */ msr cpsr_c, #0xd1 /* IRQ/FIQ disabled */
ldr sp, =fiq_stack ldr sp, =fiq_stack
@ -290,9 +293,6 @@ cpu_init:
/* Switch to sys mode */ /* Switch to sys mode */
msr cpsr_c, #0xdf msr cpsr_c, #0xdf
/* Load stack munge value */
ldr r4, =0xdeadbeef
/* Set up some stack and munge it with 0xdeadbeef */ /* Set up some stack and munge it with 0xdeadbeef */
ldr r2, =stackbegin ldr r2, =stackbegin
ldr sp, =stackend ldr sp, =stackend
@ -349,7 +349,7 @@ cop_init:
cmp sp, r2 cmp sp, r2
strhi r4, [r2], #4 strhi r4, [r2], #4
bhi 2b bhi 2b
/* Run cop_main() in apps/main.c */ /* Run cop_main() in apps/main.c */
ldr pc, =cop_main ldr pc, =cop_main
@ -367,7 +367,7 @@ cop_init:
/* Exception vectors */ /* Exception vectors */
.global vectors .global vectors
vectors: vectors:
.word start .word start
.word undef_instr_handler .word undef_instr_handler
.word software_int_handler .word software_int_handler
.word prefetch_abort_handler .word prefetch_abort_handler
@ -403,13 +403,13 @@ prefetch_abort_handler:
b UIE b UIE
data_abort_handler: data_abort_handler:
sub r0, lr, #8 sub r0, lr, #8
mov r1, #2 mov r1, #2
b UIE b UIE
/* Align stacks to cache line boundary */ /* Align stacks to cache line boundary */
.balign 32 .balign 32
/* 256 words of IRQ stack */ /* 256 words of IRQ stack */
.space 256*4 .space 256*4
irq_stack: irq_stack: