Skip to contentSkip to conversation

instrction emulation problem

DISCUSSION strongerwill 1 participant 1 message Aug 13, 2010

lore
Share & tools
lore
#0 lore raw

Hi Keir:
I am sorry trouble you again. I want to emulate instruction "push %ebp" in Xen. I found the function emulate_privilege_op does not satisfy this requirement.
Then I resort to x86_emulate. I construct the x86_emulate_ctxt and reuse the "ptwr_emulate_ops".
code like this:

extern const struct x86_emulate_ops ptwr_emulate_ops; in do_general_protection {
....
struct x86_emulate_ctxt ctxt;
ctxt.regs = regs;
ctxt.force_writeback = 1; // 0 is the same ctxt.addr_size = 32;
ctxt.sp_size = 32;
ret = x86_emulate(&ctxt, &ptwr_emulate_ops);
...
}

the error message is:
(XEN) mm.c:5235:d0 ptwr_emulate: bad access (cr2=553a4000, addr=e81b5fac, bytes=4)

I have another idea, I directly update the stack and change the EIP and ESP like this:

regs->esp -= 4;
__raw_copy_to_guest((void*)regs->esp, &regs->ebp, sizeof(unsigned int)); regs->eip += 1;

I am not sure it works like this way. Please give me some tips. Thanks

Cheers,

Yueqiang

2010-08-13

strongerwill

发件人: Keir Fraser
发送时间: 2010-08-13 16:52:24
收件人: [email protected]
抄送:
主题: [Xen-devel] FINAL release candidate for Xen 4.0.1

Folks,
The sixth release candidate for 4.0.1 is tagged as 4.0.1-rc6 at
http://xenbits.xen.org/staging/xen-4.0-testing.hg
We expect this to be the final RC, with no changes except for regression fixes ahead of final release late next week. So please test this RC!
Thanks,
Keir
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel