diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-12-18 18:31:03 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-12-18 18:31:03 -0600 |
| commit | e290956adf94dade4c9c4cd057cca08af1c61aeb (patch) | |
| tree | df310fe32102781b48d20d66b5c51cfdb2ad7901 /tb/sim/modeswitch.S | |
| parent | 46eae9622ab6f1a39c6253dc0998e03c57513510 (diff) | |
Implement privileged ldm/stm of user registers
Diffstat (limited to 'tb/sim/modeswitch.S')
| -rw-r--r-- | tb/sim/modeswitch.S | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/tb/sim/modeswitch.S b/tb/sim/modeswitch.S index 384eb65..b798700 100644 --- a/tb/sim/modeswitch.S +++ b/tb/sim/modeswitch.S @@ -1,23 +1,30 @@ .global reset reset: - mov r6, lr - msr cpsr_c, #0xd3 - mrs r0, cpsr + ldr r0, =0xfee1dead + push {sp-lr} + push {r0} + @ NOTE: Esto genera una warning de gas debido a UNPREDICTABLE + @ writeback of base register, podría ser un bug del ensamblador, + @ pero también podría ser la interpretación correcta del manual + ldmia sp!, {ip-lr}^ + mov r6, lr + msr cpsr_c, #0xd3 + mrs r0, cpsr udf - mrs r2, cpsr - ldr r3, =#0x16f - bic r3, r2, r3 - msr cpsr_fxc, r3 - mrs r4, cpsr - cmp r0, r0 - mrs r5, spsr + mrs r2, cpsr + ldr r3, =#0x16f + bic r3, r2, r3 + msr cpsr_fxc, r3 + mrs r4, cpsr + cmp r0, r0 + mrs r5, spsr nop - msr cpsr_fxc, r0 - msr spsr_fxc, r0 - mov pc, r6 + msr cpsr_fxc, r0 + msr spsr_fxc, r0 + mov pc, lr .global undefined undefined: - mrs r1, spsr - mrs r13, cpsr - movs pc, lr + mrs r1, spsr + mrs r13, cpsr + movs pc, lr |
