All of lore.kernel.org
 help / color / mirror / Atom feed
* instrction emulation problem
@ 2010-08-13 14:51 strongerwill
  0 siblings, 0 replies; only message in thread
From: strongerwill @ 2010-08-13 14:51 UTC (permalink / raw)
  To: Keir Fraser; +Cc: Xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1629 bytes --]

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 
收件人: xen-devel@lists.xensource.com 
抄送: 
主题: [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
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

[-- Attachment #1.2: Type: text/html, Size: 6055 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-13 14:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-13 14:51 instrction emulation problem strongerwill

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.