extern QEMUMachine pc_machine;
extern QEMUMachine isapc_machine;
+/* Xen */
+extern QEMUMachine xenpv_machine;
+extern QEMUMachine xenfv_machine;
+
/* ppc.c */
extern QEMUMachine prep_machine;
extern QEMUMachine core99_machine;
#include "config.h"
+struct CPUX86State;
+
#ifdef TARGET_X86_64
#define TARGET_LONG_BITS 64
#else
close to the modifying instruction */
#define TARGET_HAS_PRECISE_SMC
+/* MMU modes definitions
+ */
+/* We aren't handling the MMU in Qemu; all the addresses we deal with
+ * are guest physical. So as far as qemu
+ * is concerned there is only the one MMU mode.
+ */
+#define NB_MMU_MODES 1
+#define MMU_MODE0_SUFFIX _xen
+static inline int cpu_mmu_index(struct CPUX86State *env) { return 0; }
+
#include "cpu-defs.h"
#ifdef CONFIG_SOFTFLOAT
#endif
#endif
-#define NB_MMU_MODES 2
+typedef struct SegmentCache {
+ uint32_t selector;
+ target_ulong base;
+ uint32_t limit;
+ uint32_t flags;
+} SegmentCache;
/* Empty for now */
typedef struct CPUX86State {
#define cpu_exec cpu_x86_exec
#define cpu_gen_code cpu_x86_gen_code
#define cpu_signal_handler cpu_x86_signal_handler
-#define cpu_list x86_cpu_list
-
-/* MMU modes definitions */
-#define MMU_MODE0_SUFFIX _kernel
-#define MMU_MODE1_SUFFIX _user
-#define MMU_USER_IDX 1
-static inline int cpu_mmu_index (CPUState *env)
-{
- return (env->hflags & HF_CPL_MASK) == 3 ? 1 : 0;
-}
#include "cpu-all.h"
OBJS += $(SOUND_HW) $(AUDIODRV) mixeng.o
CPPFLAGS += -DHAS_AUDIO
QEMU_PROG=qemu-dm
+include ../xen-hooks.mak
#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
+#include "xen-vl-extra.c"
+
/***********************************************************/
/* x86 ISA bus support */
fprintf(stderr, "\n");
for(env = first_cpu; env != NULL; env = env->next_cpu) {
fprintf(stderr, "CPU #%d:\n", env->cpu_index);
-#ifdef TARGET_I386
+#if defined(TARGET_I386) && !defined(CONFIG_DM)
cpu_dump_state(env, stderr, fprintf, X86_DUMP_FPU);
#else
cpu_dump_state(env, stderr, fprintf, 0);
static int unix_start_timer(struct qemu_alarm_timer *t);
static void unix_stop_timer(struct qemu_alarm_timer *t);
-#ifdef __linux__
+#if defined(__linux__) && !defined(CONFIG_DM)
static int dynticks_start_timer(struct qemu_alarm_timer *t);
static void dynticks_stop_timer(struct qemu_alarm_timer *t);
static struct qemu_alarm_timer alarm_timers[] = {
#ifndef _WIN32
-#ifdef __linux__
+#if defined(__linux__) && !defined(CONFIG_DM)
{"dynticks", ALARM_FLAG_DYNTICKS, dynticks_start_timer,
dynticks_stop_timer, dynticks_rearm_timer, NULL},
/* HPET - if available - is preferred */
if (cpu_ticks_enabled) {
hw_error("cannot save state if virtual timers are running");
}
+#ifndef CONFIG_DM
qemu_put_be64(f, cpu_ticks_offset);
qemu_put_be64(f, ticks_per_sec);
+#endif
qemu_put_be64(f, cpu_clock_offset);
}
if (cpu_ticks_enabled) {
return -EINVAL;
}
+#ifndef CONFIG_DM
cpu_ticks_offset=qemu_get_be64(f);
ticks_per_sec=qemu_get_be64(f);
if (version_id == 2) {
+#else
+ if (version_id == 1 || version_id == 2) {
+#endif
cpu_clock_offset=qemu_get_be64(f);
}
return 0;
}
+#ifndef CONFIG_DM
#ifdef _WIN32
void CALLBACK host_alarm_handler(UINT uTimerID, UINT uMsg,
DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2)
}
#endif /* _WIN32 */
+#endif /* !CONFIG_DM */
static void init_timer_alarm(void)
{
return ret;
}
+#ifndef CONFIG_DM
+
void do_savevm(const char *name)
{
BlockDriverState *bs, *bs1;
vm_start();
}
+#endif /* !CONFIG_DM */
+
void do_delvm(const char *name)
{
BlockDriverState *bs, *bs1;
/***********************************************************/
/* cpu save/restore */
-#if defined(TARGET_I386)
+#if defined(CONFIG_DM)
+void cpu_save(QEMUFile *f, void *opaque) { }
+int cpu_load(QEMUFile *f, void *opaque, int version_id) { return 0; }
+#elif defined(TARGET_I386)
static void cpu_put_seg(QEMUFile *f, SegmentCache *dt)
{
/***********************************************************/
/* ram save/restore */
+#ifdef CONFIG_DM
+static void ram_save(QEMUFile *f, void *opaque) { }
+static int ram_load(QEMUFile *f, void *opaque, int version_id) { return 0; }
+#else /* !CONFIG_DM */
+
static int ram_get_page(QEMUFile *f, uint8_t *buf, int len)
{
int v;
return 0;
}
+#endif /* !CONFIG_DM */
+
/***********************************************************/
/* bottom halves (can be seen as timers which expire ASAP) */
}
+#ifndef CONFIG_DM
+
static int main_loop(void)
{
int ret, timeout;
cpu_disable_ticks();
return ret;
}
+#endif /* !CONFIG_DM */
static void help(int exitcode)
{
/* XXX: currently we cannot use simultaneously different CPUs */
static void register_machines(void)
{
-#if defined(TARGET_I386)
+#if defined(CONFIG_DM)
+ qemu_register_machine(&xenfv_machine);
+ qemu_register_machine(&xenpv_machine);
+#elif defined(TARGET_I386)
qemu_register_machine(&pc_machine);
qemu_register_machine(&isapc_machine);
#elif defined(TARGET_PPC)
#ifdef HAS_AUDIO
struct soundhw soundhw[] = {
#ifdef HAS_AUDIO_CHOICE
-#ifdef TARGET_I386
+#if defined(TARGET_I386) && !defined(CONFIG_DM)
{
"pcspk",
"PC speaker",
vlan->id);
}
-#ifdef TARGET_I386
+#if defined(TARGET_I386) && !defined(CONFIG_DM)
/* XXX: this should be moved in the PC machine instantiation code */
if (net_boot != 0) {
int netroms = 0;
--- /dev/null
+ 1 cd work/qemu-iwj.git/
+ 2 git status
+ 3 emacs19&
+ 4 emacs&
+ 5 ./configure
+ 6 git status
+ 7 ls i386
+ 8 ls i386-d
+ 9 ls i386-dm/
+ 10 PATH=~/junk/tricks:$PATH
+ 11 ./configure
+ 12 git status
+ 13 make -C i386-dm
+ 14 ll i386-d
+ 15 ll i386-dm/
+ 16 ./xen-dm-make-target-dir i386-dm/
+ 17 ls i386d-
+ 18 ls i386-d
+ 19 ls i386-dm/
+ 20 rm i386-dm/xen-*
+ 21 make -C i386-dm
+ 22 ls i386-dm/
+ 23 ll -L i386-dm/
+ 24 ll i386-dm/
+ 25 ll xen-config.mak
+ 26 xterm&
+ 27 ls -L i386-dm/
+ 28 ls -l -L i386-dm/
+ 29 ls -l i386-dm/
+ 30 ls -l xen-config.mak
+ 31 dpkg -S `/bin/ls`
+ 32 dpkg -S `type -p /bin/ls`
+ 33 dkpg -s coreutils
+ 34 dpkg -s coreutils
+ 35 ls
+ 36 less i386-softmmu/config.mak
+ 37 less loader.c
+ 38 mkdir i386-stubdom
+ 39 rm i386-dm/config.mak
+ 40 rm i386-dm/hooks.mak
+ 41 ll xen*
+ 42 ll xen*[!~]
+ 43 ll hw/xen*[!~]
+ 44 make -C i386-dm
+ 45 ls i386-dm
+ 46 ls i386-stubdom/
+ 47 cat i386-stubdom/config.mak
+ 48 make -C i386-dm XENROOT=../xen-unstable.hg
+ 49 mv xen-dm-make-target-dir xen-make-target-dir
+ 50 rm xen-dm-make-target-dir~
+ 51 ./xen-make-target-dir i386-dm
+ 52 make -C i386-dm XEN_ROOT=../xen-unstable.hg
+ 53 make -C i386-dm XEN_ROOT=../../xen-unstable.hg
+ 54 make -C i386-dm XEN_ROOT=../../xen-unstable.hg
+ 55 ll i386-softmmu/config.
+ 56 ll i386-softmmu/config.mak
+ 57 less i386-softmmu/config.mak
+ 58 less config-host.mak
+ 59 make -C i386-dm XEN_ROOT=../../xen-unstable.hg
+ 60 find -name cpu.h
+ 61 git status target-i386/cpu.h
+ 62 git ann target-i386/cpu.h
+ 63 git blame target-i386/cpu.h
+ 64 make -C i386-dm XEN_ROOT=../../xen-unstable.hg
+ 65 find -name config.h
+ 66 less i386-softmmu/config.h
+ 67 make -C i386-dm XEN_ROOT=../../xen-unstable.hg 2>&1 |head -40
+ 68 hg status
+ 69 git status
+ 70 mkdir ../old-qemu-test
+ 71 mv floppy.bin big.bin before.png history image.cow initrd* middle.png now.bin strace-grep-history t test.img ../old-qemu-test/
+ 72 rm *.rej
+ 73 rm *.orig
+ 74 rm */*.orig
+ 75 rm */*.rej
+ 76 git status
+ 77 git branch
+ 78 git-add i386-dm/config.yh
+ 79 git-add i386-dm/config.h
+ 80 git-add i386-dm/config.mak
+ 81 git-add i386-dm/hooks.mak
+ 82 git-add i386-dm/cpu.h
+ 83 git status
+ 84 git add hw/xen*.c
+ 85 git-add xen-*.mak
+ 86 git-add xen-make-target-dir xenstore.c
+ 87 git status
+ 88 git-add hw/xen_console.h hw/xenfb.h i386-stubdom/hooks.mak
+ 89 git-add i386-stubdom/config.mak
+ 90 git status
+ 91 git status
+ 92 git ci -m 'wip xen landing from xen-unstable 17192:59b8768d0d0d'
+ 93 git ci -m 'wip xen landing from xen-unstable 17192:59b8768d0d0d'
+ 94 git-commit -a -m 'wip xen landing from xen-unstable 17192:59b8768d0d0d'
+ 95 git-status
+ 96 make -C i386-dm XEN_ROOT=../../xen-unstable.hg 2>&1 |head -40
+ 97 make -C i386-dm XEN_ROOT=../../xen-unstable.hg 2>&1 |head -40
+ 98 xterm&
+ 99 make -C i386-dm XEN_ROOT=../../xen-unstable.hg 2>&1 |head -40
+ 100 make -C i386-dm XEN_ROOT=../../xen-unstable.hg 2>&1 |head -40
+ 101 make -C i386-dm XEN_ROOT=../../xen-unstable.hg 2>&1 |head -40
+ 102 make -C i386-dm XEN_ROOT=../../xen-unstable.hg 2>&1 |head -40
+ 103 make -C i386-dm XEN_ROOT=../../xen-unstable.hg 2>&1 |head -40
+ 104 git-status
+ 105 git-commit -a -m 'WIP make xen compile'
+ 106 git-branch
+ 107 git-checkout master
+ 108 git-log
+ 109 fgrep '()' *.c
+ 110 fgrep '()' *.c |less
+ 111 fgrep '^[^ ].*()' *.c |less
+ 112 egrep '^[^ ].*()' *.c |less
+ 113 egrep '^[^ ].*\(\)' *.c |less
+ 114 egrep '^[^ ].*\(\)' *.c |less
+ 115 egrep '^[^ \t].*\(\)' *.c |less
+ 116 egrep '^[^ ].*\(\)' *.c |less
+ 117 egrep '^[^ ].*\(\)' *.c |less
+ 118 git-status
+ 119 git-diff
+ 120 egrep '^[^ ].*\(\)' */*.c |less
+ 121 egrep '^[^ ].*\(\)' */*.[ch] |less
+ 122 grep pic_info *.c
+ 123 grep pic_info *.[ch]
+ 124 git-diff
+ 125 git-diff
+ 126 egrep '^[^ ].*\(\)' */*.[ch] |less
+ 127 egrep '^[^ ].*\(\)' */*.[ch] |less
+ 128 grep helper *.[ch]
+ 129 less hostregs_helper.h
+ 130 grep single_step *.[ch]
+ 131 grep helper_cpuid *.[ch]
+ 132 grep helper_cpuid */*.[ch]
+ 133 grep helper_single_step */*.[ch]
+ 134 egrep '^[^ ].*\(\)' */*.[ch] |less
+ 135 egrep '^[^ ].*\(\)' */*.[ch] |less
+ 136 git-diff
+ 137 make clean
+ 138 echo $PATH
+ 139 ./configure
+ 140 make -j4
+ 141 git-diff >../Patches/qemu-void-prototypes.patch
+ 142 git-commit -a
+ 143 git-status
+ 144 git-branch
+ 145 git-checkout xen
+ 146 git-pull master
+ 147 git-pull . master
+ 148 git-status
+ 149 git-diff
+ 150 git-diff HEAD
+ 151 git-lo
+ 152 git-log
+ 153 make clean
+ 154 ./xen-make-target-dir i386-dm
+ 155 make -C i386-dm XEN_ROOT=../../xen-unstable.hg 2>&1 |head -40
+ 156 find -name helper2.c
+ 157 grep phys_ram_addr */*.c
+ 158 grep qemu_map_cache */*.c
+ 159 make -C i386-dm XEN_ROOT=../../xen-unstable.hg 2>&1 |head -40
+ 160 grep SegmentCache */*.c
+ 161 grep SegmentCache */*.[ch]
+ 162 make -C i386-dm XEN_ROOT=../../xen-unstable.hg 2>&1 |head -40
+ 163 git-diff
+ 164 git-diff
+ 165 git-diff
+ 166 make -C i386-dm XEN_ROOT=../../xen-unstable.hg 2>&1 |head -40
+ 167 gcc -I. -I.. -I/u/iwj/work/qemu-iwj.git/target- -I/u/iwj/work/qemu-iwj.git -MMD -MP -DNEED_CPU_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DHAS_AUDIO -I/u/iwj/work/qemu-iwj.git/tcg -I/u/iwj/work/qemu-iwj.git/tcg/i386 -I/u/iwj/work/qemu-iwj.git/fpu -I/u/iwj/work/qemu-iwj.git/slirp -Wall -O2 -g -fno-strict-aliasing -m32 -march=i686 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -D__XEN_TOOLS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -mno-tls-direct-seg-refs -m32 -c -o vl.o /u/iwj/work/qemu-iwj.git/vl.c
+ 168 gcc -I. -I.. -I/u/iwj/work/qemu-iwj.git/target- -I/u/iwj/work/qemu-iwj.git -MMD -MP -DNEED_CPU_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DHAS_AUDIO -I/u/iwj/work/qemu-iwj.git/tcg -I/u/iwj/work/qemu-iwj.git/tcg/i386 -I/u/iwj/work/qemu-iwj.git/fpu -I/u/iwj/work/qemu-iwj.git/slirp -Wall -O2 -g -fno-strict-aliasing -m32 -march=i686 -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value -Wdeclaration-after-statement -D__XEN_TOOLS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -mno-tls-direct-seg-refs -m32 -c -E /u/iwj/work/qemu-iwj.git/vl.c |less
+ 169 make -C i386-dm XEN_ROOT=../../xen-unstable.hg 2>&1 |head -40
+ 170 history >wip-make-vl-compile
QEMU_PROG=qemu-dm
+CFLAGS += -Wno-unused -Werror
+
LIBS += -L../../libxc -lxenctrl -lxenguest
LIBS += -L../../xenstore -lxenstore
OBJS += xen_machine_pv.o
OBJS += xenfb.o
OBJS += xen_console.o
+OBJS += xen_machine_fv.o
--- /dev/null
+/*
+ * We #include this from vl.c.
+ *
+ * This is a bit yucky, but it means that the line numbers and other
+ * textual differences in vl.c remain small.
+ */
+/* There is no need for multiple-inclusion protection since
+ * there is only one place where this file is included. */
+
+
+/* forward declarations of things in vl.c */
+
+static int qemu_savevm_state(QEMUFile *f);
+static int qemu_loadvm_state(QEMUFile *f);
+
+/* We use simpler state save/load functions for Xen */
+
+void do_savevm(const char *name)
+{
+ QEMUFile *f;
+ int saved_vm_running, ret;
+
+ f = qemu_fopen(name, "wb");
+
+ /* ??? Should this occur after vm_stop? */
+ qemu_aio_flush();
+
+ saved_vm_running = vm_running;
+ vm_stop(0);
+
+ if (!f) {
+ fprintf(logfile, "Failed to open savevm file '%s'\n", name);
+ goto the_end;
+ }
+
+ ret = qemu_savevm_state(f);
+ qemu_fclose(f);
+
+ if (ret < 0)
+ fprintf(logfile, "Error %d while writing VM to savevm file '%s'\n",
+ ret, name);
+
+ the_end:
+ if (saved_vm_running)
+ vm_start();
+
+ return;
+}
+void do_loadvm(const char *name)
+{
+ QEMUFile *f;
+ int saved_vm_running, ret;
+
+ /* Flush all IO requests so they don't interfere with the new state. */
+ qemu_aio_flush();
+
+ saved_vm_running = vm_running;
+ vm_stop(0);
+
+ /* restore the VM state */
+ f = qemu_fopen(name, "rb");
+ if (!f) {
+ fprintf(logfile, "Could not open VM state file\n");
+ goto the_end;
+ }
+
+ ret = qemu_loadvm_state(f);
+ qemu_fclose(f);
+ if (ret < 0) {
+ fprintf(logfile, "Error %d while loading savevm file '%s'\n",
+ ret, name);
+ goto the_end;
+ }
+
+#if 0
+ /* del tmp file */
+ if (unlink(name) == -1)
+ fprintf(stderr, "delete tmp qemu state file failed.\n");
+#endif
+
+
+ the_end:
+ if (saved_vm_running)
+ vm_start();
+}
+
+struct qemu_alarm_timer;
+static int unix_start_timer(struct qemu_alarm_timer *t) { return 0; }
+static void unix_stop_timer(struct qemu_alarm_timer *t) { }