summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2008-05-10 18:30:46 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2008-05-10 18:30:46 +0000
commit0220a5fbc31f3443f2d165e395881d3bd213a698 (patch)
tree12d4eee2c7256ca1598991e2a6a777dfffc6c369
parent80278e45aa79cee66596c257c5d3870765233e00 (diff)
downloadrockbox-0220a5fbc31f3443f2d165e395881d3bd213a698.tar.gz
rockbox-0220a5fbc31f3443f2d165e395881d3bd213a698.zip
Fix the ARM assembly to ensure that the stack is not used.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17443 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/mmu-arm.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/firmware/target/arm/mmu-arm.c b/firmware/target/arm/mmu-arm.c
index c4b63cf805..7a5303d54d 100644
--- a/firmware/target/arm/mmu-arm.c
+++ b/firmware/target/arm/mmu-arm.c
@@ -33,7 +33,6 @@ void __attribute__((naked)) ttb_init(void) {
33} 33}
34 34
35void __attribute__((naked)) map_section(unsigned int pa, unsigned int va, int mb, int flags) { 35void __attribute__((naked)) map_section(unsigned int pa, unsigned int va, int mb, int flags) {
36#if 0 /* This code needs to be fixed and the C needs to be replaced to ensure that stack is not used */
37 asm volatile 36 asm volatile
38 ( 37 (
39 /* pa &= (-1 << 20); // align to 1MB */ 38 /* pa &= (-1 << 20); // align to 1MB */
@@ -78,11 +77,13 @@ void __attribute__((naked)) map_section(unsigned int pa, unsigned int va, int mb
78 */ 77 */
79 78
80 "cmp r2, #0 \n" 79 "cmp r2, #0 \n"
81 "bxle lr \n" 80 "bxle lr \n"
81 "mov r3, #0x0 \n"
82 "loop: \n" 82 "loop: \n"
83 "str r0, [r1], #4 \n" 83 "str r0, [r1], #4 \n"
84 "add r0, r0, #0x100000 \n" 84 "add r0, r0, #0x100000 \n"
85 "sub r2, r2, #0x01 \n" 85 "add r3, r3, #0x1 \n"
86 "cmp r2, r3 \n"
86 "bne loop \n" 87 "bne loop \n"
87 "bx lr \n" 88 "bx lr \n"
88 : 89 :
@@ -92,18 +93,6 @@ void __attribute__((naked)) map_section(unsigned int pa, unsigned int va, int mb
92 (void) va; 93 (void) va;
93 (void) mb; 94 (void) mb;
94 (void) flags; 95 (void) flags;
95#else
96 pa &= (-1 << 20);
97 pa |= (flags | 0x412);
98 unsigned int* ttbPtr = TTB_BASE + (va >> 20);
99
100#define MB (1 << 20)
101 for( ; mb>0; mb--, pa += MB)
102 {
103 *(ttbPtr++) = pa;
104 }
105#undef MB
106#endif
107} 96}
108 97
109void __attribute__((naked)) enable_mmu(void) { 98void __attribute__((naked)) enable_mmu(void) {