aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/asm-x86/x86_emulate.h
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-03-15 15:58:52 +0000
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-03-15 15:58:52 +0000
commitd430aae25c084938dac4aa82d8d2592498b778ae (patch)
tree5a6d747502347513bf813041d0eb5b4e48c751bd /xen/include/asm-x86/x86_emulate.h
parentea847f783284434cf279c18f33da0a443d7fe39a (diff)
downloadxen-d430aae25c084938dac4aa82d8d2592498b778ae.tar.gz
xen-d430aae25c084938dac4aa82d8d2592498b778ae.tar.bz2
xen-d430aae25c084938dac4aa82d8d2592498b778ae.zip
bitkeeper revision 1.1236.34.3 (4237063cE2rat5RdEGCsTzuaC6XCcA)
Tidy the x86 emulator interface, and use it from within the writable pagetable algorithm to deal with otherwise unhandleable cases. For example: L1 mapped at multiple L2 slots; L1 that maps itself; L1 that also maps the code making the update, or the kernel stack. This provides a proof-of-concept for the emulator that can be picked up for the VMX code to improve the device-model emulation. Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/include/asm-x86/x86_emulate.h')
-rw-r--r--xen/include/asm-x86/x86_emulate.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/xen/include/asm-x86/x86_emulate.h b/xen/include/asm-x86/x86_emulate.h
index fc2301d376..895e22a209 100644
--- a/xen/include/asm-x86/x86_emulate.h
+++ b/xen/include/asm-x86/x86_emulate.h
@@ -32,9 +32,17 @@
* 2. If the access fails (cannot emulate, or a standard access faults) then
* it is up to the memop to propagate the fault to the guest VM via
* some out-of-band mechanism, unknown to the emulator. The memop signals
- * failure by returning a non-zero value to the emulator, which will then
- * immediately bail.
+ * failure by returning X86EMUL_PROPAGATE_FAULT to the emulator, which will
+ * then immediately bail.
*/
+/* Access completed successfully: continue emulation as normal. */
+#define X86EMUL_CONTINUE 0
+/* Access is unhandleable: bail from emulation and return error to caller. */
+#define X86EMUL_UNHANDLEABLE 1
+/* Terminate emulation but return success to the caller. */
+#define X86EMUL_PROPAGATE_FAULT 2 /* propagate a generated fault to guest */
+#define X86EMUL_RETRY_INSTR 2 /* retry the instruction for some reason */
+#define X86EMUL_CMPXCHG_FAILED 2 /* cmpxchg did not see expected value */
struct x86_mem_emulator
{
/*
@@ -89,17 +97,26 @@ struct x86_mem_emulator
* @addr: [IN ] Linear address to access.
* @old: [IN ] Value expected to be current at @addr.
* @new: [IN ] Value to write to @addr.
- * @seen: [OUT] Value actually seen at @addr, zero-extended to 'u_long'.
* @bytes: [IN ] Number of bytes to access using CMPXCHG.
*/
int (*cmpxchg_emulated)(
unsigned long addr,
- unsigned long old,
+ unsigned long old,
unsigned long new,
- unsigned long *seen,
unsigned int bytes);
};
+/* Standard reader/writer functions that callers may wish to use. */
+extern int
+x86_emulate_read_std(
+ unsigned long addr,
+ unsigned long *val,
+ unsigned int bytes);
+extern int
+x86_emulate_write_std(
+ unsigned long addr,
+ unsigned long val,
+ unsigned int bytes);
struct xen_regs;