[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-discuss] Some questions about memory access------target_mmap()&how
[Qemu-discuss] Some questions about memory access------target_mmap()&how can write one byte into memory
Thu, 20 Dec 2012 23:54:22 +0800
If I already have an emulator, all instructions have been carried out. In order to reuse these codes on the other simulation platforms, as Simics, QEMU, SystemC. So, I want to
skip over QEMU's TCG(guest binary-->IR-->host binary). Just let QEMU controll the cpu's execution and the cpu access QEMU's memory system. Just Load-elf, fetch and load/store operations need to access memory. QEMU uses target_mmap() to allocate the memory and map the ELF into the memory. But my ELF is very special:
type offset vaddr filesize
PT_LOAD 0x0002f4 0x88000000 0x0016a
PT_LOAD 0x00045e 0x88000180 0x00006
PT_LOAD 0x000468 0x88000200 0x00006
ps = 0x88000000 & ~(unsigned long)((1 << 12)-1)) = 0x88000000
po = 0x88000000 & ((1 << 12)-1) = 0 offset - po is not zero, so the offset is not multiple of the page size, program error. How can this ELF map into the virtual page?
After allocating and loading the elf, target-arm uses ldl_code() to fetch the instruction from the corresponding memory address. My instruction is very long, it has 128 bytes.
How can QEMU write one byte into the memory? I have tried the stub_raw(), but it has the error message: segmentation fault.Are there other methods that allocate the memory space and writes (or read) one bytes into the memory. Thank you!
|[Prev in Thread]
||[Next in Thread]|
- [Qemu-discuss] Some questions about memory access------target_mmap()&how can write one byte into memory,
qi Lee <=