diff options
author | Christoffer Dall <cdall@cs.columbia.edu> | 2011-05-01 17:34:31 +0200 |
---|---|---|
committer | Christoffer Dall <cdall@cs.columbia.edu> | 2011-05-01 17:34:31 +0200 |
commit | dd754be958f3da4908ad0e89d1a6b863024964bf (patch) | |
tree | 946354ea97d4c5294741722a0559ea4b39ed0a0a | |
parent | caf2b243c4e2dad98a375d455764d9859e6bee5e (diff) |
Add functionality to initialize the Hyp_SP and HVBAR
These registers must also be initialized by a hypervisor for it to run code in
HYP mode.
-rw-r--r-- | monitor.S | 31 |
1 files changed, 28 insertions, 3 deletions
@@ -32,7 +32,7 @@ cmp r12, #0xfffffff0 movnes pc, lr and r12, r7, #0xf - cmp r12, #0x9 + cmp r12, #0xd movgts pc, lr @ Check the VMID is 0 @@ -62,14 +62,19 @@ _hyp_funcs: .long _write_hmair1 .long _read_hsctlr .long _write_hsctlr + .long _read_hypsp + .long _write_hypsp + .long _read_hvbar + .long _write_hvbar @ @ Switch to non-secure mode @ _non_sec: mrc p15, 0, r0, c1, c1, 0 @ Secure configuration register - bic r0, r0, #0x7f - orr r0, r0, #0x31 + bic r0, r0, #0x07f + ldr r13, =0x131 + orr r0, r0, r13 mcr p15, 0, r0, c1, c1, 0 movs pc, lr @@ -118,3 +123,23 @@ _read_hsctlr: _write_hsctlr: mcr p15, 4, r0, c1, c0, 0 movs pc, lr + + @ + @ Read/Write hyp sp + @ +_read_hypsp: + mov r0, sp + movs pc, lr +_write_hypsp: + mov sp, r0 + movs pc, lr + + @ + @ Read/Write HVBAR + @ +_read_hvbar: + mrc p15, 4, r0, c12, c0, 0 + movs pc, lr +_write_hvbar: + mcr p15, 4, r0, c12, c0, 0 + movs pc, lr |