Thanks to dom http://www.raspberrypi.org/forums/viewt ... 74#p697474 I managed to boot in several modes (set kernel_old=1 in config.txt, link his code at 0x0 and your kernel at 0x8000), but a really weird situation is happening.
In his boot code http://pastebin.com/rgGgBuTN, here is what happens:
- We start at 0x0 in svc / secure mode.
- After a few instructions, we jump into monitor secure mode with
Code: Select all
smc #0
Code: Select all
movs pc, lr
Ultimately, I want to jump to my kernel code at 0x8000 (line 116) in svc / secure mode, but keeping SCR.NS to 0 in the _secure_monitor makes the board hangs.
Code: Select all
bic r1, r1, #0x4e @ clear IRQ, FIQ, EA, nET bits
orr r1, r1, #0x30 @ enable AW, FW bits <<< 0x30 instead of 0x31 so that NS is still 0
orr r1, r1, #0x100 @ allow HVC instruction
mcr p15, 0, r1, c1, c1, 0 @ write SCR (without NS bit set)
Code: Select all
bic r1, r1, #0x4e @ clear IRQ, FIQ, EA, nET bits
orr r1, r1, #0x30 @ enable AW, FW bits <<< 0x30 instead of 0x31 so that NS is still 0
orr r1, r1, #0x100 @ allow HVC instruction
mcr p15, 0, r1, c1, c1, 0 @ write SCR (without NS bit set)
orr r1, r1, #0x1
mcr p15, 0, r1, c1, c1, 0 @ write SCR (with NS bit set)
The really disturbing thing is that I can switch SCR.NS from 0 to 1 without any trouble as soon as I jumped at 0x8000. I really don't understand why I can't change it back and forth before the jump at line 116.