principle of QEMU CPU emulation

后端 未结 1 418
無奈伤痛
無奈伤痛 2021-02-08 12:54

In QEMU, an operating system can run above software emulated CPU. How can be a CPU emulated by software? I want to know about detail.

If CPU is

1条回答
  •  别那么骄傲
    2021-02-08 13:15

    Please see this file for the C-level modelling of the state of an ARM CPU as done by QEMU.

    It's pretty straight-forward, and (of course) as you suspect the registers (and all other state) are modelled as C variables.

    The core structure begins:

    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;
    

    0 讨论(0)
提交回复
热议问题