On 31 July 2015 at 10:29, Naman patel <naman...@gmail.com> wrote: > Can someone explain me what happens when a guest OS calls "invlpg" on say > page swap out or a context switch? What exactly is the call flow and how > QEMU handles this instruction?
When we see the instruction during translation, we emit code which will * get the argument to invlpg (extracting it from the relevant register, adding any constant offset required for the addressing mode, etc) * make a call to helper_inlvpg(). (target-i386/translate.c has the C code that does this codegen -- search for invlpg) Later when that generated code is run, we call the helper, which does what it needs to do (in this case flush a page from QEMU's TLB cache). When the call returns we'll carry on executing whatever guest instruction comes next. > Also is there anyway QEMU can send some data > back to the guest OS? INVLPG is just an x86 instruction that performs an operation; it doesn't modify any registers or flags. So there's no way for it to tell the guest OS anything. -- PMM