From bf056d5372b6375b088836dd57339d7a499fe0d6 Mon Sep 17 00:00:00 2001 From: Marcin Bukat Date: Tue, 11 Oct 2011 16:06:03 +0000 Subject: Switch to SYS mode on arm FS#12322 by me git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30741 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/rk27xx/crt0.S | 41 ++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'firmware/target/arm/rk27xx/crt0.S') diff --git a/firmware/target/arm/rk27xx/crt0.S b/firmware/target/arm/rk27xx/crt0.S index 4ddae01c53..23f3fcf2c9 100644 --- a/firmware/target/arm/rk27xx/crt0.S +++ b/firmware/target/arm/rk27xx/crt0.S @@ -156,15 +156,6 @@ newstart2: bhi 1b #endif - /* Set up some stack and munge it with 0xdeadbeef */ - ldr sp, =stackend - ldr r2, =stackbegin - ldr r3, =0xdeadbeef -1: - cmp sp, r2 - strhi r3, [r2], #4 - bhi 1b - /* Set up stack for IRQ mode */ msr cpsr_c, #0xd2 ldr sp, =_irqstackend @@ -173,14 +164,26 @@ newstart2: msr cpsr_c, #0xd1 ldr sp, =_fiqstackend - /* Let abort and undefined modes use IRQ stack */ + /* Let svc, abort and undefined modes use irq stack */ + msr cpsr_c, #0xd3 + ldr sp, =_irqstackend msr cpsr_c, #0xd7 ldr sp, =_irqstackend msr cpsr_c, #0xdb ldr sp, =_irqstackend - /* Switch back to supervisor mode */ - msr cpsr_c, #0xd3 + /* Switch to sys mode */ + msr cpsr_c, #0xdf + + /* Set up some stack and munge it with 0xdeadbeef */ + ldr sp, =stackend + ldr r2, =stackbegin + ldr r3, =0xdeadbeef +1: + cmp sp, r2 + strhi r3, [r2], #4 + bhi 1b + bl main @@ -196,12 +199,6 @@ undef_instr_handler: mov r1, #0 b UIE -/* We run supervisor mode most of the time, and should never see a software - * exception being thrown. Perhaps make it illegal and call UIE? */ -software_int_handler: -reserved_handler: - movs pc, lr - prefetch_abort_handler: sub r0, lr, #4 mov r1, #1 @@ -211,3 +208,11 @@ data_abort_handler: sub r0, lr, #8 mov r1, #2 b UIE + +/* We run sys mode most of the time, and should never see a software + * exception being thrown. Make it illegal and call UIE */ +software_int_handler: +reserved_handler: + sub r0, lr, #4 + mov r1, #5 + b UIE -- cgit v1.2.3