Closed hnj2 closed 4 years ago
Okay, found the error: the mmio region was already taken. Moved it to 0x3000000
And for some reason I couldn't figure out it still didn't work. But now with 0x03133700 as base address it works.
Please open a separate pull request for the openssl thing because it isn't specific to the test device implementation.
Please open a separate pull request for the openssl thing because it isn't specific to the test device implementation.
Sure.
Is the memory range 0x03133700 to 0x03133710 okay?
Here is a little test program that uses the device to echo stdin back to stdout and quits the emulator with exit code 137
if a q
is entered.
.section .text
. = 0x100
echo:
// read avail register
ldr r1, =avail_reg
ldr r1, [r1]
ldr r1, [r1]
cmp r1, #0
beq echo
// read byte
ldr r1, =read_reg
ldr r1, [r1]
ldr r0, [r1]
// print r0
ldr r1, =write_reg
ldr r1, [r1]
str r0, [r1]
// continue untill printed char was a 'q'
cmp r0, #'q'
bne echo
quit:
// should make the emulator quit with exit code 137 = (68 << 1) | 1
ldr r0, =#68
ldr r1, =quit_reg
ldr r1, [r1]
str r0, [r1]
avail_reg:
.word 0x03133700
read_reg:
.word 0x03133704
write_reg:
.word 0x03133708
quit_reg:
.word 0x0313370c
Merged, thanks!
This is a test device which adds access to stdio and an exit capability as a MMIO device to the emulator.