On 15 May 2018 at 22:09, Arnabjyoti Kalita <akal...@cs.stonybrook.edu> wrote: > I was trying to understand what the function tcg_qemu_tb_exec() returns. I > can understand that the last two bits of the return value contain the exit > status of the translation block that just got executed. However I cannot > understand what the remaining bits in the value point to. I find it hard to > understand what it returns from the source code. > > Basically, I am finding it hard to determine if this function returns the > current TB that was executed or that it returns the next TB that is to be > executed.
That depends on the value in the bottom two bits. If the bottom two bits are 2 or 3, then the pointer part is the TB we were about to execute but abandoned execution of. If the bottom two bits are 0 or 1, then the return value is whatever we passed to tcg_gen_exit_tb() when we were generating the code for the exit path for the TB we just executed. The pointer part will either be 0, or the address of that just-executed TB. (We use this to try to link the just-executed TB to the next one, so 0 means "don't try to link".) thanks -- PMM