Skip to contentSkip to conversation

cpu_exit every time for a jump tb (containing only the "b" instruction)

Qemu-devel 阮安邦 1 participant 1 message Jul 6, 2009

lore
Share & tools
lore

阮安邦

author
#0 lore raw

Hi, list

I am currently profiling qemu-system-arm. I wrote a simple ARM
assembly only to add r0 infinitely:

* add_nums:
add r0, r0, r1
b add_nums*

I forced a tb to contain only one instruction, and I got cpu_exit
every time the tb for "*b add_nums"* was executed. It exited the cpu_exec loop every time, and then reentered it and executed it without cpu_exit.

Following are the executing sequences. I dumped the "in_asm" for a tb
every time it was executed. And wrapped the *tcg_qemu_tb_exec*() with qemu_log().

*IN:
0x8001000c: b 0x80010008

before tcg_qemu_tb_exec
cpu_exit
after tcg_qemu_tb_exec*

*IN:
0x8001000c: b 0x80010008

before tcg_qemu_tb_exec
after tcg_qemu_tb_exec

IN:
0x80010008: add r0, r0, r1

before tcg_qemu_tb_exec
after tcg_qemu_tb_exec

IN:
0x8001000c: b 0x80010008

before tcg_qemu_tb_exec
cpu_exit
after tcg_qemu_tb_exec

*
It seems like the cpu_exit was called when * tcg_qemu_tb_exec *was
executing. However, * tcg_qemu_tb_exec* is only to execute the translated native code (am i right?), how can it call the qemu func (cpu_exit)? Or it is called by other func executing simultaneously with * tcg_qemu_tb_exec*?*
* And why cpu_exit is called everytime, it really comsumes lots of ticks.~

Any suggestions? Great thanks!

Regards,
Ryan