[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 06/18] backdoor: [i386] Declare guest-side interface
From: |
Lluís |
Subject: |
[Qemu-devel] [PATCH 06/18] backdoor: [i386] Declare guest-side interface macros |
Date: |
Mon, 18 Oct 2010 20:08:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Guest-side macros to generate backdoor instructions.
Signed-off-by: Lluís Vilanova <address@hidden>
---
backdoor/guest.h | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/backdoor/guest.h b/backdoor/guest.h
index 58847e2..17029d3 100644
--- a/backdoor/guest.h
+++ b/backdoor/guest.h
@@ -26,8 +26,32 @@
* - V: value passed in register
*/
+#if __i386__ || __i486__ || __x86_64__
+
+#define __BACKDOOR_BASE asm volatile (".byte 0x0f, 0x04")
+#define __BACKDOOR_V(v) asm volatile ("movl %0, %%eax" : : "g"(v) : "%eax")
+
+#define BACKDOOR_i8(cmd) \
+ do { \
+ __BACKDOOR_BASE; \
+ __BACKDOOR_i8(0x00); \
+ __BACKDOOR_i8(cmd); \
+ } while (0)
+
+#define BACKDOOR_i8_V(cmd, value) \
+ do { \
+ __BACKDOOR_V(value); \
+ __BACKDOOR_BASE; \
+ __BACKDOOR_i8(0x01); \
+ __BACKDOOR_i8(cmd); \
+ } while (0)
+
+#else
+
#error Undefined instruction-based backdoor interface for guest architecture
+#endif
+
#define __str(s) #s
#define __xstr(s) __str(s)
--
1.7.1
--
"And it's much the same thing with knowledge, for whenever you learn
something new, the whole world becomes that much richer."
-- The Princess of Pure Reason, as told by Norton Juster in The Phantom
Tollbooth
- [Qemu-devel] [PATCH 16/18] instrument: [all] Call VMEM point, (continued)
- [Qemu-devel] [PATCH 16/18] instrument: [all] Call VMEM point, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 17/18] instrument: Add PLVL point, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 18/18] instrument: [i386] Call PLVL point, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 03/18] backdoor: [all] Include backdoor helper declarations, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 04/18] backdoor: Declare guest-side interface macros, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 08/18] instrument: Handle config-time activation, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 12/18] instrument: [all] Include instrumentation helper declarations, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 07/18] backdoor: Add a simple example, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 11/18] instrument: Code-generation macros, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 05/18] backdoor: [i386] Decode backdoor instructions, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 06/18] backdoor: [i386] Declare guest-side interface macros,
Lluís <=
- [Qemu-devel] [PATCH 09/18] instrument: Add initial instrumentation example, Lluís, 2010/10/22
- [Qemu-devel] [PATCH 10/18] instrument: Dynamic per-CPU state of static instrumentation points, Lluís, 2010/10/22
- Re: [Qemu-devel] [PATCH 00/17] [RFC] static instrumentation, Blue Swirl, 2010/10/23
- backdoor [Was: Re: [Qemu-devel] [PATCH 00/17] [RFC] static instrumentation], Lluís, 2010/10/25
- [Qemu-devel] Re: backdoor [Was: Re: [PATCH 00/17] [RFC] static instrumentation], Paolo Bonzini, 2010/10/25
- Re: [Qemu-devel] Re: backdoor, Lluís, 2010/10/25
- Re: [Qemu-devel] Re: backdoor, Anthony Liguori, 2010/10/25
- Re: [Qemu-devel] Re: backdoor, Lluís, 2010/10/25
- Re: [Qemu-devel] Re: backdoor, Anthony Liguori, 2010/10/25
- Re: [Qemu-devel] Re: backdoor, Lluís, 2010/10/26