Skip to content

Commit 1cbfa48

Browse files
committed
ESR is 0
1 parent 99bb0f2 commit 1cbfa48

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,26 @@ arm64_mmu_init():
512512
enable_mmu_el1(flags);
513513
```
514514

515-
TODO: Dump the Exception Registers
515+
TODO: Dump the Exception Registers ESR, FAR, ELR for EL1 [(Because of this)](https://github.com/apache/nuttx/blob/master/arch/arm64/src/common/arm64_fatal.c#L381-L390)
516+
517+
Set a breakpoint at `arm64_reg_read()` in...
518+
519+
```text
520+
.cargo/registry/src/github.com-1ecc6299db9ec823/unicorn-engine-2.0.1/qemu/target/arm/unicorn_aarch64.c
521+
```
522+
523+
Exception shows...
524+
525+
```text
526+
env.exception = {
527+
syndrome: 0x8600 003f,
528+
fsr: 5,
529+
vaddress: 0x400c 3fff,
530+
target_el: 1
531+
}
532+
```
533+
534+
`arm64_reg_read()` calls `reg_read()` in unicorn_aarch64.c
516535

517536
TODO: Trace the exception in the debugger. Set a breakpoint at `cpu_aarch64_init()` in...
518537

@@ -549,3 +568,5 @@ TODO: Emulate Interrupts
549568
TODO: Emulate Multiple CPUs
550569

551570
TODO: Emulate Memory Protection
571+
572+
TODO: Emulate GIC v2

src/main.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,11 @@ fn main() {
8484
0 // Previously: 1000
8585
);
8686
println!("err={:?}", err);
87-
88-
// Read register X15
89-
assert_eq!(
90-
emu.reg_read(RegisterARM64::X15),
91-
Ok(0x78)
92-
);
87+
println!("CP_REG={:?}", emu.reg_read(RegisterARM64::CP_REG));
88+
println!("ESR_EL0={:?}", emu.reg_read(RegisterARM64::ESR_EL0));
89+
println!("ESR_EL1={:?}", emu.reg_read(RegisterARM64::ESR_EL1));
90+
println!("ESR_EL2={:?}", emu.reg_read(RegisterARM64::ESR_EL2));
91+
println!("ESR_EL3={:?}", emu.reg_read(RegisterARM64::ESR_EL3));
9392
}
9493

9594
// Hook Function for Memory Access.

0 commit comments

Comments
 (0)