📄 qemu-target-i386-dm
字号:
Index: ioemu/Makefile.target===================================================================--- ioemu.orig/Makefile.target 2007-05-11 10:00:33.000000000 +0100+++ ioemu/Makefile.target 2007-05-11 10:04:05.000000000 +0100@@ -65,6 +65,8 @@ QEMU_SYSTEM=qemu-fast endif +QEMU_SYSTEM=qemu-dm+ ifdef CONFIG_USER_ONLY PROGS=$(QEMU_USER) else@@ -321,6 +323,9 @@ OBJS+=gdbstub.o endif +# qemu-dm objects+LIBOBJS=helper2.o exec-dm.o i8259-dm.o+ all: $(PROGS) $(QEMU_USER): $(OBJS)@@ -381,7 +386,7 @@ ifeq ($(TARGET_BASE_ARCH), i386) # Hardware support VL_OBJS+= ide.o pckbd.o ps2.o vga.o $(SOUND_HW) dma.o $(AUDIODRV)-VL_OBJS+= fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o+VL_OBJS+= fdc.o mc146818rtc.o serial.o i8254.o pcspk.o pc.o VL_OBJS+= cirrus_vga.o mixeng.o apic.o parallel.o acpi.o piix_pci.o VL_OBJS+= usb-uhci.o smbus_eeprom.o CPPFLAGS += -DHAS_AUDIOIndex: ioemu/configure===================================================================--- ioemu.orig/configure 2007-05-11 10:00:33.000000000 +0100+++ ioemu/configure 2007-05-11 10:04:04.000000000 +0100@@ -426,6 +426,8 @@ if [ "$darwin_user" = "yes" ] ; then target_list="i386-darwin-user ppc-darwin-user $target_list" fi+# the i386-dm target+ target_list="i386-dm" else target_list=`echo "$target_list" | sed -e 's/,/ /g'` fiIndex: ioemu/monitor.c===================================================================--- ioemu.orig/monitor.c 2007-05-11 10:00:33.000000000 +0100+++ ioemu/monitor.c 2007-05-11 10:04:06.000000000 +0100@@ -1325,6 +1325,10 @@ "", "show which guest mouse is receiving events" }, { "vnc", "", do_info_vnc, "", "show the vnc server status"},+#ifdef CONFIG_DM+ { "hvmiopage", "", sp_info,+ "", "show HVM device model shared page info" },+#endif /* CONFIG_DM */ { NULL, NULL, }, }; Index: ioemu/vl.c===================================================================--- ioemu.orig/vl.c 2007-05-11 10:00:33.000000000 +0100+++ ioemu/vl.c 2007-05-11 10:04:06.000000000 +0100@@ -88,7 +88,7 @@ #include "exec-all.h" -#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"+#define DEFAULT_NETWORK_SCRIPT "/etc/xen/qemu-ifup" #ifdef __sun__ #define SMBD_COMMAND "/usr/sfw/sbin/smbd" #else@@ -5805,7 +5805,7 @@ static QEMUResetEntry *first_reset_entry; static int reset_requested;-static int shutdown_requested;+int shutdown_requested; static int powerdown_requested; void qemu_register_reset(QEMUResetHandler *func, void *opaque)@@ -5957,6 +5957,7 @@ qemu_get_clock(rt_clock)); } +#ifndef CONFIG_DM static CPUState *cur_cpu; int main_loop(void)@@ -6031,6 +6032,7 @@ cpu_disable_ticks(); return ret; }+#endif /* !CONFIG_DM */ void help(void) {Index: ioemu/vl.h===================================================================--- ioemu.orig/vl.h 2007-05-11 10:00:33.000000000 +0100+++ ioemu/vl.h 2007-05-11 10:04:06.000000000 +0100@@ -37,6 +37,8 @@ #include <unistd.h> #include <fcntl.h> #include <sys/stat.h>+#include "xenctrl.h"+#include "xs.h" #ifndef O_LARGEFILE #define O_LARGEFILE 0@@ -144,6 +146,11 @@ void main_loop_wait(int timeout); +extern FILE *logfile;++extern int xc_handle;+extern int domid;+ extern int ram_size; extern int bios_size; extern int rtc_utc;@@ -1023,6 +1030,7 @@ uint32_t pic_intack_read(PicState2 *s); void pic_info(void); void irq_info(void);+void sp_info(void); /* APIC */ typedef struct IOAPICState IOAPICState;Index: ioemu/target-i386-dm/cpu.h===================================================================--- /dev/null 1970-01-01 00:00:00.000000000 +0000+++ ioemu/target-i386-dm/cpu.h 2007-05-11 10:04:06.000000000 +0100@@ -0,0 +1,84 @@+/*+ * i386 virtual CPU header+ * + * Copyright (c) 2003 Fabrice Bellard+ *+ * This library is free software; you can redistribute it and/or+ * modify it under the terms of the GNU Lesser General Public+ * License as published by the Free Software Foundation; either+ * version 2 of the License, or (at your option) any later version.+ *+ * This library is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+ * Lesser General Public License for more details.+ *+ * You should have received a copy of the GNU Lesser General Public+ * License along with this library; if not, write to the Free Software+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA+ */+#ifndef CPU_I386_H+#define CPU_I386_H++#include "config.h"++#ifdef TARGET_X86_64+#define TARGET_LONG_BITS 64+#else+#define TARGET_LONG_BITS 32+#endif++/* target supports implicit self modifying code */+#define TARGET_HAS_SMC+/* support for self modifying code even if the modified instruction is+ close to the modifying instruction */+#define TARGET_HAS_PRECISE_SMC++#include "cpu-defs.h"++#include "softfloat.h"++#if defined(__i386__) && !defined(CONFIG_SOFTMMU)+#define USE_CODE_COPY+#endif++#ifdef USE_X86LDOUBLE+typedef floatx80 CPU86_LDouble;+#else+typedef float64 CPU86_LDouble;+#endif++/* Empty for now */+typedef struct CPUX86State {+ uint32_t a20_mask;++ int interrupt_request;++ CPU_COMMON+} CPUX86State;++CPUX86State *cpu_x86_init(void);+int cpu_x86_exec(CPUX86State *s);+void cpu_x86_close(CPUX86State *s);+int cpu_get_pic_interrupt(CPUX86State *s);+/* MSDOS compatibility mode FPU exception support */+void cpu_set_ferr(CPUX86State *s);++void cpu_x86_set_a20(CPUX86State *env, int a20_state);++#ifndef IN_OP_I386+void cpu_x86_outb(CPUX86State *env, int addr, int val);+void cpu_x86_outw(CPUX86State *env, int addr, int val);+void cpu_x86_outl(CPUX86State *env, int addr, int val);+int cpu_x86_inb(CPUX86State *env, int addr);+int cpu_x86_inw(CPUX86State *env, int addr);+int cpu_x86_inl(CPUX86State *env, int addr);+#endif++/* helper2.c */+int main_loop(void);++#define TARGET_PAGE_BITS 12+#include "cpu-all.h"++#endif /* CPU_I386_H */Index: ioemu/target-i386-dm/exec-dm.c===================================================================--- /dev/null 1970-01-01 00:00:00.000000000 +0000+++ ioemu/target-i386-dm/exec-dm.c 2007-05-11 10:04:04.000000000 +0100@@ -0,0 +1,545 @@+/*+ * virtual page mapping and translated block handling+ * + * Copyright (c) 2003 Fabrice Bellard+ *+ * This library is free software; you can redistribute it and/or+ * modify it under the terms of the GNU Lesser General Public+ * License as published by the Free Software Foundation; either+ * version 2 of the License, or (at your option) any later version.+ *+ * This library is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+ * Lesser General Public License for more details.+ *+ * You should have received a copy of the GNU Lesser General Public+ * License along with this library; if not, write to the Free Software+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA+ */+#include "config.h"+#ifdef _WIN32+#include <windows.h>+#else+#include <sys/types.h>+#include <sys/mman.h>+#endif+#include <stdlib.h>+#include <stdio.h>+#include <stdarg.h>+#include <string.h>+#include <errno.h>+#include <unistd.h>+#include <inttypes.h>++#include <xen/hvm/e820.h>++#include "cpu.h"+#include "exec-all.h"++//#define DEBUG_TB_INVALIDATE+//#define DEBUG_FLUSH+//#define DEBUG_TLB++/* make various TB consistency checks */+//#define DEBUG_TB_CHECK +//#define DEBUG_TLB_CHECK ++#ifndef CONFIG_DM+/* threshold to flush the translated code buffer */+#define CODE_GEN_BUFFER_MAX_SIZE (CODE_GEN_BUFFER_SIZE - CODE_GEN_MAX_SIZE)++#define SMC_BITMAP_USE_THRESHOLD 10++#define MMAP_AREA_START 0x00000000+#define MMAP_AREA_END 0xa8000000++TranslationBlock tbs[CODE_GEN_MAX_BLOCKS];+TranslationBlock *tb_hash[CODE_GEN_HASH_SIZE];+TranslationBlock *tb_phys_hash[CODE_GEN_PHYS_HASH_SIZE];+int nb_tbs;+/* any access to the tbs or the page table must use this lock */+spinlock_t tb_lock = SPIN_LOCK_UNLOCKED;++uint8_t code_gen_buffer[CODE_GEN_BUFFER_SIZE];+uint8_t *code_gen_ptr;+#endif /* !CONFIG_DM */++uint64_t phys_ram_size;+extern uint64_t ram_size;+int phys_ram_fd;+uint8_t *phys_ram_base;+uint8_t *phys_ram_dirty;++CPUState *first_cpu;+/* current CPU in the current thread. It is only valid inside+ cpu_exec() */+CPUState *cpu_single_env; ++typedef struct PageDesc {+ /* list of TBs intersecting this ram page */+ TranslationBlock *first_tb;+ /* in order to optimize self modifying code, we count the number+ of lookups we do to a given page to use a bitmap */+ unsigned int code_write_count;+ uint8_t *code_bitmap;+#if defined(CONFIG_USER_ONLY)+ unsigned long flags;+#endif+} PageDesc;++typedef struct PhysPageDesc {+ /* offset in host memory of the page + io_index in the low 12 bits */+ unsigned long phys_offset;+} PhysPageDesc;++typedef struct VirtPageDesc {+ /* physical address of code page. It is valid only if 'valid_tag'+ matches 'virt_valid_tag' */ + target_ulong phys_addr; + unsigned int valid_tag;+#if !defined(CONFIG_SOFTMMU)+ /* original page access rights. It is valid only if 'valid_tag'+ matches 'virt_valid_tag' */+ unsigned int prot;+#endif+} VirtPageDesc;++#define L2_BITS 10+#define L1_BITS (32 - L2_BITS - TARGET_PAGE_BITS)++#define L1_SIZE (1 << L1_BITS)+#define L2_SIZE (1 << L2_BITS)++unsigned long qemu_real_host_page_size;+unsigned long qemu_host_page_bits;+unsigned long qemu_host_page_size;+unsigned long qemu_host_page_mask;++/* io memory support */+CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4];+CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4];+void *io_mem_opaque[IO_MEM_NB_ENTRIES];+static int io_mem_nb = 1;++/* log support */+char *logfilename = "/tmp/qemu.log";+FILE *logfile;+int loglevel;++void cpu_exec_init(CPUState *env)+{+ CPUState **penv;+ int cpu_index;++ env->next_cpu = NULL;+ penv = &first_cpu;+ cpu_index = 0;+ while (*penv != NULL) {+ penv = (CPUState **)&(*penv)->next_cpu;+ cpu_index++;+ }+ env->cpu_index = cpu_index;+ *penv = env;++ /* alloc dirty bits array */+ phys_ram_dirty = qemu_malloc(phys_ram_size >> TARGET_PAGE_BITS);+}++/* enable or disable low levels log */+void cpu_set_log(int log_flags)+{+ loglevel = log_flags;+ if (!logfile) {+ logfile = fopen(logfilename, "w");+ if (!logfile) {+ perror(logfilename);+ _exit(1);+ }+#if !defined(CONFIG_SOFTMMU)+ /* must avoid mmap() usage of glibc by setting a buffer "by hand" */+ {+ static uint8_t logfile_buf[4096];+ setvbuf(logfile, logfile_buf, _IOLBF, sizeof(logfile_buf));+ }+#else+ setvbuf(logfile, NULL, _IOLBF, 0);+#endif+ stdout = logfile;+ stderr = logfile;+ }+}++void cpu_set_log_filename(const char *filename)+{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -