From 86f69a92b163dac5ee230c8a109c3e8f37f13d38 Mon Sep 17 00:00:00 2001 From: Alexandre Raymond Date: Wed, 1 Jun 2011 22:21:30 -0400 Subject: [PATCH 1/6] Fix compilation warning due to missing header for sigaction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the following warning by including signal.h directly in qemu-common.h ----8<---- iohandler.c: In function ‘qemu_init_child_watch’: iohandler.c:172: warning: implicit declaration of function ‘sigaction’ iohandler.c:172: warning: nested extern declaration of ‘sigaction’ ----8<---- Signed-off-by: Alexandre Raymond Signed-off-by: Stefan Hajnoczi --- qemu-common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/qemu-common.h b/qemu-common.h index b851b20c51..39fabc9e0f 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -39,6 +39,7 @@ typedef struct Monitor Monitor; #include #include #include +#include #ifdef _WIN32 #include "qemu-os-win32.h" From 9bf0960a9adb93c38b879a2114f6c67e30427307 Mon Sep 17 00:00:00 2001 From: Alexandre Raymond Date: Thu, 2 Jun 2011 23:26:49 -0400 Subject: [PATCH 2/6] Fix compilation warning due to missing header for sigaction (followup) This patch removes all references to signal.h when qemu-common.h is included as they become redundant. Signed-off-by: Alexandre Raymond Signed-off-by: Stefan Hajnoczi --- audio/audio_pt_int.c | 2 -- audio/sdlaudio.c | 1 - block/raw-posix.c | 2 -- bsd-user/syscall.c | 1 - darwin-user/signal.c | 3 --- exec.c | 1 - linux-user/signal.c | 1 - net/tap.c | 1 - posix-aio-compat.c | 1 - qemu-char.c | 1 - qemu-progress.c | 1 - savevm.c | 1 - target-i386/helper.c | 1 - target-ppc/helper.c | 1 - target-sparc/helper.c | 1 - ui/curses.c | 1 - ui/sdl.c | 4 ---- usb-bsd.c | 1 - usb-linux.c | 1 - 19 files changed, 26 deletions(-) diff --git a/audio/audio_pt_int.c b/audio/audio_pt_int.c index 908c569a92..9a9c306a9c 100644 --- a/audio/audio_pt_int.c +++ b/audio/audio_pt_int.c @@ -6,8 +6,6 @@ #include "audio_int.h" #include "audio_pt_int.h" -#include - static void GCC_FMT_ATTR(3, 4) logerr (struct audio_pt *pt, int err, const char *fmt, ...) { diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index a847aa90f7..d24daa5ead 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -32,7 +32,6 @@ #elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) #include #endif -#include #endif #define AUDIO_CAP "sdl" diff --git a/block/raw-posix.c b/block/raw-posix.c index 6b72470599..9a72a17551 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -43,7 +43,6 @@ #ifdef __sun__ #define _POSIX_PTHREAD_SEMANTICS 1 -#include #include #endif #ifdef __linux__ @@ -53,7 +52,6 @@ #include #endif #if defined (__FreeBSD__) || defined(__FreeBSD_kernel__) -#include #include #include #endif diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index eb1cdf21ca..d4d039a2f6 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include "qemu.h" diff --git a/darwin-user/signal.c b/darwin-user/signal.c index 48620184ee..e2adca3918 100644 --- a/darwin-user/signal.c +++ b/darwin-user/signal.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -32,8 +31,6 @@ #undef uc_link #endif -#include - #include "qemu.h" #include "qemu-common.h" diff --git a/exec.c b/exec.c index 6f339efb10..bffc201f97 100644 --- a/exec.c +++ b/exec.c @@ -36,7 +36,6 @@ #include "qemu-timer.h" #if defined(CONFIG_USER_ONLY) #include -#include #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #include #if __FreeBSD_version >= 700104 diff --git a/linux-user/signal.c b/linux-user/signal.c index c7a375fe0e..11b25be7b8 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/net/tap.c b/net/tap.c index b8cd25267c..1f26dc9992 100644 --- a/net/tap.c +++ b/net/tap.c @@ -27,7 +27,6 @@ #include "config-host.h" -#include #include #include #include diff --git a/posix-aio-compat.c b/posix-aio-compat.c index f3cc8687ce..c4116e30f2 100644 --- a/posix-aio-compat.c +++ b/posix-aio-compat.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/qemu-char.c b/qemu-char.c index 5e04a20b8c..fb13b28454 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -35,7 +35,6 @@ #include #include -#include #include #include #include diff --git a/qemu-progress.c b/qemu-progress.c index 8ebe8efa99..5f1b8dfb97 100644 --- a/qemu-progress.c +++ b/qemu-progress.c @@ -26,7 +26,6 @@ #include "osdep.h" #include "sysemu.h" #include -#include struct progress_state { float current; diff --git a/savevm.c b/savevm.c index f4ff1a1db4..939845c825 100644 --- a/savevm.c +++ b/savevm.c @@ -23,7 +23,6 @@ */ #include #include -#include #include #include #include diff --git a/target-i386/helper.c b/target-i386/helper.c index 5c4b288619..509d68ca0f 100644 --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -21,7 +21,6 @@ #include #include #include -#include #include "cpu.h" #include "exec-all.h" diff --git a/target-ppc/helper.c b/target-ppc/helper.c index 4700632931..cf2a368b57 100644 --- a/target-ppc/helper.c +++ b/target-ppc/helper.c @@ -21,7 +21,6 @@ #include #include #include -#include #include "cpu.h" #include "exec-all.h" diff --git a/target-sparc/helper.c b/target-sparc/helper.c index b2d4d70a11..e9b42d03a9 100644 --- a/target-sparc/helper.c +++ b/target-sparc/helper.c @@ -21,7 +21,6 @@ #include #include #include -#include #include "cpu.h" #include "exec-all.h" diff --git a/ui/curses.c b/ui/curses.c index 82bc614040..d29b6cf874 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -24,7 +24,6 @@ #include #ifndef _WIN32 -#include #include #include #endif diff --git a/ui/sdl.c b/ui/sdl.c index 14a62d9bdd..f2bd4a035b 100644 --- a/ui/sdl.c +++ b/ui/sdl.c @@ -28,10 +28,6 @@ #include #include -#ifndef _WIN32 -#include -#endif - #include "qemu-common.h" #include "console.h" #include "sysemu.h" diff --git a/usb-bsd.c b/usb-bsd.c index 9bab6e353b..c1bcc4a1da 100644 --- a/usb-bsd.c +++ b/usb-bsd.c @@ -39,7 +39,6 @@ #else #include #endif -#include /* This value has maximum potential at 16. * You should also set hw.usb.debug to gain diff --git a/usb-linux.c b/usb-linux.c index baa6574ef5..fcfa09e4b8 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -37,7 +37,6 @@ #include #include -#include #include #include From a9899996c8bc8eb7686f64207ef2ce1137dd125b Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Sat, 4 Jun 2011 07:25:59 +0200 Subject: [PATCH 3/6] slirp: fix guestfwd id When using -net user,guestfwd=... Qemu immediately complains about the id being in invalid format. This is because we pass in an id that contains a colon, while the id restrictions don't allow colons. This patch changes the colon into a dot, making guestfwd work again. Signed-off-by: Alexander Graf Signed-off-by: Stefan Hajnoczi --- net/slirp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/slirp.c b/net/slirp.c index e387a116ad..e057a14ce9 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -614,7 +614,7 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str, } fwd = qemu_malloc(sizeof(struct GuestFwd)); - snprintf(buf, sizeof(buf), "guestfwd.tcp:%d", port); + snprintf(buf, sizeof(buf), "guestfwd.tcp.%d", port); fwd->hd = qemu_chr_open(buf, p, NULL); if (!fwd->hd) { error_report("could not open guest forwarding device '%s'", buf); From 351326a61842f3d4e7ed34d89b7d0f952f0af039 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Fri, 25 Mar 2011 09:36:36 +0000 Subject: [PATCH 4/6] m68k: Replace gen_im32() by tcg_const_i32() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Laurent Vivier Reviewed-by: Andreas Färber Signed-off-by: Stefan Hajnoczi --- target-m68k/translate.c | 43 +++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/target-m68k/translate.c b/target-m68k/translate.c index 9e5578d455..26f0ee42e9 100644 --- a/target-m68k/translate.c +++ b/target-m68k/translate.c @@ -171,9 +171,6 @@ typedef void (*disas_proc)(DisasContext *, uint16_t); static void disas_##name (DisasContext *s, uint16_t insn) #endif -/* FIXME: Remove this. */ -#define gen_im32(val) tcg_const_i32(val) - /* Generate a load from the specified address. Narrow values are sign extended to full register width. */ static inline TCGv gen_load(DisasContext * s, int opsize, TCGv addr, int sign) @@ -339,7 +336,7 @@ static TCGv gen_lea_indexed(DisasContext *s, int opsize, TCGv base) if ((ext & 0x80) == 0) { /* base not suppressed */ if (IS_NULL_QREG(base)) { - base = gen_im32(offset + bd); + base = tcg_const_i32(offset + bd); bd = 0; } if (!IS_NULL_QREG(add)) { @@ -355,7 +352,7 @@ static TCGv gen_lea_indexed(DisasContext *s, int opsize, TCGv base) add = tmp; } } else { - add = gen_im32(bd); + add = tcg_const_i32(bd); } if ((ext & 3) != 0) { /* memory indirect */ @@ -536,15 +533,15 @@ static TCGv gen_lea(DisasContext *s, uint16_t insn, int opsize) case 0: /* Absolute short. */ offset = ldsw_code(s->pc); s->pc += 2; - return gen_im32(offset); + return tcg_const_i32(offset); case 1: /* Absolute long. */ offset = read_im32(s); - return gen_im32(offset); + return tcg_const_i32(offset); case 2: /* pc displacement */ offset = s->pc; offset += ldsw_code(s->pc); s->pc += 2; - return gen_im32(offset); + return tcg_const_i32(offset); case 3: /* pc index+displacement. */ return gen_lea_indexed(s, opsize, NULL_QREG); case 4: /* Immediate. */ @@ -1209,16 +1206,16 @@ DISAS_INSN(arith_im) break; case 2: /* subi */ tcg_gen_mov_i32(dest, src1); - gen_helper_xflag_lt(QREG_CC_X, dest, gen_im32(im)); + gen_helper_xflag_lt(QREG_CC_X, dest, tcg_const_i32(im)); tcg_gen_subi_i32(dest, dest, im); - gen_update_cc_add(dest, gen_im32(im)); + gen_update_cc_add(dest, tcg_const_i32(im)); s->cc_op = CC_OP_SUB; break; case 3: /* addi */ tcg_gen_mov_i32(dest, src1); tcg_gen_addi_i32(dest, dest, im); - gen_update_cc_add(dest, gen_im32(im)); - gen_helper_xflag_lt(QREG_CC_X, dest, gen_im32(im)); + gen_update_cc_add(dest, tcg_const_i32(im)); + gen_helper_xflag_lt(QREG_CC_X, dest, tcg_const_i32(im)); s->cc_op = CC_OP_ADD; break; case 5: /* eori */ @@ -1228,7 +1225,7 @@ DISAS_INSN(arith_im) case 6: /* cmpi */ tcg_gen_mov_i32(dest, src1); tcg_gen_subi_i32(dest, dest, im); - gen_update_cc_add(dest, gen_im32(im)); + gen_update_cc_add(dest, tcg_const_i32(im)); s->cc_op = CC_OP_SUB; break; default: @@ -1324,8 +1321,8 @@ DISAS_INSN(clr) default: abort(); } - DEST_EA(insn, opsize, gen_im32(0), NULL); - gen_logic_cc(s, gen_im32(0)); + DEST_EA(insn, opsize, tcg_const_i32(0), NULL); + gen_logic_cc(s, tcg_const_i32(0)); } static TCGv gen_get_ccr(DisasContext *s) @@ -1589,7 +1586,7 @@ DISAS_INSN(jump) } if ((insn & 0x40) == 0) { /* jsr */ - gen_push(s, gen_im32(s->pc)); + gen_push(s, tcg_const_i32(s->pc)); } gen_jmp(s, tmp); } @@ -1617,7 +1614,7 @@ DISAS_INSN(addsubq) tcg_gen_addi_i32(dest, dest, val); } } else { - src2 = gen_im32(val); + src2 = tcg_const_i32(val); if (insn & 0x0100) { gen_helper_xflag_lt(QREG_CC_X, dest, src2); tcg_gen_subi_i32(dest, dest, val); @@ -1666,7 +1663,7 @@ DISAS_INSN(branch) } if (op == 1) { /* bsr */ - gen_push(s, gen_im32(s->pc)); + gen_push(s, tcg_const_i32(s->pc)); } gen_flush_cc_op(s); if (op > 1) { @@ -1757,7 +1754,7 @@ DISAS_INSN(mov3q) val = (insn >> 9) & 7; if (val == 0) val = -1; - src = gen_im32(val); + src = tcg_const_i32(val); gen_logic_cc(s, src); DEST_EA(insn, OS_LONG, src, NULL); } @@ -1883,7 +1880,7 @@ DISAS_INSN(shift_im) tmp = (insn >> 9) & 7; if (tmp == 0) tmp = 8; - shift = gen_im32(tmp); + shift = tcg_const_i32(tmp); /* No need to flush flags becuse we know we will set C flag. */ if (insn & 0x100) { gen_helper_shl_cc(reg, cpu_env, reg, shift); @@ -2191,7 +2188,7 @@ DISAS_INSN(fpu) switch ((ext >> 10) & 7) { case 4: /* FPCR */ /* Not implemented. Always return zero. */ - tmp32 = gen_im32(0); + tmp32 = tcg_const_i32(0); break; case 1: /* FPIAR */ case 2: /* FPSR */ @@ -2592,7 +2589,7 @@ DISAS_INSN(mac) /* Skip the accumulate if the value is already saturated. */ l1 = gen_new_label(); tmp = tcg_temp_new(); - gen_op_and32(tmp, QREG_MACSR, gen_im32(MACSR_PAV0 << acc)); + gen_op_and32(tmp, QREG_MACSR, tcg_const_i32(MACSR_PAV0 << acc)); gen_op_jmp_nz32(tmp, l1); } #endif @@ -2626,7 +2623,7 @@ DISAS_INSN(mac) /* Skip the accumulate if the value is already saturated. */ l1 = gen_new_label(); tmp = tcg_temp_new(); - gen_op_and32(tmp, QREG_MACSR, gen_im32(MACSR_PAV0 << acc)); + gen_op_and32(tmp, QREG_MACSR, tcg_const_i32(MACSR_PAV0 << acc)); gen_op_jmp_nz32(tmp, l1); } #endif From 8001c294f878966c0a9efe2e811d56d3f5a7da69 Mon Sep 17 00:00:00 2001 From: Martin Simmons Date: Mon, 6 Jun 2011 15:49:17 +0100 Subject: [PATCH 5/6] target-i386: Make x86 mfence and lfence illegal without SSE2 While trying to use qemu -cpu pentium3 to test for incorrect uses of certain SSE2 instructions, I found that QEMU allowed the mfence and lfence instructions to be executed even though Pentium 3 doesn't support them. According to the processor specs (and experience on a real Pentium 3), these instructions are only available with SSE2, but QEMU is checking for SSE. The check for the related sfence instruction is correct (it works with SSE). This trival patch fixes the test. Signed-off-by: Martin Simmons Signed-off-by: Stefan Hajnoczi --- target-i386/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-i386/translate.c b/target-i386/translate.c index 199302e517..10bd72a0e2 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -7538,7 +7538,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) break; case 5: /* lfence */ case 6: /* mfence */ - if ((modrm & 0xc7) != 0xc0 || !(s->cpuid_features & CPUID_SSE)) + if ((modrm & 0xc7) != 0xc0 || !(s->cpuid_features & CPUID_SSE2)) goto illegal_op; break; case 7: /* sfence / clflush */ From 7665385a8580ee5cea2cae44e1b58d6d7518a156 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Tue, 26 Apr 2011 01:32:08 +0000 Subject: [PATCH 6/6] virtio: Move virtio-pci to hw library This module has no target dependencies (except for target_phys_addr_t size) and can thus be built as part of libhw. Signed-off-by: Jan Kiszka Reviewed-by: Aurelien Jarno Signed-off-by: Stefan Hajnoczi --- Makefile.objs | 1 + Makefile.target | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.objs b/Makefile.objs index 66ffad4b78..50fbb200de 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -170,6 +170,7 @@ user-obj-y += cutils.o cache-utils.o hw-obj-y = hw-obj-y += vl.o loader.o hw-obj-$(CONFIG_VIRTIO) += virtio.o virtio-console.o +hw-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o hw-obj-y += fw_cfg.o hw-obj-$(CONFIG_PCI) += pci.o pci_bridge.o hw-obj-$(CONFIG_PCI) += msix.o msi.o diff --git a/Makefile.target b/Makefile.target index 5c22df8b47..85480d89c4 100644 --- a/Makefile.target +++ b/Makefile.target @@ -190,7 +190,6 @@ obj-y = arch_init.o cpus.o monitor.o machine.o gdbstub.o balloon.o # need to fix this properly obj-$(CONFIG_NO_PCI) += pci-stub.o obj-$(CONFIG_VIRTIO) += virtio-blk.o virtio-balloon.o virtio-net.o virtio-serial-bus.o -obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o obj-y += vhost_net.o obj-$(CONFIG_VHOST_NET) += vhost.o obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/virtio-9p.o