2015-08-05 03:57:37 +02:00
|
|
|
.section .text.start
|
|
|
|
.align 4
|
|
|
|
.global _start
|
|
|
|
_start:
|
2016-04-11 05:15:44 +02:00
|
|
|
b start
|
|
|
|
|
2016-05-03 01:17:22 +02:00
|
|
|
.word 0, 0
|
2016-04-11 05:15:44 +02:00
|
|
|
|
|
|
|
start:
|
2015-08-05 03:57:37 +02:00
|
|
|
@ Change the stack pointer
|
|
|
|
mov sp, #0x27000000
|
|
|
|
|
2016-07-01 20:27:28 +02:00
|
|
|
@ Disable caches / MPU
|
2016-06-05 20:43:49 +02:00
|
|
|
mrc p15, 0, r0, c1, c0, 0 @ read control register
|
|
|
|
bic r0, #(1<<12) @ - instruction cache disable
|
|
|
|
bic r0, #(1<<2) @ - data cache disable
|
|
|
|
bic r0, #(1<<0) @ - mpu disable
|
|
|
|
mcr p15, 0, r0, c1, c0, 0 @ write control register
|
2016-07-01 20:27:28 +02:00
|
|
|
|
|
|
|
@ Flush caches
|
|
|
|
bl flushEntireDCache
|
|
|
|
bl flushEntireICache
|
|
|
|
|
2016-02-25 20:19:20 +01:00
|
|
|
@ Give read/write access to all the memory regions
|
2016-07-01 20:27:28 +02:00
|
|
|
ldr r0, =0x3333333
|
2016-06-05 20:43:49 +02:00
|
|
|
mcr p15, 0, r0, c5, c0, 2 @ write data access
|
|
|
|
mcr p15, 0, r0, c5, c0, 3 @ write instruction access
|
2016-05-28 23:47:30 +02:00
|
|
|
|
2016-07-01 20:27:28 +02:00
|
|
|
@ Set MPU permissions and cache settings
|
2016-07-02 10:59:21 +02:00
|
|
|
ldr r0, =0xFFFF001D @ ffff0000 32k | bootrom (unprotected part)
|
|
|
|
ldr r1, =0x01FF801D @ 01ff8000 32k | itcm
|
|
|
|
ldr r2, =0x08000029 @ 08000000 2M | arm9 mem (O3DS / N3DS)
|
|
|
|
ldr r3, =0x10000029 @ 10000000 2M | io mem (ARM9 / first 2MB)
|
|
|
|
ldr r4, =0x20000037 @ 20000000 256M | fcram (O3DS / N3DS)
|
|
|
|
ldr r5, =0x1FF00027 @ 1FF00000 1M | dsp / axi wram
|
|
|
|
ldr r6, =0x1800002D @ 18000000 8M | vram (+ 2MB)
|
2016-07-01 20:27:28 +02:00
|
|
|
mov r7, #0
|
|
|
|
mov r8, #0x15
|
2016-02-25 20:19:20 +01:00
|
|
|
mcr p15, 0, r0, c6, c0, 0
|
|
|
|
mcr p15, 0, r1, c6, c1, 0
|
|
|
|
mcr p15, 0, r2, c6, c2, 0
|
|
|
|
mcr p15, 0, r3, c6, c3, 0
|
|
|
|
mcr p15, 0, r4, c6, c4, 0
|
|
|
|
mcr p15, 0, r5, c6, c5, 0
|
|
|
|
mcr p15, 0, r6, c6, c6, 0
|
|
|
|
mcr p15, 0, r7, c6, c7, 0
|
2016-07-02 10:59:21 +02:00
|
|
|
mcr p15, 0, r8, c3, c0, 0 @ Write bufferable 0, 2, 4
|
|
|
|
mcr p15, 0, r8, c2, c0, 0 @ Data cacheable 0, 2, 4
|
|
|
|
mcr p15, 0, r8, c2, c0, 1 @ Inst cacheable 0, 2, 4
|
2016-02-25 20:19:20 +01:00
|
|
|
|
2016-07-01 20:27:28 +02:00
|
|
|
@ Enable caches / MPU
|
2016-06-05 20:43:49 +02:00
|
|
|
mrc p15, 0, r0, c1, c0, 0 @ read control register
|
|
|
|
orr r0, r0, #(1<<12) @ - instruction cache enable
|
|
|
|
orr r0, r0, #(1<<2) @ - data cache enable
|
|
|
|
orr r0, r0, #(1<<0) @ - mpu enable
|
|
|
|
mcr p15, 0, r0, c1, c0, 0 @ write control register
|
2015-08-05 03:57:37 +02:00
|
|
|
|
2016-07-01 20:27:28 +02:00
|
|
|
@ Fix mounting of SDMC
|
2016-03-08 15:13:55 +01:00
|
|
|
ldr r0, =0x10000020
|
|
|
|
mov r1, #0x340
|
|
|
|
str r1, [r0]
|
2015-08-05 03:57:37 +02:00
|
|
|
|
2016-04-02 17:58:06 +02:00
|
|
|
b main
|