I’m working with Qemu source study, but now I have some difficulty in these 
assembly instructions at the beginning of cpu_exec function. My question as 
follows:

 

After entering function cpu_exec, there are some assembly codes:

 

register host_reg_t reg_AREG0 asm("ebp"); 

volatile host_reg_t saved_AREG0;

       

register host_reg_t reg_AREG1 asm("ebx"); 

volatile host_reg_t saved_AREG1;

       

register host_reg_t reg_AREG2 asm("esi"); 

volatile host_reg_t saved_AREG2;

       

register host_reg_t reg_AREG3 asm("edi");

volatile host_reg_t saved_AREG3;

 

and there is also:

__asm__ __volatile__ ("" : "=r" (reg_AREG0)); 

saved_AREG0 = reg_AREG0;

              

__asm__ __volatile__ ("" : "=r" (reg_AREG1)); 

saved_AREG1 = reg_AREG1;

              

__asm__ __volatile__ ("" : "=r" (reg_AREG2)); 

saved_AREG2 = reg_AREG2;

              

__asm__ __volatile__ ("" : "=r" (reg_AREG3));

saved_AREG3 = reg_AREG3;

 

Where are variables: reg_AREG-, saved_AREG- defined and how they are used in 
the later codes? I really understand these assembly codes’ functionality. Do 
they use for Qemu virtual register mapping or translating optimization? Could 
anyone give me some advise, thank. Thank you very much for your help.

Reply via email to