Browse Source
* replaced old qvm86 kernel module with the offical kqemu accelerator module that is now licensed under the GPL * replaced gcc-4.x related patches with rediffed ones for qemu 0.9.0 git-svn-id: svn://svn.opensde.net/opensde/package/trunk@20650 10447126-35f2-4685-b0cf-6dd780d3921fearly
11 changed files with 1183 additions and 615 deletions
@ -0,0 +1,34 @@ |
|||||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
||||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
||||||
|
#
|
||||||
|
# Filename: package/.../qemu/qemu-0.9.0-enforce-16byte-boundaries.patch
|
||||||
|
# Copyright (C) 2007 The OpenSDE Project
|
||||||
|
#
|
||||||
|
# More information can be found in the files COPYING and README.
|
||||||
|
#
|
||||||
|
# This patch file is dual-licensed. It is available under the license the
|
||||||
|
# patched project is licensed under, as long as it is an OpenSource license
|
||||||
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
||||||
|
# of the GNU General Public License as published by the Free Software
|
||||||
|
# Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
# version.
|
||||||
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
||||||
|
|
||||||
|
2007-04-12 rediffed for qemu 0.9.0
|
||||||
|
|
||||||
|
2006-02-12 Gwenole Beauchesne <[email protected]>
|
||||||
|
|
||||||
|
* Enforce 16-byte boundaries.
|
||||||
|
|
||||||
|
diff -ruN qemu-0.9.0/Makefile.target qemu-0.9.0-enforce-16byte-boundaries/Makefile.target
|
||||||
|
--- qemu-0.9.0/Makefile.target 2007-02-06 00:01:54.000000000 +0100
|
||||||
|
+++ qemu-0.9.0-enforce-16byte-boundaries/Makefile.target 2007-04-12 17:29:20.000000000 +0200
|
||||||
|
@@ -74,7 +74,7 @@
|
||||||
|
|
||||||
|
ifeq ($(ARCH),i386)
|
||||||
|
HELPER_CFLAGS+=-fomit-frame-pointer
|
||||||
|
-OP_CFLAGS+=-mpreferred-stack-boundary=2 -fomit-frame-pointer
|
||||||
|
+OP_CFLAGS+=-fomit-frame-pointer
|
||||||
|
ifeq ($(HAVE_GCC3_OPTIONS),yes)
|
||||||
|
OP_CFLAGS+= -falign-functions=0 -fno-gcse
|
||||||
|
else
|
@ -0,0 +1,140 @@ |
|||||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
||||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
||||||
|
#
|
||||||
|
# Filename: package/.../qemu/qemu-0.9.0-gcc4-hacks.patch
|
||||||
|
# Copyright (C) 2007 The OpenSDE Project
|
||||||
|
#
|
||||||
|
# More information can be found in the files COPYING and README.
|
||||||
|
#
|
||||||
|
# This patch file is dual-licensed. It is available under the license the
|
||||||
|
# patched project is licensed under, as long as it is an OpenSource license
|
||||||
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
||||||
|
# of the GNU General Public License as published by the Free Software
|
||||||
|
# Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
# version.
|
||||||
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
||||||
|
|
||||||
|
2007-04-12 rediffed for qemu 0.9.0
|
||||||
|
|
||||||
|
2005-10-28 Gwenole Beauchesne <[email protected]>
|
||||||
|
|
||||||
|
* Various additional hacks for GCC4.
|
||||||
|
|
||||||
|
diff -ruN qemu-0.9.0/cpu-all.h qemu-0.9.0-gcc4-hacks/cpu-all.h
|
||||||
|
--- qemu-0.9.0/cpu-all.h 2007-02-06 00:01:54.000000000 +0100
|
||||||
|
+++ qemu-0.9.0-gcc4-hacks/cpu-all.h 2007-04-12 17:20:17.000000000 +0200
|
||||||
|
@@ -339,7 +339,13 @@
|
||||||
|
|
||||||
|
static inline void stq_le_p(void *ptr, uint64_t v)
|
||||||
|
{
|
||||||
|
+#if defined(__i386__) && __GNUC__ >= 4
|
||||||
|
+ const union { uint64_t v; uint32_t p[2]; } x = { .v = v };
|
||||||
|
+ ((uint32_t *)ptr)[0] = x.p[0];
|
||||||
|
+ ((uint32_t *)ptr)[1] = x.p[1];
|
||||||
|
+#else
|
||||||
|
*(uint64_t *)ptr = v;
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* float access */
|
||||||
|
diff -ruN qemu-0.9.0/softmmu_header.h qemu-0.9.0-gcc4-hacks/softmmu_header.h
|
||||||
|
--- qemu-0.9.0/softmmu_header.h 2007-02-06 00:01:54.000000000 +0100
|
||||||
|
+++ qemu-0.9.0-gcc4-hacks/softmmu_header.h 2007-04-12 17:20:17.000000000 +0200
|
||||||
|
@@ -108,7 +108,7 @@
|
||||||
|
void REGPARM(2) glue(glue(__st, SUFFIX), MMUSUFFIX)(target_ulong addr, DATA_TYPE v, int is_user);
|
||||||
|
|
||||||
|
#if (DATA_SIZE <= 4) && (TARGET_LONG_BITS == 32) && defined(__i386__) && \
|
||||||
|
- (ACCESS_TYPE <= 1) && defined(ASM_SOFTMMU)
|
||||||
|
+ (ACCESS_TYPE <= 1) && defined(ASM_SOFTMMU) && (__GNUC__ < 4)
|
||||||
|
|
||||||
|
#define CPU_TLB_ENTRY_BITS 4
|
||||||
|
|
||||||
|
@@ -150,7 +150,7 @@
|
||||||
|
"m" (*(uint32_t *)offsetof(CPUState, tlb_table[CPU_MEM_INDEX][0].addr_read)),
|
||||||
|
"i" (CPU_MEM_INDEX),
|
||||||
|
"m" (*(uint8_t *)&glue(glue(__ld, SUFFIX), MMUSUFFIX))
|
||||||
|
- : "%eax", "%ecx", "%edx", "memory", "cc");
|
||||||
|
+ : "%eax", "%edx", "memory", "cc");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -197,13 +197,14 @@
|
||||||
|
"m" (*(uint32_t *)offsetof(CPUState, tlb_table[CPU_MEM_INDEX][0].addr_read)),
|
||||||
|
"i" (CPU_MEM_INDEX),
|
||||||
|
"m" (*(uint8_t *)&glue(glue(__ld, SUFFIX), MMUSUFFIX))
|
||||||
|
- : "%eax", "%ecx", "%edx", "memory", "cc");
|
||||||
|
+ : "%eax", "%edx", "memory", "cc");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-static inline void glue(glue(st, SUFFIX), MEMSUFFIX)(target_ulong ptr, RES_TYPE v)
|
||||||
|
+static inline void glue(glue(st, SUFFIX), MEMSUFFIX)(target_ulong ptr, RES_TYPE val)
|
||||||
|
{
|
||||||
|
+ RES_TYPE v = val;
|
||||||
|
asm volatile ("movl %0, %%edx\n"
|
||||||
|
"movl %0, %%eax\n"
|
||||||
|
"shrl %3, %%edx\n"
|
||||||
|
@@ -240,16 +241,14 @@
|
||||||
|
"2:\n"
|
||||||
|
:
|
||||||
|
: "r" (ptr),
|
||||||
|
-/* NOTE: 'q' would be needed as constraint, but we could not use it
|
||||||
|
- with T1 ! */
|
||||||
|
- "r" (v),
|
||||||
|
+ "q" (v),
|
||||||
|
"i" ((CPU_TLB_SIZE - 1) << CPU_TLB_ENTRY_BITS),
|
||||||
|
"i" (TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS),
|
||||||
|
"i" (TARGET_PAGE_MASK | (DATA_SIZE - 1)),
|
||||||
|
"m" (*(uint32_t *)offsetof(CPUState, tlb_table[CPU_MEM_INDEX][0].addr_write)),
|
||||||
|
"i" (CPU_MEM_INDEX),
|
||||||
|
"m" (*(uint8_t *)&glue(glue(__st, SUFFIX), MMUSUFFIX))
|
||||||
|
- : "%eax", "%ecx", "%edx", "memory", "cc");
|
||||||
|
+ : "%eax", "%edx", "memory", "cc");
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
diff -ruN qemu-0.9.0/target-i386/helper.c qemu-0.9.0-gcc4-hacks/target-i386/helper.c
|
||||||
|
--- qemu-0.9.0/target-i386/helper.c 2007-02-06 00:01:54.000000000 +0100
|
||||||
|
+++ qemu-0.9.0-gcc4-hacks/target-i386/helper.c 2007-04-12 17:20:17.000000000 +0200
|
||||||
|
@@ -3452,8 +3452,15 @@
|
||||||
|
nb_xmm_regs = 8 << data64;
|
||||||
|
addr = ptr + 0xa0;
|
||||||
|
for(i = 0; i < nb_xmm_regs; i++) {
|
||||||
|
+#if defined(__i386__) && __GNUC__ >= 4
|
||||||
|
+ env->xmm_regs[i].XMM_L(0) = ldl(addr);
|
||||||
|
+ env->xmm_regs[i].XMM_L(1) = ldl(addr + 4);
|
||||||
|
+ env->xmm_regs[i].XMM_L(2) = ldl(addr + 8);
|
||||||
|
+ env->xmm_regs[i].XMM_L(3) = ldl(addr + 12);
|
||||||
|
+#else
|
||||||
|
env->xmm_regs[i].XMM_Q(0) = ldq(addr);
|
||||||
|
env->xmm_regs[i].XMM_Q(1) = ldq(addr + 8);
|
||||||
|
+#endif
|
||||||
|
addr += 16;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff -ruN qemu-0.9.0/target-i386/ops_sse.h qemu-0.9.0-gcc4-hacks/target-i386/ops_sse.h
|
||||||
|
--- qemu-0.9.0/target-i386/ops_sse.h 2007-02-06 00:01:54.000000000 +0100
|
||||||
|
+++ qemu-0.9.0-gcc4-hacks/target-i386/ops_sse.h 2007-04-12 17:20:17.000000000 +0200
|
||||||
|
@@ -34,6 +34,12 @@
|
||||||
|
#define Q(n) XMM_Q(n)
|
||||||
|
#define SUFFIX _xmm
|
||||||
|
#endif
|
||||||
|
+#if defined(__i386__) && __GNUC__ >= 4
|
||||||
|
+#define RegCopy(d, s) __builtin_memcpy(&(d), &(s), sizeof(d))
|
||||||
|
+#endif
|
||||||
|
+#ifndef RegCopy
|
||||||
|
+#define RegCopy(d, s) d = s
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
void OPPROTO glue(op_psrlw, SUFFIX)(void)
|
||||||
|
{
|
||||||
|
@@ -589,7 +595,7 @@
|
||||||
|
r.W(1) = s->W((order >> 2) & 3);
|
||||||
|
r.W(2) = s->W((order >> 4) & 3);
|
||||||
|
r.W(3) = s->W((order >> 6) & 3);
|
||||||
|
- *d = r;
|
||||||
|
+ RegCopy(*d, r);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void OPPROTO op_shufps(void)
|
@ -0,0 +1,893 @@ |
|||||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
||||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
||||||
|
#
|
||||||
|
# Filename: package/.../qemu/qemu-0.9.0-gcc4.patch
|
||||||
|
# Copyright (C) 2007 The OpenSDE Project
|
||||||
|
#
|
||||||
|
# More information can be found in the files COPYING and README.
|
||||||
|
#
|
||||||
|
# This patch file is dual-licensed. It is available under the license the
|
||||||
|
# patched project is licensed under, as long as it is an OpenSource license
|
||||||
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
||||||
|
# of the GNU General Public License as published by the Free Software
|
||||||
|
# Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
# version.
|
||||||
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
||||||
|
|
||||||
|
2007-04-12 rediffed for qemu 0.9.0
|
||||||
|
|
||||||
|
2005-06-02 Gwenole Beauchesne <[email protected]>
|
||||||
|
|
||||||
|
* dyngen.c (trace_i386_insn): Fix push/imul case with 8-bit
|
||||||
|
immediate.
|
||||||
|
|
||||||
|
2005-05-11 Paul Brook <[email protected]>
|
||||||
|
|
||||||
|
* gcc4 host support.
|
||||||
|
|
||||||
|
diff -ruN qemu-0.9.0/dyngen-exec.h qemu-0.9.0-gcc4/dyngen-exec.h
|
||||||
|
--- qemu-0.9.0/dyngen-exec.h 2007-02-06 00:01:54.000000000 +0100
|
||||||
|
+++ qemu-0.9.0-gcc4/dyngen-exec.h 2007-04-12 17:24:57.000000000 +0200
|
||||||
|
@@ -191,7 +191,12 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* force GCC to generate only one epilog at the end of the function */
|
||||||
|
+#if defined(__i386__) || defined(__x86_64__)
|
||||||
|
+/* Also add 4 bytes of padding so that we can replace the ret with a jmp. */
|
||||||
|
+#define FORCE_RET() __asm__ __volatile__("nop;nop;nop;nop" : : : "memory");
|
||||||
|
+#else
|
||||||
|
#define FORCE_RET() __asm__ __volatile__("" : : : "memory");
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
#ifndef OPPROTO
|
||||||
|
#define OPPROTO
|
||||||
|
@@ -241,12 +246,19 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __i386__
|
||||||
|
-#define EXIT_TB() asm volatile ("ret")
|
||||||
|
-#define GOTO_LABEL_PARAM(n) asm volatile ("jmp " ASM_NAME(__op_gen_label) #n)
|
||||||
|
+/* Dyngen will replace hlt instructions with a ret instruction. Inserting a
|
||||||
|
+ ret directly would confuse dyngen. */
|
||||||
|
+#define EXIT_TB() asm volatile ("hlt")
|
||||||
|
+/* Dyngen will replace cli with 0x9e (jmp).
|
||||||
|
+ We generate the offset manually. */
|
||||||
|
+#define GOTO_LABEL_PARAM(n) \
|
||||||
|
+ asm volatile ("cli;.long " ASM_NAME(__op_gen_label) #n " - 1f;1:")
|
||||||
|
#endif
|
||||||
|
#ifdef __x86_64__
|
||||||
|
-#define EXIT_TB() asm volatile ("ret")
|
||||||
|
-#define GOTO_LABEL_PARAM(n) asm volatile ("jmp " ASM_NAME(__op_gen_label) #n)
|
||||||
|
+/* The same as i386. */
|
||||||
|
+#define EXIT_TB() asm volatile ("hlt")
|
||||||
|
+#define GOTO_LABEL_PARAM(n) \
|
||||||
|
+ asm volatile ("cli;.long " ASM_NAME(__op_gen_label) #n " - 1f;1:")
|
||||||
|
#endif
|
||||||
|
#ifdef __powerpc__
|
||||||
|
#define EXIT_TB() asm volatile ("blr")
|
||||||
|
diff -ruN qemu-0.9.0/dyngen.c qemu-0.9.0-gcc4/dyngen.c
|
||||||
|
--- qemu-0.9.0/dyngen.c 2007-02-06 00:01:54.000000000 +0100
|
||||||
|
+++ qemu-0.9.0-gcc4/dyngen.c 2007-04-12 17:24:57.000000000 +0200
|
||||||
|
@@ -32,6 +32,8 @@
|
||||||
|
|
||||||
|
#include "config-host.h"
|
||||||
|
|
||||||
|
+//#define DEBUG_OP
|
||||||
|
+
|
||||||
|
/* NOTE: we test CONFIG_WIN32 instead of _WIN32 to enabled cross
|
||||||
|
compilation */
|
||||||
|
#if defined(CONFIG_WIN32)
|
||||||
|
@@ -1414,6 +1416,644 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
+#if defined(HOST_I386) || defined(HOST_X86_64)
|
||||||
|
+
|
||||||
|
+/* This byte is the first byte of an instruction. */
|
||||||
|
+#define FLAG_INSN (1 << 0)
|
||||||
|
+/* This byte has been processed as part of an instruction. */
|
||||||
|
+#define FLAG_SCANNED (1 << 1)
|
||||||
|
+/* This instruction is a return instruction. Gcc cometimes generates prefix
|
||||||
|
+ bytes, so may be more than one byte long. */
|
||||||
|
+#define FLAG_RET (1 << 2)
|
||||||
|
+/* This is either the target of a jump, or the preceeding instruction uses
|
||||||
|
+ a pc-relative offset. */
|
||||||
|
+#define FLAG_TARGET (1 << 3)
|
||||||
|
+/* This is a magic instruction that needs fixing up. */
|
||||||
|
+#define FLAG_EXIT (1 << 4)
|
||||||
|
+#define MAX_EXITS 5
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+bad_opcode(const char *name, uint32_t op)
|
||||||
|
+{
|
||||||
|
+ error("Unsupported opcode %0*x in %s", (op > 0xff) ? 4 : 2, op, name);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* Mark len bytes as scanned, Returns insn_size + len. Reports an error
|
||||||
|
+ if these bytes have already been scanned. */
|
||||||
|
+static int
|
||||||
|
+eat_bytes(const char *name, char *flags, int insn, int insn_size, int len)
|
||||||
|
+{
|
||||||
|
+ while (len > 0) {
|
||||||
|
+ /* This should never occur in sane code. */
|
||||||
|
+ if (flags[insn + insn_size] & FLAG_SCANNED)
|
||||||
|
+ error ("Overlapping instructions in %s", name);
|
||||||
|
+ flags[insn + insn_size] |= FLAG_SCANNED;
|
||||||
|
+ insn_size++;
|
||||||
|
+ len--;
|
||||||
|
+ }
|
||||||
|
+ return insn_size;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+trace_i386_insn (const char *name, uint8_t *start_p, char *flags, int insn,
|
||||||
|
+ int len)
|
||||||
|
+{
|
||||||
|
+ uint8_t *ptr;
|
||||||
|
+ uint8_t op;
|
||||||
|
+ int modrm;
|
||||||
|
+ int is_prefix;
|
||||||
|
+ int op_size;
|
||||||
|
+ int addr_size;
|
||||||
|
+ int insn_size;
|
||||||
|
+ int is_ret;
|
||||||
|
+ int is_condjmp;
|
||||||
|
+ int is_jmp;
|
||||||
|
+ int is_exit;
|
||||||
|
+ int is_pcrel;
|
||||||
|
+ int immed;
|
||||||
|
+ int seen_rexw;
|
||||||
|
+ int32_t disp;
|
||||||
|
+
|
||||||
|
+ ptr = start_p + insn;
|
||||||
|
+ /* nonzero if this insn has a ModR/M byte. */
|
||||||
|
+ modrm = 1;
|
||||||
|
+ /* The size of the immediate value in this instruction. */
|
||||||
|
+ immed = 0;
|
||||||
|
+ /* The operand size. */
|
||||||
|
+ op_size = 4;
|
||||||
|
+ /* The address size */
|
||||||
|
+ addr_size = 4;
|
||||||
|
+ /* The total length of this instruction. */
|
||||||
|
+ insn_size = 0;
|
||||||
|
+ is_prefix = 1;
|
||||||
|
+ is_ret = 0;
|
||||||
|
+ is_condjmp = 0;
|
||||||
|
+ is_jmp = 0;
|
||||||
|
+ is_exit = 0;
|
||||||
|
+ seen_rexw = 0;
|
||||||
|
+ is_pcrel = 0;
|
||||||
|
+
|
||||||
|
+ while (is_prefix) {
|
||||||
|
+ op = ptr[insn_size];
|
||||||
|
+ insn_size = eat_bytes(name, flags, insn, insn_size, 1);
|
||||||
|
+ is_prefix = 0;
|
||||||
|
+ switch (op >> 4) {
|
||||||
|
+ case 0:
|
||||||
|
+ case 1:
|
||||||
|
+ case 2:
|
||||||
|
+ case 3:
|
||||||
|
+ if (op == 0x0f) {
|
||||||
|
+ /* two-byte opcode. */
|
||||||
|
+ op = ptr[insn_size];
|
||||||
|
+ insn_size = eat_bytes(name, flags, insn, insn_size, 1);
|
||||||
|
+ switch (op >> 4) {
|
||||||
|
+ case 0:
|
||||||
|
+ if ((op & 0xf) > 3)
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+ case 1: /* vector move or prefetch */
|
||||||
|
+ case 2: /* various moves and vector compares. */
|
||||||
|
+ case 4: /* cmov */
|
||||||
|
+ case 5: /* vector instructions */
|
||||||
|
+ case 6:
|
||||||
|
+ case 13:
|
||||||
|
+ case 14:
|
||||||
|
+ case 15:
|
||||||
|
+ break;
|
||||||
|
+ case 7: /* mmx */
|
||||||
|
+ if (op & 0x77) /* emms */
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+ case 3: /* wrmsr, rdtsc, rdmsr, rdpmc, sysenter, sysexit */
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+ case 8: /* long conditional jump */
|
||||||
|
+ is_condjmp = 1;
|
||||||
|
+ immed = op_size;
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+ case 9: /* setcc */
|
||||||
|
+ break;
|
||||||
|
+ case 10:
|
||||||
|
+ switch (op & 0x7) {
|
||||||
|
+ case 0: /* push fs/gs */
|
||||||
|
+ case 1: /* pop fs/gs */
|
||||||
|
+ case 2: /* cpuid/rsm */
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+ case 4: /* shld/shrd immediate */
|
||||||
|
+ immed = 1;
|
||||||
|
+ break;
|
||||||
|
+ default: /* Normal instructions with a ModR/M byte. */
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+ case 11:
|
||||||
|
+ switch (op & 0xf) {
|
||||||
|
+ case 10: /* bt, bts, btr, btc */
|
||||||
|
+ immed = 1;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ /* cmpxchg, lss, btr, lfs, lgs, movzx, btc, bsf, bsr
|
||||||
|
+ undefined, and movsx */
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+ case 12:
|
||||||
|
+ if (op & 8) {
|
||||||
|
+ /* bswap */
|
||||||
|
+ modrm = 0;
|
||||||
|
+ } else {
|
||||||
|
+ switch (op & 0x7) {
|
||||||
|
+ case 2:
|
||||||
|
+ case 4:
|
||||||
|
+ case 5:
|
||||||
|
+ case 6:
|
||||||
|
+ immed = 1;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ } else if ((op & 0x07) <= 0x3) {
|
||||||
|
+ /* General arithmentic ax. */
|
||||||
|
+ } else if ((op & 0x07) <= 0x5) {
|
||||||
|
+ /* General arithmetic ax, immediate. */
|
||||||
|
+ if (op & 0x01)
|
||||||
|
+ immed = op_size;
|
||||||
|
+ else
|
||||||
|
+ immed = 1;
|
||||||
|
+ modrm = 0;
|
||||||
|
+ } else if ((op & 0x23) == 0x22) {
|
||||||
|
+ /* Segment prefix. */
|
||||||
|
+ is_prefix = 1;
|
||||||
|
+ } else {
|
||||||
|
+ /* Segment register push/pop or DAA/AAA/DAS/AAS. */
|
||||||
|
+ modrm = 0;
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+#if defined(HOST_X86_64)
|
||||||
|
+ case 4: /* rex prefix. */
|
||||||
|
+ is_prefix = 1;
|
||||||
|
+ /* The address/operand size is actually 64-bit, but the immediate
|
||||||
|
+ values in the instruction are still 32-bit. */
|
||||||
|
+ op_size = 4;
|
||||||
|
+ addr_size = 4;
|
||||||
|
+ if (op & 8)
|
||||||
|
+ seen_rexw = 1;
|
||||||
|
+ break;
|
||||||
|
+#else
|
||||||
|
+ case 4: /* inc/dec register. */
|
||||||
|
+#endif
|
||||||
|
+ case 5: /* push/pop general register. */
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case 6:
|
||||||
|
+ switch (op & 0x0f) {
|
||||||
|
+ case 0: /* pusha */
|
||||||
|
+ case 1: /* popa */
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+ case 2: /* bound */
|
||||||
|
+ case 3: /* arpl */
|
||||||
|
+ break;
|
||||||
|
+ case 4: /* FS */
|
||||||
|
+ case 5: /* GS */
|
||||||
|
+ is_prefix = 1;
|
||||||
|
+ break;
|
||||||
|
+ case 6: /* opcode size prefix. */
|
||||||
|
+ op_size = 2;
|
||||||
|
+ is_prefix = 1;
|
||||||
|
+ break;
|
||||||
|
+ case 7: /* Address size prefix. */
|
||||||
|
+ addr_size = 2;
|
||||||
|
+ is_prefix = 1;
|
||||||
|
+ break;
|
||||||
|
+ case 8: /* push immediate */
|
||||||
|
+ immed = op_size;
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+ case 10: /* push 8-bit immediate */
|
||||||
|
+ immed = 1;
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+ case 9: /* imul immediate */
|
||||||
|
+ immed = op_size;
|
||||||
|
+ break;
|
||||||
|
+ case 11: /* imul 8-bit immediate */
|
||||||
|
+ immed = 1;
|
||||||
|
+ break;
|
||||||
|
+ case 12: /* insb */
|
||||||
|
+ case 13: /* insw */
|
||||||
|
+ case 14: /* outsb */
|
||||||
|
+ case 15: /* outsw */
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case 7: /* Short conditional jump. */
|
||||||
|
+ is_condjmp = 1;
|
||||||
|
+ immed = 1;
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case 8:
|
||||||
|
+ if ((op & 0xf) <= 3) {
|
||||||
|
+ /* arithmetic immediate. */
|
||||||
|
+ if ((op & 3) == 1)
|
||||||
|
+ immed = op_size;
|
||||||
|
+ else
|
||||||
|
+ immed = 1;
|
||||||
|
+ }
|
||||||
|
+ /* else test, xchg, mov, lea or pop general. */
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case 9:
|
||||||
|
+ /* Various single-byte opcodes with no modrm byte. */
|
||||||
|
+ modrm = 0;
|
||||||
|
+ if (op == 10) {
|
||||||
|
+ /* Call */
|
||||||
|
+ immed = 4;
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case 10:
|
||||||
|
+ switch ((op & 0xe) >> 1) {
|
||||||
|
+ case 0: /* mov absoliute immediate. */
|
||||||
|
+ case 1:
|
||||||
|
+ if (seen_rexw)
|
||||||
|
+ immed = 8;
|
||||||
|
+ else
|
||||||
|
+ immed = addr_size;
|
||||||
|
+ break;
|
||||||
|
+ case 4: /* test immediate. */
|
||||||
|
+ if (op & 1)
|
||||||
|
+ immed = op_size;
|
||||||
|
+ else
|
||||||
|
+ immed = 1;
|
||||||
|
+ break;
|
||||||
|
+ default: /* Various string ops. */
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case 11: /* move immediate to register */
|
||||||
|
+ if (op & 8) {
|
||||||
|
+ if (seen_rexw)
|
||||||
|
+ immed = 8;
|
||||||
|
+ else
|
||||||
|
+ immed = op_size;
|
||||||
|
+ } else {
|
||||||
|
+ immed = 1;
|
||||||
|
+ }
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case 12:
|
||||||
|
+ switch (op & 0xf) {
|
||||||
|
+ case 0: /* shift immediate */
|
||||||
|
+ case 1:
|
||||||
|
+ immed = 1;
|
||||||
|
+ break;
|
||||||
|
+ case 2: /* ret immediate */
|
||||||
|
+ immed = 2;
|
||||||
|
+ modrm = 0;
|
||||||
|
+ bad_opcode(name, op);
|
||||||
|
+ break;
|
||||||
|
+ case 3: /* ret */
|
||||||
|
+ modrm = 0;
|
||||||
|
+ is_ret = 1;
|
||||||
|
+ case 4: /* les */
|
||||||
|
+ case 5: /* lds */
|
||||||
|
+ break;
|
||||||
|
+ case 6: /* mov immediate byte */
|
||||||
|
+ immed = 1;
|
||||||
|
+ break;
|
||||||
|
+ case 7: /* mov immediate */
|
||||||
|
+ immed = op_size;
|
||||||
|
+ break;
|
||||||
|
+ case 8: /* enter */
|
||||||
|
+ /* TODO: Is this right? */
|
||||||
|
+ immed = 3;
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+ case 10: /* retf immediate */
|
||||||
|
+ immed = 2;
|
||||||
|
+ modrm = 0;
|
||||||
|
+ bad_opcode(name, op);
|
||||||
|
+ break;
|
||||||
|
+ case 13: /* int */
|
||||||
|
+ immed = 1;
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+ case 11: /* retf */
|
||||||
|
+ case 15: /* iret */
|
||||||
|
+ modrm = 0;
|
||||||
|
+ bad_opcode(name, op);
|
||||||
|
+ break;
|
||||||
|
+ default: /* leave, int3 or into */
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case 13:
|
||||||
|
+ if ((op & 0xf) >= 8) {
|
||||||
|
+ /* Coprocessor escape. For our purposes this is just a normal
|
||||||
|
+ instruction with a ModR/M byte. */
|
||||||
|
+ } else if ((op & 0xf) >= 4) {
|
||||||
|
+ /* AAM, AAD or XLAT */
|
||||||
|
+ modrm = 0;
|
||||||
|
+ }
|
||||||
|
+ /* else shift instruction */
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case 14:
|
||||||
|
+ switch ((op & 0xc) >> 2) {
|
||||||
|
+ case 0: /* loop or jcxz */
|
||||||
|
+ is_condjmp = 1;
|
||||||
|
+ immed = 1;
|
||||||
|
+ break;
|
||||||
|
+ case 1: /* in/out immed */
|
||||||
|
+ immed = 1;
|
||||||
|
+ break;
|
||||||
|
+ case 2: /* call or jmp */
|
||||||
|
+ switch (op & 3) {
|
||||||
|
+ case 0: /* call */
|
||||||
|
+ immed = op_size;
|
||||||
|
+ break;
|
||||||
|
+ case 1: /* long jump */
|
||||||
|
+ immed = 4;
|
||||||
|
+ is_jmp = 1;
|
||||||
|
+ break;
|
||||||
|
+ case 2: /* far jmp */
|
||||||
|
+ bad_opcode(name, op);
|
||||||
|
+ break;
|
||||||
|
+ case 3: /* short jmp */
|
||||||
|
+ immed = 1;
|
||||||
|
+ is_jmp = 1;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+ case 3: /* in/out register */
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ modrm = 0;
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ case 15:
|
||||||
|
+ switch ((op & 0xe) >> 1) {
|
||||||
|
+ case 0:
|
||||||
|
+ case 1:
|
||||||
|
+ is_prefix = 1;
|
||||||
|
+ break;
|
||||||
|
+ case 2:
|
||||||
|
+ case 4:
|
||||||
|
+ case 5:
|
||||||
|
+ case 6:
|
||||||
|
+ modrm = 0;
|
||||||
|
+ /* Some privileged insns are used as markers. */
|
||||||
|
+ switch (op) {
|
||||||
|
+ case 0xf4: /* hlt: Exit translation block. */
|
||||||
|
+ is_exit = 1;
|
||||||
|
+ break;
|
||||||
|
+ case 0xfa: /* cli: Jump to label. */
|
||||||
|
+ is_exit = 1;
|
||||||
|
+ immed = 4;
|
||||||
|
+ break;
|
||||||
|
+ case 0xfb: /* sti: TB patch jump. */
|
||||||
|
+ /* Mark the insn for patching, but continue sscanning. */
|
||||||
|
+ flags[insn] |= FLAG_EXIT;
|
||||||
|
+ immed = 4;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+ case 3: /* unary grp3 */
|
||||||
|
+ if ((ptr[insn_size] & 0x38) == 0) {
|
||||||
|
+ if (op == 0xf7)
|
||||||
|
+ immed = op_size;
|
||||||
|
+ else
|
||||||
|
+ immed = 1; /* test immediate */
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+ case 7: /* inc/dec grp4/5 */
|
||||||
|
+ /* TODO: This includes indirect jumps. We should fail if we
|
||||||
|
+ encounter one of these. */
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (modrm) {
|
||||||
|
+ if (addr_size != 4)
|
||||||
|
+ error("16-bit addressing mode used in %s", name);
|
||||||
|
+
|
||||||
|
+ disp = 0;
|
||||||
|
+ modrm = ptr[insn_size];
|
||||||
|
+ insn_size = eat_bytes(name, flags, insn, insn_size, 1);
|
||||||
|
+ modrm &= 0xc7;
|
||||||
|
+ switch ((modrm & 0xc0) >> 6) {
|
||||||
|
+ case 0:
|
||||||
|
+ if (modrm == 5)
|
||||||
|
+ disp = 4;
|
||||||
|
+ break;
|
||||||
|
+ case 1:
|
||||||
|
+ disp = 1;
|
||||||
|
+ break;
|
||||||
|
+ case 2:
|
||||||
|
+ disp = 4;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ if ((modrm & 0xc0) != 0xc0 && (modrm & 0x7) == 4) {
|
||||||
|
+ /* SIB byte */
|
||||||
|
+ if (modrm == 4 && (ptr[insn_size] & 0x7) == 5) {
|
||||||
|
+ disp = 4;
|
||||||
|
+ is_pcrel = 1;
|
||||||
|
+ }
|
||||||
|
+ insn_size = eat_bytes(name, flags, insn, insn_size, 1);
|
||||||
|
+ }
|
||||||
|
+ insn_size = eat_bytes(name, flags, insn, insn_size, disp);
|
||||||
|
+ }
|
||||||
|
+ insn_size = eat_bytes(name, flags, insn, insn_size, immed);
|
||||||
|
+ if (is_condjmp || is_jmp) {
|
||||||
|
+ if (immed == 1) {
|
||||||
|
+ disp = (int8_t)*(ptr + insn_size - 1);
|
||||||
|
+ } else {
|
||||||
|
+ disp = (((int32_t)*(ptr + insn_size - 1)) << 24)
|
||||||
|
+ | (((int32_t)*(ptr + insn_size - 2)) << 16)
|
||||||
|
+ | (((int32_t)*(ptr + insn_size - 3)) << 8)
|
||||||
|
+ | *(ptr + insn_size - 4);
|
||||||
|
+ }
|
||||||
|
+ disp += insn_size;
|
||||||
|
+ /* Jumps to external symbols point to the address of the offset
|
||||||
|
+ before relocation. */
|
||||||
|
+ /* ??? These are probably a tailcall. We could fix them up by
|
||||||
|
+ replacing them with jmp to EOB + call, but it's easier to just
|
||||||
|
+ prevent the compiler generating them. */
|
||||||
|
+ if (disp == 1)
|
||||||
|
+ error("Unconditional jump (sibcall?) in %s", name);
|
||||||
|
+ disp += insn;
|
||||||
|
+ if (disp < 0 || disp > len)
|
||||||
|
+ error("Jump outside instruction in %s", name);
|
||||||
|
+
|
||||||
|
+ if ((flags[disp] & (FLAG_INSN | FLAG_SCANNED)) == FLAG_SCANNED)
|
||||||
|
+ error("Overlapping instructions in %s", name);
|
||||||
|
+
|
||||||
|
+ flags[disp] |= (FLAG_INSN | FLAG_TARGET);
|
||||||
|
+ is_pcrel = 1;
|
||||||
|
+ }
|
||||||
|
+ if (is_pcrel) {
|
||||||
|
+ /* Mark the following insn as a jump target. This will stop
|
||||||
|
+ this instruction being moved. */
|
||||||
|
+ flags[insn + insn_size] |= FLAG_TARGET;
|
||||||
|
+ }
|
||||||
|
+ if (is_ret)
|
||||||
|
+ flags[insn] |= FLAG_RET;
|
||||||
|
+
|
||||||
|
+ if (is_exit)
|
||||||
|
+ flags[insn] |= FLAG_EXIT;
|
||||||
|
+
|
||||||
|
+ if (!(is_jmp || is_ret || is_exit))
|
||||||
|
+ flags[insn + insn_size] |= FLAG_INSN;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/* Scan a function body. Returns the position of the return sequence.
|
||||||
|
+ Sets *patch_bytes to the number of bytes that need to be copied from that
|
||||||
|
+ location. If no patching is required (ie. the return is the last insn)
|
||||||
|
+ *patch_bytes will be set to -1. *plen is the number of code bytes to copy.
|
||||||
|
+ */
|
||||||
|
+static int trace_i386_op(const char * name, uint8_t *start_p, int *plen,
|
||||||
|
+ int *patch_bytes, int *exit_addrs)
|
||||||
|
+{
|
||||||
|
+ char *flags;
|
||||||
|
+ int more;
|
||||||
|
+ int insn;
|
||||||
|
+ int retpos;
|
||||||
|
+ int bytes;
|
||||||
|
+ int num_exits;
|
||||||
|
+ int len;
|
||||||
|
+ int last_insn;
|
||||||
|
+
|
||||||
|
+ len = *plen;
|
||||||
|
+ flags = malloc(len + 1);
|
||||||
|
+ memset(flags, 0, len + 1);
|
||||||
|
+ flags[0] |= FLAG_INSN;
|
||||||
|
+ more = 1;
|
||||||
|
+ while (more) {
|
||||||
|
+ more = 0;
|
||||||
|
+ for (insn = 0; insn < len; insn++) {
|
||||||
|
+ if ((flags[insn] & (FLAG_INSN | FLAG_SCANNED)) == FLAG_INSN) {
|
||||||
|
+ trace_i386_insn(name, start_p, flags, insn, len);
|
||||||
|
+ more = 1;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Strip any unused code at the end of the function. */
|
||||||
|
+ while (len > 0 && flags[len - 1] == 0)
|
||||||
|
+ len--;
|
||||||
|
+
|
||||||
|
+ retpos = -1;
|
||||||
|
+ num_exits = 0;
|
||||||
|
+ last_insn = 0;
|
||||||
|
+ for (insn = 0; insn < len; insn++) {
|
||||||
|
+ if (flags[insn] & FLAG_RET) {
|
||||||
|
+ /* ??? In theory it should be possible to handle multiple return
|
||||||
|
+ points. In practice it's not worth the effort. */
|
||||||
|
+ if (retpos != -1)
|
||||||
|
+ error("Multiple return instructions in %s", name);
|
||||||
|
+ retpos = insn;
|
||||||
|
+ }
|
||||||
|
+ if (flags[insn] & FLAG_EXIT) {
|
||||||
|
+ if (num_exits == MAX_EXITS)
|
||||||
|
+ error("Too many block exits in %s", name);
|
||||||
|
+ exit_addrs[num_exits] = insn;
|
||||||
|
+ num_exits++;
|
||||||
|
+ }
|
||||||
|
+ if (flags[insn] & FLAG_INSN)
|
||||||
|
+ last_insn = insn;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ exit_addrs[num_exits] = -1;
|
||||||
|
+ if (retpos == -1) {
|
||||||
|
+ if (num_exits == 0) {
|
||||||
|
+ error ("No return instruction found in %s", name);
|
||||||
|
+ } else {
|
||||||
|
+ retpos = len;
|
||||||
|
+ last_insn = len;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* If the return instruction is the last instruction we can just
|
||||||
|
+ remove it. */
|
||||||
|
+ if (retpos == last_insn)
|
||||||
|
+ *patch_bytes = -1;
|
||||||
|
+ else
|
||||||
|
+ *patch_bytes = 0;
|
||||||
|
+
|
||||||
|
+ /* Back up over any nop instructions. */
|
||||||
|
+ while (retpos > 0
|
||||||
|
+ && (flags[retpos] & FLAG_TARGET) == 0
|
||||||
|
+ && (flags[retpos - 1] & FLAG_INSN) != 0
|
||||||
|
+ && start_p[retpos - 1] == 0x90) {
|
||||||
|
+ retpos--;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (*patch_bytes == -1) {
|
||||||
|
+ *plen = retpos;
|
||||||
|
+ free (flags);
|
||||||
|
+ return retpos;
|
||||||
|
+ }
|
||||||
|
+ *plen = len;
|
||||||
|
+
|
||||||
|
+ /* The ret is in the middle of the function. Find four more bytes that
|
||||||
|
+ so the ret can be replaced by a jmp. */
|
||||||
|
+ /* ??? Use a short jump where possible. */
|
||||||
|
+ bytes = 4;
|
||||||
|
+ insn = retpos + 1;
|
||||||
|
+ /* We can clobber everything up to the next jump target. */
|
||||||
|
+ while (insn < len && bytes > 0 && (flags[insn] & FLAG_TARGET) == 0) {
|
||||||
|
+ insn++;
|
||||||
|
+ bytes--;
|
||||||
|
+ }
|
||||||
|
+ if (bytes > 0) {
|
||||||
|
+ /* ???: Strip out nop blocks. */
|
||||||
|
+ /* We can't do the replacement without clobbering anything important.
|
||||||
|
+ Copy preceeding instructions(s) to give us some space. */
|
||||||
|
+ while (retpos > 0) {
|
||||||
|
+ /* If this byte is the target of a jmp we can't move it. */
|
||||||
|
+ if (flags[retpos] & FLAG_TARGET)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ (*patch_bytes)++;
|
||||||
|
+ bytes--;
|
||||||
|
+ retpos--;
|
||||||
|
+
|
||||||
|
+ /* Break out of the loop if we have enough space and this is either
|
||||||
|
+ the first byte of an instruction or a pad byte. */
|
||||||
|
+ if ((flags[retpos] & (FLAG_INSN | FLAG_SCANNED)) != FLAG_SCANNED
|
||||||
|
+ && bytes <= 0) {
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (bytes > 0)
|
||||||
|
+ error("Unable to replace ret with jmp in %s\n", name);
|
||||||
|
+
|
||||||
|
+ free(flags);
|
||||||
|
+ return retpos;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#define MAX_ARGS 3
|
||||||
|
|
||||||
|
/* generate op code */
|
||||||
|
@@ -1427,6 +2067,11 @@
|
||||||
|
uint8_t args_present[MAX_ARGS];
|
||||||
|
const char *sym_name, *p;
|
||||||
|
EXE_RELOC *rel;
|
||||||
|
+#if defined(HOST_I386) || defined(HOST_X86_64)
|
||||||
|
+ int patch_bytes;
|
||||||
|
+ int retpos;
|
||||||
|
+ int exit_addrs[MAX_EXITS];
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/* Compute exact size excluding prologue and epilogue instructions.
|
||||||
|
* Increment start_offset to skip epilogue instructions, then compute
|
||||||
|
@@ -1437,33 +2082,12 @@
|
||||||
|
p_end = p_start + size;
|
||||||
|
start_offset = offset;
|
||||||
|
#if defined(HOST_I386) || defined(HOST_X86_64)
|
||||||
|
-#ifdef CONFIG_FORMAT_COFF
|
||||||
|
- {
|
||||||
|
- uint8_t *p;
|
||||||
|
- p = p_end - 1;
|
||||||
|
- if (p == p_start)
|
||||||
|
- error("empty code for %s", name);
|
||||||
|
- while (*p != 0xc3) {
|
||||||
|
- p--;
|
||||||
|
- if (p <= p_start)
|
||||||
|
- error("ret or jmp expected at the end of %s", name);
|
||||||
|
- }
|
||||||
|
- copy_size = p - p_start;
|
||||||
|
- }
|
||||||
|
-#else
|
||||||
|
{
|
||||||
|
int len;
|
||||||
|
len = p_end - p_start;
|
||||||
|
- if (len == 0)
|
||||||
|
- error("empty code for %s", name);
|
||||||
|
- if (p_end[-1] == 0xc3) {
|
||||||
|
- len--;
|
||||||
|
- } else {
|
||||||
|
- error("ret or jmp expected at the end of %s", name);
|
||||||
|
- }
|
||||||
|
+ retpos = trace_i386_op(name, p_start, &len, &patch_bytes, exit_addrs);
|
||||||
|
copy_size = len;
|
||||||
|
}
|
||||||
|
-#endif
|
||||||
|
#elif defined(HOST_PPC)
|
||||||
|
{
|
||||||
|
uint8_t *p;
|
||||||
|
@@ -1675,6 +2299,13 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gen_switch == 2) {
|
||||||
|
+#if defined(HOST_I386) || defined(HOST_X86_64)
|
||||||
|
+ if (patch_bytes != -1)
|
||||||
|
+ copy_size += patch_bytes;
|
||||||
|
+#ifdef DEBUG_OP
|
||||||
|
+ copy_size += 2;
|
||||||
|
+#endif
|
||||||
|
+#endif
|
||||||
|
fprintf(outfile, "DEF(%s, %d, %d)\n", name + 3, nb_args, copy_size);
|
||||||
|
} else if (gen_switch == 1) {
|
||||||
|
|
||||||
|
@@ -1879,7 +2510,43 @@
|
||||||
|
#error unsupport object format
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
+ }
|
||||||
|
+ /* Replace the marker instructions with the actual opcodes. */
|
||||||
|
+ for (i = 0; exit_addrs[i] != -1; i++) {
|
||||||
|
+ int op;
|
||||||
|
+ switch (p_start[exit_addrs[i]])
|
||||||
|
+ {
|
||||||
|
+ case 0xf4: op = 0xc3; break; /* hlt -> ret */
|
||||||
|
+ case 0xfa: op = 0xe9; break; /* cli -> jmp */
|
||||||
|
+ case 0xfb: op = 0xe9; break; /* sti -> jmp */
|
||||||
|
+ default: error("Internal error");
|
||||||
|
+ }
|
||||||
|
+ fprintf(outfile,
|
||||||
|
+ " *(uint8_t *)(gen_code_ptr + %d) = 0x%x;\n",
|
||||||
|
+ exit_addrs[i], op);
|
||||||
|
}
|
||||||
|
+ /* Fix up the return instruction. */
|
||||||
|
+ if (patch_bytes != -1) {
|
||||||
|
+ if (patch_bytes) {
|
||||||
|
+ fprintf(outfile, " memcpy(gen_code_ptr + %d,"
|
||||||
|
+ "gen_code_ptr + %d, %d);\n",
|
||||||
|
+ copy_size, retpos, patch_bytes);
|
||||||
|
+ }
|
||||||
|
+ fprintf(outfile,
|
||||||
|
+ " *(uint8_t *)(gen_code_ptr + %d) = 0xe9;\n",
|
||||||
|
+ retpos);
|
||||||
|
+ fprintf(outfile,
|
||||||
|
+ " *(uint32_t *)(gen_code_ptr + %d) = 0x%x;\n",
|
||||||
|
+ retpos + 1, copy_size - (retpos + 5));
|
||||||
|
+
|
||||||
|
+ copy_size += patch_bytes;
|
||||||
|
+ }
|
||||||
|
+#ifdef DEBUG_OP
|
||||||
|
+ fprintf(outfile,
|
||||||
|
+ " *(uint16_t *)(gen_code_ptr + %d) = 0x9090;\n",
|
||||||
|
+ copy_size);
|
||||||
|
+ copy_size += 2;
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
#elif defined(HOST_X86_64)
|
||||||
|
{
|
||||||
|
@@ -1913,6 +2580,42 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ /* Replace the marker instructions with the actual opcodes. */
|
||||||
|
+ for (i = 0; exit_addrs[i] != -1; i++) {
|
||||||
|
+ int op;
|
||||||
|
+ switch (p_start[exit_addrs[i]])
|
||||||
|
+ {
|
||||||
|
+ case 0xf4: op = 0xc3; break; /* hlt -> ret */
|
||||||
|
+ case 0xfa: op = 0xe9; break; /* cli -> jmp */
|
||||||
|
+ case 0xfb: op = 0xe9; break; /* sti -> jmp */
|
||||||
|
+ default: error("Internal error");
|
||||||
|
+ }
|
||||||
|
+ fprintf(outfile,
|
||||||
|
+ " *(uint8_t *)(gen_code_ptr + %d) = 0x%x;\n",
|
||||||
|
+ exit_addrs[i], op);
|
||||||
|
+ }
|
||||||
|
+ /* Fix up the return instruction. */
|
||||||
|
+ if (patch_bytes != -1) {
|
||||||
|
+ if (patch_bytes) {
|
||||||
|
+ fprintf(outfile, " memcpy(gen_code_ptr + %d,"
|
||||||
|
+ "gen_code_ptr + %d, %d);\n",
|
||||||
|
+ copy_size, retpos, patch_bytes);
|
||||||
|
+ }
|
||||||
|
+ fprintf(outfile,
|
||||||
|
+ " *(uint8_t *)(gen_code_ptr + %d) = 0xe9;\n",
|
||||||
|
+ retpos);
|
||||||
|
+ fprintf(outfile,
|
||||||
|
+ " *(uint32_t *)(gen_code_ptr + %d) = 0x%x;\n",
|
||||||
|
+ retpos + 1, copy_size - (retpos + 5));
|
||||||
|
+
|
||||||
|
+ copy_size += patch_bytes;
|
||||||
|
+ }
|
||||||
|
+#ifdef DEBUG_OP
|
||||||
|
+ fprintf(outfile,
|
||||||
|
+ " *(uint16_t *)(gen_code_ptr + %d) = 0x9090;\n",
|
||||||
|
+ copy_size);
|
||||||
|
+ copy_size += 2;
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
#elif defined(HOST_PPC)
|
||||||
|
{
|
||||||
|
diff -ruN qemu-0.9.0/exec-all.h qemu-0.9.0-gcc4/exec-all.h
|
||||||
|
--- qemu-0.9.0/exec-all.h 2007-02-06 00:01:54.000000000 +0100
|
||||||
|
+++ qemu-0.9.0-gcc4/exec-all.h 2007-04-12 17:24:57.000000000 +0200
|
||||||
|
@@ -326,14 +326,15 @@
|
||||||
|
|
||||||
|
#elif defined(__i386__) && defined(USE_DIRECT_JUMP)
|
||||||
|
|
||||||
|
-/* we patch the jump instruction directly */
|
||||||
|
+/* we patch the jump instruction directly. Use sti in place of the actual
|
||||||
|
+ jmp instruction so that dyngen can patch in the correct result. */
|
||||||
|
#define GOTO_TB(opname, tbparam, n)\
|
||||||
|
do {\
|
||||||
|
asm volatile (".section .data\n"\
|
||||||
|
ASM_OP_LABEL_NAME(n, opname) ":\n"\
|
||||||
|
".long 1f\n"\
|
||||||
|
ASM_PREVIOUS_SECTION \
|
||||||
|
- "jmp " ASM_NAME(__op_jmp) #n "\n"\
|
||||||
|
+ "sti;.long " ASM_NAME(__op_jmp) #n " - 1f\n"\
|
||||||
|
"1:\n");\
|
||||||
|
} while (0)
|
||||||
|
|
@ -0,0 +1,95 @@ |
|||||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
||||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
||||||
|
#
|
||||||
|
# Filename: package/.../qemu/qemu-0.9.0-x86_64-opts.patch
|
||||||
|
# Copyright (C) 2007 The OpenSDE Project
|
||||||
|
#
|
||||||
|
# More information can be found in the files COPYING and README.
|
||||||
|
#
|
||||||
|
# This patch file is dual-licensed. It is available under the license the
|
||||||
|
# patched project is licensed under, as long as it is an OpenSource license
|
||||||
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
||||||
|
# of the GNU General Public License as published by the Free Software
|
||||||
|
# Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
# version.
|
||||||
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
||||||
|
|
||||||
|
2007-04-12 rediffed for qemu 0.9.0
|
||||||
|
|
||||||
|
2007-02-03 Gwenole Beauchesne <[email protected]>
|
||||||
|
|
||||||
|
* dyngen-exec.h (AREG4, AREG5): Enable when building with GCC4.
|
||||||
|
|
||||||
|
2005-06-04 Gwenole Beauchesne <[email protected]>
|
||||||
|
|
||||||
|
* Add direct jump support to x86-64.
|
||||||
|
|
||||||
|
diff -ruN qemu-0.9.0/dyngen-exec.h qemu-0.9.0-x86_64-opts/dyngen-exec.h
|
||||||
|
--- qemu-0.9.0/dyngen-exec.h 2007-02-06 00:01:54.000000000 +0100
|
||||||
|
+++ qemu-0.9.0-x86_64-opts/dyngen-exec.h 2007-04-12 17:32:09.000000000 +0200
|
||||||
|
@@ -95,8 +95,11 @@
|
||||||
|
#define AREG1 "rbx"
|
||||||
|
#define AREG2 "r12"
|
||||||
|
#define AREG3 "r13"
|
||||||
|
-//#define AREG4 "r14"
|
||||||
|
-//#define AREG5 "r15"
|
||||||
|
+#if __GNUC__ >= 4
|
||||||
|
+/* XXX: earlier GCC crashes */
|
||||||
|
+#define AREG4 "r14"
|
||||||
|
+#define AREG5 "r15"
|
||||||
|
+#endif
|
||||||
|
#endif
|
||||||
|
#ifdef __powerpc__
|
||||||
|
#define AREG0 "r27"
|
||||||
|
diff -ruN qemu-0.9.0/dyngen.c qemu-0.9.0-x86_64-opts/dyngen.c
|
||||||
|
--- qemu-0.9.0/dyngen.c 2007-02-06 00:01:54.000000000 +0100
|
||||||
|
+++ qemu-0.9.0-x86_64-opts/dyngen.c 2007-04-12 17:32:09.000000000 +0200
|
||||||
|
@@ -1891,6 +1891,17 @@
|
||||||
|
if (rel->r_offset >= start_offset &&
|
||||||
|
rel->r_offset < start_offset + copy_size) {
|
||||||
|
sym_name = strtab + symtab[ELFW(R_SYM)(rel->r_info)].st_name;
|
||||||
|
+ if (strstart(sym_name, "__op_jmp", &p)) {
|
||||||
|
+ int n;
|
||||||
|
+ n = strtol(p, NULL, 10);
|
||||||
|
+ /* __op_jmp relocations are done at
|
||||||
|
+ runtime to do translated block
|
||||||
|
+ chaining: the offset of the instruction
|
||||||
|
+ needs to be stored */
|
||||||
|
+ fprintf(outfile, " jmp_offsets[%d] = %d + (gen_code_ptr - gen_code_buf);\n",
|
||||||
|
+ n, rel->r_offset - start_offset);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
get_reloc_expr(name, sizeof(name), sym_name);
|
||||||
|
type = ELF32_R_TYPE(rel->r_info);
|
||||||
|
addend = rel->r_addend;
|
||||||
|
diff -ruN qemu-0.9.0/exec-all.h qemu-0.9.0-x86_64-opts/exec-all.h
|
||||||
|
--- qemu-0.9.0/exec-all.h 2007-02-06 00:01:54.000000000 +0100
|
||||||
|
+++ qemu-0.9.0-x86_64-opts/exec-all.h 2007-04-12 17:32:09.000000000 +0200
|
||||||
|
@@ -159,6 +159,9 @@
|
||||||
|
#if defined(__i386__) && !defined(_WIN32)
|
||||||
|
#define USE_DIRECT_JUMP
|
||||||
|
#endif
|
||||||
|
+#if defined(__x86_64__)
|
||||||
|
+#define USE_DIRECT_JUMP
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
typedef struct TranslationBlock {
|
||||||
|
target_ulong pc; /* simulated PC corresponding to this block (EIP + CS base) */
|
||||||
|
@@ -245,7 +248,7 @@
|
||||||
|
asm volatile ("sync" : : : "memory");
|
||||||
|
asm volatile ("isync" : : : "memory");
|
||||||
|
}
|
||||||
|
-#elif defined(__i386__)
|
||||||
|
+#elif defined(__i386__) || defined(__x86_64__)
|
||||||
|
static inline void tb_set_jmp_target1(unsigned long jmp_addr, unsigned long addr)
|
||||||
|
{
|
||||||
|
/* patch the branch destination */
|
||||||
|
@@ -324,7 +327,7 @@
|
||||||
|
"1:\n");\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
-#elif defined(__i386__) && defined(USE_DIRECT_JUMP)
|
||||||
|
+#elif (defined(__i386__) || defined(__x86_64__)) && defined(USE_DIRECT_JUMP)
|
||||||
|
|
||||||
|
/* we patch the jump instruction directly */
|
||||||
|
#define GOTO_TB(opname, tbparam, n)\
|
@ -3,7 +3,7 @@ |
|||||||
[COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
[COPY] This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
||||||
[COPY] |
[COPY] |
||||||
[COPY] Filename: package/.../qemu/qemu.desc |
[COPY] Filename: package/.../qemu/qemu.desc |
||||||
[COPY] Copyright (C) 2006 The OpenSDE Project |
[COPY] Copyright (C) 2006 - 2007 The OpenSDE Project |
||||||
[COPY] Copyright (C) 2004 - 2006 The T2 SDE Project |
[COPY] Copyright (C) 2004 - 2006 The T2 SDE Project |
||||||
[COPY] Copyright (C) 1998 - 2003 Clifford Wolf |
[COPY] Copyright (C) 1998 - 2003 Clifford Wolf |
||||||
[COPY] |
[COPY] |
||||||
@ -32,18 +32,12 @@ |
|||||||
|
|
||||||
[L] GPL |
[L] GPL |
||||||
[S] Stable |
[S] Stable |
||||||
[V] 0.8.2 |
[V] 0.9.0 |
||||||
[P] X -----5---9 207.000 |
[P] X -----5---9 207.000 |
||||||
|
|
||||||
[R] - powerpc64 |
[R] - powerpc64 |
||||||
|
|
||||||
[CV-URL] http://fabrice.bellard.free.fr/qemu/download.html |
[CV-URL] http://fabrice.bellard.free.fr/qemu/download.html |
||||||
|
|
||||||
[D] 1787237404 qemu-0.8.2.tar.gz http://fabrice.bellard.free.fr/qemu/ |
[D] 714776967 qemu-0.9.0.tar.gz http://fabrice.bellard.free.fr/qemu/ |
||||||
[D] X qvm86-20060101.tar.bz2 cvs://:pserver:[email protected]:/sources/qvm86 qvm86 -D 2006-01-01 |
[D] 1672904394 kqemu-1.3.0pre11.tar.gz http://fabrice.bellard.free.fr/qemu/ |
||||||
|
|
||||||
# from http://www.gibix.net/projects/qemu/ to build with gcc 4.x |
|
||||||
[D] 3769532801 qemu-0.7.0-gcc4.patch.bz2 http://gwenole.beauchesne.info/projects/qemu/files/ |
|
||||||
[D] 2602326157 qemu-0.7.2-dyngen-check-stack-clobbers.patch.bz2 http://gwenole.beauchesne.info/projects/qemu/files/ |
|
||||||
[D] 2569895554 qemu-0.8.0-gcc4-hacks.patch.bz2 http://gwenole.beauchesne.info/projects/qemu/files/ |
|
||||||
[D] 46274805 qemu-0.7.2-gcc4-opts.patch.bz2 http://gwenole.beauchesne.info/projects/qemu/files/ |
|
||||||
|
@ -1,268 +0,0 @@ |
|||||||
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
||||||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
||||||
#
|
|
||||||
# Filename: package/.../qemu/qvm86.kqemu130.patch
|
|
||||||
# Copyright (C) 2006 The OpenSDE Project
|
|
||||||
#
|
|
||||||
# More information can be found in the files COPYING and README.
|
|
||||||
#
|
|
||||||
# This patch file is dual-licensed. It is available under the license the
|
|
||||||
# patched project is licensed under, as long as it is an OpenSource license
|
|
||||||
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
|
||||||
# of the GNU General Public License as published by the Free Software
|
|
||||||
# Foundation; either version 2 of the License, or (at your option) any later
|
|
||||||
# version.
|
|
||||||
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
||||||
|
|
||||||
by Jim C. Brown <[email protected]>
|
|
||||||
http://lists.gnu.org/archive/html/qvm86-devel/2006-02/msg00000.html
|
|
||||||
|
|
||||||
diff -ur qvm86.orig/kqemu.h qvm86/kqemu.h
|
|
||||||
--- ./qvm86.orig/kqemu.h Thu Jul 28 12:22:55 2005
|
|
||||||
+++ ./qvm86/kqemu.h Tue Feb 14 20:45:43 2006
|
|
||||||
@@ -1,11 +1,7 @@
|
|
||||||
#ifndef KQEMU_H
|
|
||||||
#define KQEMU_H
|
|
||||||
|
|
||||||
-#ifdef _WIN32
|
|
||||||
-#define KQEMU_VERSION 0x010101
|
|
||||||
-#else
|
|
||||||
-#define KQEMU_VERSION 0x010000
|
|
||||||
-#endif
|
|
||||||
+#define KQEMU_VERSION 0x010300
|
|
||||||
|
|
||||||
struct kqemu_segment_cache {
|
|
||||||
uint32_t selector;
|
|
||||||
@@ -15,9 +11,13 @@
|
|
||||||
};
|
|
||||||
|
|
||||||
struct kqemu_cpu_state {
|
|
||||||
- uint32_t regs[8];
|
|
||||||
- uint32_t eip;
|
|
||||||
- uint32_t eflags;
|
|
||||||
+#ifdef __x86_64__
|
|
||||||
+ unsigned long regs[16];
|
|
||||||
+#else
|
|
||||||
+ unsigned long regs[8];
|
|
||||||
+#endif
|
|
||||||
+ unsigned long eip;
|
|
||||||
+ unsigned long eflags;
|
|
||||||
|
|
||||||
uint32_t dummy0, dummy1, dumm2, dummy3, dummy4;
|
|
||||||
|
|
||||||
@@ -27,31 +27,48 @@
|
|
||||||
struct kqemu_segment_cache gdt; /* only base and limit are used */
|
|
||||||
struct kqemu_segment_cache idt; /* only base and limit are used */
|
|
||||||
|
|
||||||
- uint32_t cr0;
|
|
||||||
- uint32_t dumm5;
|
|
||||||
- uint32_t cr2;
|
|
||||||
- uint32_t cr3;
|
|
||||||
- uint32_t cr4;
|
|
||||||
+ unsigned long cr0;
|
|
||||||
+ unsigned long dumm5;
|
|
||||||
+ unsigned long cr2;
|
|
||||||
+ unsigned long cr3;
|
|
||||||
+ unsigned long cr4;
|
|
||||||
uint32_t a20_mask;
|
|
||||||
|
|
||||||
- uint32_t dr0;
|
|
||||||
- uint32_t dr1;
|
|
||||||
- uint32_t dr2;
|
|
||||||
- uint32_t dr3;
|
|
||||||
- uint32_t dr6;
|
|
||||||
- uint32_t dr7;
|
|
||||||
+ uint32_t sysenter_cs;
|
|
||||||
+ uint32_t sysenter_esp;
|
|
||||||
+ uint32_t sysenter_eip;
|
|
||||||
+ uint64_t efer __attribute__((aligned(8)));
|
|
||||||
+ uint64_t star;
|
|
||||||
+#ifdef __x86_64__
|
|
||||||
+ unsigned long lstar;
|
|
||||||
+ unsigned long cstar;
|
|
||||||
+ unsigned long fmask;
|
|
||||||
+ unsigned long kernelgsbase;
|
|
||||||
+#endif
|
|
||||||
+ uint64_t tsc_offset;
|
|
||||||
+
|
|
||||||
+ unsigned long dr0;
|
|
||||||
+ unsigned long dr1;
|
|
||||||
+ unsigned long dr2;
|
|
||||||
+ unsigned long dr3;
|
|
||||||
+ unsigned long dr6;
|
|
||||||
+ unsigned long dr7;
|
|
||||||
|
|
||||||
- int cpl; /* currently only 3 */
|
|
||||||
+ uint8_t cpl; /* currently only 3 */
|
|
||||||
+ uint8_t user_only;
|
|
||||||
|
|
||||||
uint32_t error_code; /* error_code when exiting with an exception */
|
|
||||||
- uint32_t next_eip; /* next eip value when exiting with an interrupt */
|
|
||||||
+ unsigned long next_eip; /* next eip value when exiting with an interrupt */
|
|
||||||
unsigned int nb_pages_to_flush; /* number of pages to flush,
|
|
||||||
- KQEMU_FLUSH_ALL means full flush */
|
|
||||||
+ KQEMU_FLUSH_ALL means full flush */
|
|
||||||
#define KQEMU_MAX_PAGES_TO_FLUSH 512
|
|
||||||
#define KQEMU_FLUSH_ALL (KQEMU_MAX_PAGES_TO_FLUSH + 1)
|
|
||||||
-#ifdef _WIN32
|
|
||||||
- uint32_t retval;
|
|
||||||
-#endif
|
|
||||||
+ long retval;
|
|
||||||
+ unsigned int nb_ram_pages_to_update;
|
|
||||||
+ unsigned int nb_modified_ram_pages;
|
|
||||||
+#define KQEMU_MAX_RAM_PAGES_TO_UPDATE 512
|
|
||||||
+#define KQEMU_RAM_PAGES_UPDATE_ALL (KQEMU_MAX_RAM_PAGES_TO_UPDATE + 1)
|
|
||||||
+#define KQEMU_MAX_MODIFIED_RAM_PAGES 512
|
|
||||||
};
|
|
||||||
|
|
||||||
struct kqemu_init {
|
|
||||||
@@ -60,23 +77,28 @@
|
|
||||||
uint8_t *ram_dirty; /* must be page aligned */
|
|
||||||
uint32_t **phys_to_ram_map; /* must be page aligned */
|
|
||||||
unsigned long *pages_to_flush; /* must be page aligned */
|
|
||||||
+ unsigned long *ram_pages_to_update; /* must be page aligned */
|
|
||||||
+ unsigned long *modified_ram_pages; /* must be page aligned */
|
|
||||||
};
|
|
||||||
|
|
||||||
#define KQEMU_RET_ABORT (-1)
|
|
||||||
#define KQEMU_RET_EXCEPTION 0x0000 /* 8 low order bit are the exception */
|
|
||||||
#define KQEMU_RET_INT 0x0100 /* 8 low order bit are the interrupt */
|
|
||||||
#define KQEMU_RET_SOFTMMU 0x0200 /* emulation needed (I/O or
|
|
||||||
- unsupported INSN) */
|
|
||||||
+ unsupported INSN) */
|
|
||||||
#define KQEMU_RET_INTR 0x0201 /* interrupted by a signal */
|
|
||||||
+#define KQEMU_RET_SYSCALL 0x0300 /* syscall insn */
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#define KQEMU_EXEC CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
|
|
||||||
#define KQEMU_INIT CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
|
||||||
#define KQEMU_GET_VERSION CTL_CODE(FILE_DEVICE_UNKNOWN, 3, METHOD_BUFFERED, FILE_READ_ACCESS)
|
|
||||||
+#define KQEMU_MODIFY_RAM_PAGES CTL_CODE(FILE_DEVICE_UNKNOWN, 4, METHOD_BUFFERED, FILE_WRITE_ACCESS)
|
|
||||||
#else
|
|
||||||
#define KQEMU_EXEC _IOWR('q', 1, struct kqemu_cpu_state)
|
|
||||||
#define KQEMU_INIT _IOW('q', 2, struct kqemu_init)
|
|
||||||
#define KQEMU_GET_VERSION _IOR('q', 3, int)
|
|
||||||
+#define KQEMU_MODIFY_RAM_PAGES _IOW('q', 4, int)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* KQEMU_H */
|
|
||||||
diff -ur qvm86.orig/qvm86-host.c qvm86/qvm86-host.c
|
|
||||||
--- ./qvm86.orig/qvm86-host.c Tue Aug 23 20:14:20 2005
|
|
||||||
+++ ./qvm86/qvm86-host.c Tue Feb 14 20:57:01 2006
|
|
||||||
@@ -1209,9 +1209,19 @@
|
|
||||||
printk ("eax:%08x, ebx:%08x, ecx:%08x, edx:%08x\n", hostenv->regs[0], hostenv->regs[3], hostenv->regs[1], hostenv->regs[2]);
|
|
||||||
printk ("esi:%08x, edi:%08x, ebp:%08x, esp:%08x\n", hostenv->regs[6], hostenv->regs[7], hostenv->regs[5], hostenv->regs[4]);
|
|
||||||
}
|
|
||||||
+ /* Awwwww......................... bullshit */
|
|
||||||
+ if (hostenv->cpl == 0)
|
|
||||||
+ {
|
|
||||||
+ hostenv->retval = KQEMU_RET_SOFTMMU;
|
|
||||||
+ return KQEMU_RET_SOFTMMU;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
/* We currently assume paging is enabled. */
|
|
||||||
if ((hostenv->cr0 & 0x80000000) == 0)
|
|
||||||
+ {
|
|
||||||
+ hostenv->retval = KQEMU_RET_SOFTMMU;
|
|
||||||
return KQEMU_RET_SOFTMMU;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (qs->guest_cr3 != hostenv->cr3)
|
|
||||||
{
|
|
||||||
@@ -1252,11 +1262,15 @@
|
|
||||||
qvm86_clear_gdt_entries (qs, hostenv);
|
|
||||||
|
|
||||||
if (i == 0x20)
|
|
||||||
+ {
|
|
||||||
+ hostenv->retval = KQEMU_RET_SOFTMMU;
|
|
||||||
return KQEMU_RET_SOFTMMU;
|
|
||||||
+ }
|
|
||||||
else
|
|
||||||
{
|
|
||||||
hostenv->error_code = i & 0xf;
|
|
||||||
hostenv->cr2 = hostenv->segs[1].base + hostenv->eip;
|
|
||||||
+ hostenv->retval = KQEMU_RET_EXCEPTION + 14;
|
|
||||||
return KQEMU_RET_EXCEPTION + 14;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1308,7 +1322,10 @@
|
|
||||||
|
|
||||||
/* Bail out if something went wrong. */
|
|
||||||
if (qs->die)
|
|
||||||
+ {
|
|
||||||
+ hostenv->retval = KQEMU_RET_ABORT;
|
|
||||||
return KQEMU_RET_ABORT;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
profile_timer(0);
|
|
||||||
/* Setup monitor state. */
|
|
||||||
@@ -1365,6 +1382,7 @@
|
|
||||||
if (next_offset)
|
|
||||||
hostenv->next_eip = hostenv->eip + next_offset;
|
|
||||||
|
|
||||||
+ hostenv->retval = retval; /* for some reason kqemu.c requires this */
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1580,6 +1598,8 @@
|
|
||||||
qs->l1_phys_map = (uint32_t *) init->phys_to_ram_map;
|
|
||||||
qs->phys_ram_dirty = init->ram_dirty;
|
|
||||||
qs->pages_to_flush = init->pages_to_flush;
|
|
||||||
+ qs->ram_pages_to_update = init->ram_pages_to_update;
|
|
||||||
+ qs->modified_ram_pages = init->modified_ram_pages;
|
|
||||||
qvm86_init_shadow (qs);
|
|
||||||
qvm86_init_monitor_stack (qs);
|
|
||||||
qvm86_create_monitor_gdt (qs);
|
|
||||||
Only in qvm86: qvm86-host.o
|
|
||||||
diff -ur qvm86.orig/qvm86-linux.c qvm86/qvm86-linux.c
|
|
||||||
--- ./qvm86.orig/qvm86-linux.c Thu Jul 28 12:22:55 2005
|
|
||||||
+++ ./qvm86/qvm86-linux.c Tue Feb 14 20:14:15 2006
|
|
||||||
@@ -129,6 +129,7 @@
|
|
||||||
int ret;
|
|
||||||
struct page *page;
|
|
||||||
|
|
||||||
+ down_read(¤t->mm->mmap_sem);
|
|
||||||
ret = get_user_pages(current,
|
|
||||||
current->mm,
|
|
||||||
(unsigned long) useraddr,
|
|
||||||
@@ -138,6 +139,7 @@
|
|
||||||
&page,
|
|
||||||
NULL /* struct vm_area_struct *[] */
|
|
||||||
);
|
|
||||||
+ up_read(¤t->mm->mmap_sem);
|
|
||||||
/* TODO: error handling. */
|
|
||||||
if (ret != 1)
|
|
||||||
printk (KERN_ERR "qvm86: host_map_user failed\n");
|
|
||||||
@@ -231,6 +233,17 @@
|
|
||||||
case KQEMU_GET_VERSION:
|
|
||||||
if (put_user(KQEMU_VERSION, (int *)arg) < 0)
|
|
||||||
ret = -EFAULT;
|
|
||||||
+ break;
|
|
||||||
+
|
|
||||||
+// called by kqemu_modify_pages()
|
|
||||||
+// modified_ram_pages are the pages that qemu had changed (by writing to) and hence are dirty
|
|
||||||
+// for userspace (which we run directly) we could care less.
|
|
||||||
+// kqemu probabaly only needs this for -kernel-kqemu - pages in ring 0 which
|
|
||||||
+// contain code and are written to will need to be updated with the binary
|
|
||||||
+// translator. Since we don't do kernel mode (yet) we can safely ignore this.
|
|
||||||
+// Paul Brook: any ETA on real -kernel-kqemu support?
|
|
||||||
+
|
|
||||||
+ case KQEMU_MODIFY_RAM_PAGES:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
Only in qvm86: qvm86-linux.o
|
|
||||||
diff -ur qvm86.orig/qvm86.h qvm86/qvm86.h
|
|
||||||
--- ./qvm86.orig/qvm86.h Thu Jul 28 12:22:55 2005
|
|
||||||
+++ ./qvm86/qvm86.h Tue Feb 14 20:47:32 2006
|
|
||||||
@@ -217,6 +217,10 @@
|
|
||||||
/* Emulator dirty memory flags. */
|
|
||||||
uint8_t *phys_ram_dirty;
|
|
||||||
unsigned long *pages_to_flush;
|
|
||||||
+ /* What does this do??? */
|
|
||||||
+ unsigned long *ram_pages_to_update;
|
|
||||||
+ /* This isn't used, its needed for -kernel-kqemu only (not implemented yet) */
|
|
||||||
+ unsigned long *modified_ram_pages;
|
|
||||||
/* Satus of mapped-in host pages. */
|
|
||||||
qvm86_mapped_page *host_physmem_map;
|
|
||||||
|
|
@ -1,315 +0,0 @@ |
|||||||
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
|
||||||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
||||||
#
|
|
||||||
# Filename: package/.../qemu/qvm86.patch
|
|
||||||
# Copyright (C) 2006 The OpenSDE Project
|
|
||||||
#
|
|
||||||
# More information can be found in the files COPYING and README.
|
|
||||||
#
|
|
||||||
# This patch file is dual-licensed. It is available under the license the
|
|
||||||
# patched project is licensed under, as long as it is an OpenSource license
|
|
||||||
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
|
||||||
# of the GNU General Public License as published by the Free Software
|
|
||||||
# Foundation; either version 2 of the License, or (at your option) any later
|
|
||||||
# version.
|
|
||||||
# --- SDE-COPYRIGHT-NOTE-END ---
|
|
||||||
|
|
||||||
by AgBr <[email protected]>
|
|
||||||
http://lists.gnu.org/archive/html/qvm86-devel/2006-10/msg00000.html
|
|
||||||
|
|
||||||
diff -urN qemu-0.8.2/configure qemu-0.8.2-qvm86/configure
|
|
||||||
--- qemu-0.8.2/configure 2006-07-22 21:23:34.000000000 +0400
|
|
||||||
+++ qemu-0.8.2-qvm86/configure 2006-10-15 18:34:17.438159229 +0400
|
|
||||||
@@ -87,6 +87,8 @@
|
|
||||||
bsd="no"
|
|
||||||
linux="no"
|
|
||||||
kqemu="no"
|
|
||||||
+qvm86="no"
|
|
||||||
+kernel_module="no"
|
|
||||||
profiler="no"
|
|
||||||
kernel_path=""
|
|
||||||
cocoa="no"
|
|
||||||
@@ -107,6 +109,10 @@
|
|
||||||
;;
|
|
||||||
MINGW32*)
|
|
||||||
mingw32="yes"
|
|
||||||
+if [ "$cpu" = "i386" ] ; then
|
|
||||||
+ kqemu="yes"
|
|
||||||
+ qvm86="yes"
|
|
||||||
+fi
|
|
||||||
;;
|
|
||||||
FreeBSD)
|
|
||||||
bsd="yes"
|
|
||||||
@@ -136,6 +142,7 @@
|
|
||||||
user="yes"
|
|
||||||
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
|
|
||||||
kqemu="yes"
|
|
||||||
+ qvm86="yes"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
@@ -221,6 +228,8 @@
|
|
||||||
;;
|
|
||||||
--disable-kqemu) kqemu="no"
|
|
||||||
;;
|
|
||||||
+ --disable-qvm86) qvm86="no"
|
|
||||||
+ ;;
|
|
||||||
--enable-profiler) profiler="yes"
|
|
||||||
;;
|
|
||||||
--kernel-path=*) kernel_path="$optarg"
|
|
||||||
@@ -267,6 +276,7 @@
|
|
||||||
echo ""
|
|
||||||
echo "kqemu kernel acceleration support:"
|
|
||||||
echo " --disable-kqemu disable kqemu support"
|
|
||||||
+echo " --disable-qvm86 disable qvm86 build"
|
|
||||||
echo " --kernel-path=PATH set the kernel path (configure probes it)"
|
|
||||||
echo ""
|
|
||||||
echo "Advanced options (experts only):"
|
|
||||||
@@ -515,6 +525,64 @@
|
|
||||||
bindir="$prefix/bin"
|
|
||||||
fi
|
|
||||||
|
|
||||||
+# kqemu support
|
|
||||||
+if test $kqemu = "yes" ; then
|
|
||||||
+ # test if the source code is installed
|
|
||||||
+ if test '!' -f "kqemu/Makefile" ; then
|
|
||||||
+ kqemu="no"
|
|
||||||
+ fi
|
|
||||||
+fi
|
|
||||||
+if test $qvm86 = "yes" ; then
|
|
||||||
+ # test if the source code is installed
|
|
||||||
+ if test '!' -f "qvm86/Makefile" ; then
|
|
||||||
+ qvm86="no"
|
|
||||||
+ fi
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+if test $kqemu = "yes" -o $qvm86 = "yes" ; then
|
|
||||||
+ kernel_module=yes
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+# find the kernel path
|
|
||||||
+if test $kernel_module = "yes"; then
|
|
||||||
+if test "$linux" = "yes"; then
|
|
||||||
+if test -z "$kernel_path" ; then
|
|
||||||
+kernel_version=`uname -r`
|
|
||||||
+kernel_path="/lib/modules/$kernel_version/build"
|
|
||||||
+if test '!' -d "$kernel_path/include" ; then
|
|
||||||
+ kernel_path="/usr/src/linux"
|
|
||||||
+ if test '!' -d "$kernel_path/include" ; then
|
|
||||||
+ echo "Could not find kernel includes in /lib/modules or /usr/src/linux - cannot build the kernel module"
|
|
||||||
+ kernel_module="no"
|
|
||||||
+ fi
|
|
||||||
+fi
|
|
||||||
+fi
|
|
||||||
+fi # linux
|
|
||||||
+fi # kernel_module
|
|
||||||
+
|
|
||||||
+if test $kernel_module = yes; then
|
|
||||||
+if test "$linux" = "yes"; then
|
|
||||||
+
|
|
||||||
+# test that the kernel config is present
|
|
||||||
+if test '!' -f "$kernel_path/.config" ; then
|
|
||||||
+ echo "No .config file present in $kernel_path - kernel module cannot be built"
|
|
||||||
+ kernel_module="no";
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+# find build system (2.6 or legacy)
|
|
||||||
+kbuild26="yes"
|
|
||||||
+if grep -q "PATCHLEVEL = 4" $kernel_path/Makefile ; then
|
|
||||||
+kbuild26="no"
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
+fi # linux
|
|
||||||
+fi # kernel_module
|
|
||||||
+
|
|
||||||
+if test ! $kernel_module = "yes"; then
|
|
||||||
+ kqemu="no"
|
|
||||||
+ qvm86="no"
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
echo "Install prefix $prefix"
|
|
||||||
echo "BIOS directory $datadir"
|
|
||||||
echo "binary directory $bindir"
|
|
||||||
@@ -559,6 +627,20 @@
|
|
||||||
fi
|
|
||||||
echo "FMOD support $fmod $fmod_support"
|
|
||||||
echo "kqemu support $kqemu"
|
|
||||||
+echo "qvm86 support $qvm86"
|
|
||||||
+if test $kernel_module = "yes"; then
|
|
||||||
+if test "$linux" = "yes"; then
|
|
||||||
+echo ""
|
|
||||||
+echo "Kernel module configuration:"
|
|
||||||
+echo "kernel sources $kernel_path"
|
|
||||||
+echo -n "kbuild type "
|
|
||||||
+if test $kbuild26 = "yes"; then
|
|
||||||
+echo "2.6"
|
|
||||||
+else
|
|
||||||
+echo "2.4"
|
|
||||||
+fi
|
|
||||||
+fi
|
|
||||||
+fi
|
|
||||||
echo "Documentation $build_docs"
|
|
||||||
[ ! -z "$uname_release" ] && \
|
|
||||||
echo "uname -r $uname_release"
|
|
||||||
@@ -700,14 +782,26 @@
|
|
||||||
echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
|
|
||||||
echo "#define CONFIG_FMOD 1" >> $config_h
|
|
||||||
fi
|
|
||||||
-qemu_version=`head $source_path/VERSION`
|
|
||||||
-echo "VERSION=$qemu_version" >>$config_mak
|
|
||||||
-echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
|
|
||||||
-
|
|
||||||
-echo "SRC_PATH=$source_path" >> $config_mak
|
|
||||||
-if [ "$source_path_used" = "yes" ]; then
|
|
||||||
- echo "VPATH=$source_path" >> $config_mak
|
|
||||||
+echo -n "VERSION=" >>$config_mak
|
|
||||||
+head $source_path/VERSION >>$config_mak
|
|
||||||
+echo "" >>$config_mak
|
|
||||||
+echo -n "#define QEMU_VERSION \"" >> $config_h
|
|
||||||
+head $source_path/VERSION >> $config_h
|
|
||||||
+echo "\"" >> $config_h
|
|
||||||
+
|
|
||||||
+if test $kqemu = "yes" ; then
|
|
||||||
+ echo "CONFIG_KQEMU=yes" >> $config_mak
|
|
||||||
+fi
|
|
||||||
+if test $qvm86 = "yes" ; then
|
|
||||||
+ echo "CONFIG_QVM86=yes" >> $config_mak
|
|
||||||
+fi
|
|
||||||
+if test $kernel_module = "yes" ; then
|
|
||||||
+ echo "KERNEL_PATH=$kernel_path" >> $config_mak
|
|
||||||
+ if test "$kbuild26" = "yes" ; then
|
|
||||||
+ echo "CONFIG_KBUILD26=yes" >> $config_mak
|
|
||||||
+ fi
|
|
||||||
fi
|
|
||||||
+echo "SRC_PATH=$source_path" >> $config_mak
|
|
||||||
echo "TARGET_DIRS=$target_list" >> $config_mak
|
|
||||||
if [ "$build_docs" = "yes" ] ; then
|
|
||||||
echo "BUILD_DOCS=yes" >> $config_mak
|
|
||||||
@@ -788,7 +882,7 @@
|
|
||||||
echo "TARGET_ARCH=i386" >> $config_mak
|
|
||||||
echo "#define TARGET_ARCH \"i386\"" >> $config_h
|
|
||||||
echo "#define TARGET_I386 1" >> $config_h
|
|
||||||
- if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
|
|
||||||
+ if test $kernel_module = "yes" -a "$target_softmmu" = "yes" -a "$cpu" = "i386"; then
|
|
||||||
echo "#define USE_KQEMU 1" >> $config_h
|
|
||||||
fi
|
|
||||||
elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
|
|
||||||
diff -urN qemu-0.8.2/kqemu.c qemu-0.8.2-qvm86/kqemu.c
|
|
||||||
--- qemu-0.8.2/kqemu.c 2006-07-22 21:23:34.000000000 +0400
|
|
||||||
+++ qemu-0.8.2-qvm86/kqemu.c 2006-10-15 18:34:32.971225425 +0400
|
|
||||||
@@ -45,6 +45,7 @@
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include "kqemu.h"
|
|
||||||
+#include "qvm86/kqemu.h"
|
|
||||||
|
|
||||||
/* compatibility stuff */
|
|
||||||
#ifndef KQEMU_RET_SYSCALL
|
|
||||||
@@ -59,9 +60,9 @@
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
-#define KQEMU_DEVICE "\\\\.\\kqemu"
|
|
||||||
+#define KQEMU_DEVICE "\\\\.\\qvm86"
|
|
||||||
#else
|
|
||||||
-#define KQEMU_DEVICE "/dev/kqemu"
|
|
||||||
+#define KQEMU_DEVICE "/dev/qvm86"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
@@ -152,6 +153,8 @@
|
|
||||||
/* XXX: we could update more of the target CPUID state so that the
|
|
||||||
non accelerated code sees exactly the same CPU features as the
|
|
||||||
accelerated code */
|
|
||||||
+ /* Other flags not supported by qvm86 */
|
|
||||||
+ env->cpuid_features &= ~(CPUID_PAT | CPUID_PAE | CPUID_SEP);
|
|
||||||
}
|
|
||||||
|
|
||||||
int kqemu_init(CPUState *env)
|
|
||||||
@@ -236,6 +239,7 @@
|
|
||||||
env->kqemu_enabled = kqemu_allowed;
|
|
||||||
nb_pages_to_flush = 0;
|
|
||||||
nb_ram_pages_to_update = 0;
|
|
||||||
+ printf ("QEMU acceleration layer enabled\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff -urN qemu-0.8.2/Makefile qemu-0.8.2-qvm86/Makefile
|
|
||||||
--- qemu-0.8.2/Makefile 2006-07-22 21:23:34.000000000 +0400
|
|
||||||
+++ qemu-0.8.2-qvm86/Makefile 2006-10-15 18:34:13.967814690 +0400
|
|
||||||
@@ -26,7 +26,14 @@
|
|
||||||
endif
|
|
||||||
|
|
||||||
all: $(TOOLS) $(DOCS) recurse-all
|
|
||||||
-
|
|
||||||
+ifdef CONFIG_QVM86
|
|
||||||
+ifdef CONFIG_WIN32
|
|
||||||
+ $(MAKE) -C qvm86 -f Makefile.winnt
|
|
||||||
+else
|
|
||||||
+ $(MAKE) -C qvm86
|
|
||||||
+endif
|
|
||||||
+endif
|
|
||||||
+
|
|
||||||
subdir-%: dyngen$(EXESUF)
|
|
||||||
$(MAKE) -C $(subst subdir-,,$@) all
|
|
||||||
|
|
||||||
@@ -46,6 +53,16 @@
|
|
||||||
for d in $(TARGET_DIRS); do \
|
|
||||||
$(MAKE) -C $$d $@ || exit 1 ; \
|
|
||||||
done
|
|
||||||
+ifdef CONFIG_KQEMU
|
|
||||||
+ $(MAKE) -C kqemu clean
|
|
||||||
+endif
|
|
||||||
+ifdef CONFIG_QVM86
|
|
||||||
+ifdef CONFIG_WIN32
|
|
||||||
+ $(MAKE) -C qvm86 -f Makefile.winnt clean
|
|
||||||
+else
|
|
||||||
+ $(MAKE) -C qvm86 clean
|
|
||||||
+endif
|
|
||||||
+endif
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
rm -f config-host.mak config-host.h $(DOCS)
|
|
||||||
@@ -83,6 +100,12 @@
|
|
||||||
for d in $(TARGET_DIRS); do \
|
|
||||||
$(MAKE) -C $$d $@ || exit 1 ; \
|
|
||||||
done
|
|
||||||
+ifdef CONFIG_KQEMU
|
|
||||||
+ cd kqemu ; ./install.sh
|
|
||||||
+endif
|
|
||||||
+ifdef CONFIG_QVM86
|
|
||||||
+ cd qvm86 ; ./install.sh
|
|
||||||
+endif
|
|
||||||
|
|
||||||
# various test targets
|
|
||||||
test speed test2: all
|
|
||||||
diff -urN qemu-0.8.2/osdep.c qemu-0.8.2-qvm86/osdep.c
|
|
||||||
--- qemu-0.8.2/osdep.c 2006-07-22 21:23:34.000000000 +0400
|
|
||||||
+++ qemu-0.8.2-qvm86/osdep.c 2006-10-15 18:34:20.677547390 +0400
|
|
||||||
@@ -326,7 +326,7 @@
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
-#if defined(USE_KQEMU)
|
|
||||||
+#if 0 && defined(USE_KQEMU)
|
|
||||||
|
|
||||||
#include <sys/vfs.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
@@ -419,7 +419,7 @@
|
|
||||||
/* alloc shared memory pages */
|
|
||||||
void *qemu_vmalloc(size_t size)
|
|
||||||
{
|
|
||||||
-#if defined(USE_KQEMU)
|
|
||||||
+#if 0 && defined(USE_KQEMU)
|
|
||||||
if (kqemu_allowed)
|
|
||||||
return kqemu_vmalloc(size);
|
|
||||||
#endif
|
|
||||||
@@ -432,7 +432,7 @@
|
|
||||||
|
|
||||||
void qemu_vfree(void *ptr)
|
|
||||||
{
|
|
||||||
-#if defined(USE_KQEMU)
|
|
||||||
+#if 0 && defined(USE_KQEMU)
|
|
||||||
if (kqemu_allowed)
|
|
||||||
kqemu_vfree(ptr);
|
|
||||||
#endif
|
|
Loading…
Reference in new issue