Skip to contentSkip to conversation

Hvm_emulate_one() and guest_cpu_user_regs()->eip

DISCUSSION Razvan Cojocaru 2 participants 3 messages Oct 17, 2013

lore
Share & tools
lore
#0 lore raw

Hello,

I've noticed that an hvm_emulate_one() call (that uses guest_cpu_user_regs() for it's context) will succeed _without_ modifying guest_cpu_user_regs()->eip. Again, this is not only happening when hvm_emulate_one() returns X86EMUL_RETRY (which I'd expect), but also, in some cases, when it returns no error.

Why would that happen, and what might be an example of an instruction that could cause that if that's normal behaviour?

Thanks,
Razvan Cojocaru

#1 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Razvan Cojocaru

I've noticed that an hvm_emulate_one() call (that uses guest_cpu_user_regs() for it's context) will succeed _without_ modifying guest_cpu_user_regs()->eip. Again, this is not only happening when hvm_emulate_one() returns X86EMUL_RETRY (which I'd expect), but also, in some cases, when it returns no error.

Why would that happen, and what might be an example of an instruction that could cause that if that's normal behaviour?

If you've noticed it, you're in a much better position to tell us for which instructions this _is_ happening than we are. As for when this is validly happening - off the top of my head I can only think of repeated string instructions as candidates (where the progress being made is expressed in decreasing [RE]CX) or, in similar ways, LOOPs having their own address as jump target.

Jan

#2 lore raw
Quoted 8 lines
Quoted 7 lines

guest_cpu_user_regs() for it's context) will succeed _without_ modifying guest_cpu_user_regs()->eip. Again, this is not only happening when hvm_emulate_one() returns X86EMUL_RETRY (which I'd expect), but also, in some cases, when it returns no error.

Why would that happen, and what might be an example of an instruction that could cause that if that's normal behaviour?

Quoted 6 lines

If you've noticed it, you're in a much better position to tell us for which instructions this _is_ happening than we are. As for when this is validly happening - off the top of my head I can only think of repeated string instructions as candidates (where the progress being made is expressed in decreasing [RE]CX) or, in similar ways, LOOPs having their own address as jump target.

Indeed, the question was actually "what class of instructions might cause this", not "what instruction is causing my particular issue". I should have formulated it in clearer terms.

Thank you for your answer.