[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/18] backdoor: [i386] Decode backdoor instructions
From: |
Lluís |
Subject: |
[Qemu-devel] [PATCH 05/18] backdoor: [i386] Decode backdoor instructions |
Date: |
Tue, 19 Oct 2010 21:14:36 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Decode backdoor instructions following "backdoor/guest.h" and call the
user-defined backdoor helpers.
Signed-off-by: Lluís Vilanova <address@hidden>
---
target-i386/translate.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/target-i386/translate.c b/target-i386/translate.c
index 7b6e3c2..b54a823 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -4105,6 +4105,31 @@ static target_ulong disas_insn(DisasContext *s,
target_ulong pc_start)
x86_64_hregs = 0;
#endif
s->rip_offset = 0; /* for relative ip address */
+
+#if defined(CONFIG_BACKDOOR)
+ if (ldub_code(s->pc) == 0x0f && ldub_code(s->pc + 1) == 0x04) {
+ uint8_t type = ldub_code(s->pc + 2);
+ TCGv_i32 cmd;
+ /* TODO: should break TB, but gen_eob generates an infinite loop */
+ switch (type) {
+ case 0x00: /* i8 */
+ cmd = tcg_const_i32((uint32_t)ldub_code(s->pc + 3));
+ gen_helper_backdoor_i8(cmd);
+ break;
+ case 0x01: /* i8 v */
+ cmd = tcg_const_i32(ldub_code(s->pc + 3));
+ gen_helper_backdoor_i8_v(cmd, cpu_regs[R_EAX]);
+ break;
+ default:
+ goto illegal_op;
+ }
+ s->pc += 4;
+ gen_jmp_im(s->pc);
+ gen_eob(s);
+ goto backdoor_done;
+ }
+#endif
+
next_byte:
b = ldub_code(s->pc);
s->pc++;
@@ -7636,6 +7661,11 @@ static target_ulong disas_insn(DisasContext *s,
target_ulong pc_start)
default:
goto illegal_op;
}
+
+#if defined(CONFIG_BACKDOOR)
+backdoor_done:
+#endif
+
/* lock generation */
if (s->prefix & PREFIX_LOCK)
gen_helper_unlock();
--
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 15/18] instrument: Add VMEM point, (continued)
- [Qemu-devel] [PATCH 15/18] instrument: Add VMEM point, Lluís, 2010/10/22
- [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 <=
- [Qemu-devel] [PATCH 06/18] backdoor: [i386] Declare guest-side interface macros, Lluís, 2010/10/22
- [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