I'm trying to read (hopefully write as well) to the memory mapped hardware registers in a qemu virtual machine using gdb (remote connected). But it's just not working:
(gdb) p *0x2000000
Cannot access memory at address 0x20000000
But if I log in to the machine and do
# devmem 0x2000000
0xE321F0D3
This works fine. Clearly gdb isn't getting its info from /dev/mem though. I've enabled all compile-time debug flags that I could think of, I can place breakpoints, step through code and dereference pointers associated with a symbol just fine. But most raw pointer dereferences fail.
For the record this is how I launched qemu:
qemu-system-arm -M versatilepb -kernel output/images/zImage \
-dtb output/images/versatile-pb.dtb \
-drive file=output/images/rootfs.ext2,if=scsi \
-append "root=/dev/sda console=ttyAMA0,115200 nokaslr norandmaps printk.devkmsg=on printk.time=y" \
-nographic -s
where I added nokaslr etc because I thought it would make a difference. It clearly did not. Anyone know what's going on here?