在QEMU中,操作系统可以运行在软件仿真的CPU上。 那么如何通过软件来仿真CPU? 我想了解详细信息。
如果CPU被软件仿真,那么寄存器是否会被仿真到主机系统内存中?
假设有ARM汇编代码。
LDRB r0, [r1], #1
如何在x86环境中模拟这个过程?
我的猜测是,模拟软件会为r0
(4字节)和r1
(4字节)保留内存映射空间,然后更新对应内存位置的寄存器值... 我猜错了吗?
typedef struct CPUARMState {
/* Regs for current mode. */
uint32_t regs[16];
/* Frequently accessed CPSR bits are stored separately for efficiency.
This contains all the other bits. Use cpsr_{read,write} to access
the whole CPSR. */
uint32_t uncached_cpsr;
uint32_t spsr;