Skip to contentSkip to conversation

EIP, xc_domain_hvm_getcontext_partial() and page fault events

DISCUSSION Razvan Cojocaru 1 participant 1 message Mar 5, 2013

lore
Share & tools
lore
#0 lore raw

Hello,

I'm using page fault mem_events from dom0 userspace. When I receive one such mem_event, I'm retrieving register values for the VCPU that has caused it, using xc_domain_hvm_getcontext_partial().

At the same time, I'm printing out v->arch.user_regs.eip from p2m_mem_access_check() in arch/x86/mm/p2m.c, and I'm noticing that the EIP value I'm getting from xc_domain_hvm_getcontext_partial() is less than the EIP value stored in v->arch.user_regs.eip. This, I assume, can be explained by the fact that in p2m_mem_access_check() EIP points to the instruction _after_ the instruction that caused the page fault, and it's being rewound by the time I query it from dom0 userspace.

Now, what I am after is a way to get the "proper", rewound, EIP (and the rest of the registers from when EIP was _before_ the fault instruction) in p2m_mem_access_check(). Is there a way to achieve this?

Thanks,
Razvan Cojocaru