aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2009-09-29 09:44:53 -0300
committerMarcelo Tosatti <mtosatti@redhat.com>2009-09-29 09:44:53 -0300
commitee06eaf8553ec029e70d78e096e1c1e089cf51e2 (patch)
tree7b38a8fe6e49e4b4cfa47d105c8924945550dc30
parentMerge commit 'ee3993069ff55fa6f1c64daf1e09963e340db8e4' into upstream-merge (diff)
parentCompile some user files only once for all targets (diff)
downloadqemu-kvm-ee06eaf8553ec029e70d78e096e1c1e089cf51e2.tar.gz
qemu-kvm-ee06eaf8553ec029e70d78e096e1c1e089cf51e2.tar.bz2
qemu-kvm-ee06eaf8553ec029e70d78e096e1c1e089cf51e2.zip
Merge commit 'add16157d72454347feb240007da4f90b9d9bae6' into upstream-merge
* commit 'add16157d72454347feb240007da4f90b9d9bae6': Compile some user files only once for all targets tcg/x86_64: generated dec/inc instead of sub/add when possible Don't compile roms if not building system targets Fix user emulator breakage tcg/ppc: always use tcg_out_call vl: Add failure check for SetEvent vl: Do not use perror after failed Win32 API calls Conflicts: Makefile.target Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--Makefile9
-rw-r--r--Makefile.target21
-rw-r--r--Makefile.user27
-rwxr-xr-xconfigure8
-rw-r--r--tcg/ppc/tcg-target.c30
-rw-r--r--tcg/x86_64/tcg-target.c16
-rw-r--r--vl.c14
7 files changed, 79 insertions, 46 deletions
diff --git a/Makefile b/Makefile
index b6cde7f97..54210e210 100644
--- a/Makefile
+++ b/Makefile
@@ -52,6 +52,11 @@ subdir-%:
$(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
+$(filter %-user,$(SUBDIR_RULES)): libuser.a
+
+libuser.a:
+ $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libuser V="$(V)" TARGET_DIR="$*/" all,)
+
ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
romsubdir-%:
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C pc-bios/$* V="$(V)" TARGET_DIR="$*/",)
@@ -198,14 +203,14 @@ clean:
rm -f slirp/*.o slirp/*.d audio/*.o audio/*.d block/*.o block/*.d
rm -f qemu-img-cmds.h
$(MAKE) -C tests clean
- for d in $(ALL_SUBDIRS) libhw32 libhw64; do \
+ for d in $(ALL_SUBDIRS) libhw32 libhw64 libuser; do \
$(MAKE) -C $$d $@ || exit 1 ; \
done
distclean: clean
rm -f config-host.mak config-host.h config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi
rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
- for d in $(TARGET_DIRS) libhw32 libhw64; do \
+ for d in $(TARGET_DIRS) libhw32 libhw64 libuser; do \
rm -rf $$d || exit 1 ; \
done
diff --git a/Makefile.target b/Makefile.target
index dc7e4197b..e991fa325 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -92,7 +92,6 @@ VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
obj-y = main.o syscall.o strace.o mmap.o signal.o thunk.o \
elfload.o linuxload.o uaccess.o gdbstub.o gdbstub-xml.o
-obj-y += envlist.o path.o
obj-$(CONFIG_CPU_EMULATION) += tcg-runtime.o
obj-y += host-utils.o
@@ -110,7 +109,8 @@ obj-arm-y += arm-semi.o
obj-m68k-y += m68k-sim.o m68k-semi.o
-ARLIBS=libqemu.a
+ARLIBS=../libuser/libuser.a libqemu.a
+
endif #CONFIG_LINUX_USER
#########################################################
@@ -128,12 +128,10 @@ LIBS+=-lmx
obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \
gdbstub.o gdbstub-xml.o
-obj-y += envlist.o path.o
-obj-y += tcg-runtime.o host-utils.o
obj-i386-y += ioport-user.o
-ARLIBS=libqemu.a
+ARLIBS=../libuser/libuser.a libqemu.a
endif #CONFIG_DARWIN_USER
@@ -147,24 +145,13 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \
gdbstub.o gdbstub-xml.o uaccess.o
-obj-y += envlist.o path.o
-obj-y += tcg-runtime.o host-utils.o
obj-i386-y += ioport-user.o
-ARLIBS=libqemu.a
+ARLIBS=../libuser/libuser.a libqemu.a
endif #CONFIG_BSD_USER
-ifdef CONFIG_USER_ONLY
-# hack to compile with -fpie for *-user targets
-obj-y += cutils-user.o cache-utils-user.o
-cutils-user.c cache-utils-user.c:
- @echo " LN $(TARGET_DIR)$@"
- @ln -s $(SRC_PATH)/$(@:%-user.c=%.c) $@
-endif
-
-
#########################################################
# System emulator target
ifdef CONFIG_SOFTMMU
diff --git a/Makefile.user b/Makefile.user
new file mode 100644
index 000000000..907e74bd9
--- /dev/null
+++ b/Makefile.user
@@ -0,0 +1,27 @@
+# Makefile for qemu target independent user files.
+
+include ../config-host.mak
+include $(SRC_PATH)/rules.mak
+
+.PHONY: all
+
+VPATH=$(SRC_PATH)
+
+QEMU_CFLAGS+=-I..
+
+obj-y =
+obj-y += envlist.o path.o
+obj-y += tcg-runtime.o host-utils.o
+obj-y += cutils.o cache-utils.o
+
+all: libuser.a
+# Dummy command so that make thinks it has done something
+ @true
+
+libuser.a: $(obj-y)
+
+clean:
+ rm -f *.o *.d *.a *~
+
+# Include automatically generated dependency files
+-include $(wildcard *.d */*.d)
diff --git a/configure b/configure
index 8aeda1b0c..3153cc670 100755
--- a/configure
+++ b/configure
@@ -2139,7 +2139,8 @@ echo "TOOLS=$tools" >> $config_host_mak
# Mac OS X ships with a broken assembler
roms=
if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
- "$targetos" != "Darwin" ; then
+ "$targetos" != "Darwin" -a \
+ `expr "$target_list" : ".*softmmu.*"` != 0 ; then
roms="optionrom"
fi
echo "ROMS=$roms" >> $config_host_mak
@@ -2654,3 +2655,8 @@ for hwlib in 32 64; do
echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
done
+
+d=libuser
+mkdir -p $d
+rm -f $d/Makefile
+ln -s $source_path/Makefile.user $d/Makefile
diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c
index 07395153e..07e6941fe 100644
--- a/tcg/ppc/tcg-target.c
+++ b/tcg/ppc/tcg-target.c
@@ -472,9 +472,9 @@ static void tcg_out_b (TCGContext *s, int mask, tcg_target_long target)
}
}
-#ifdef _AIX
static void tcg_out_call (TCGContext *s, tcg_target_long arg, int const_arg)
{
+#ifdef _AIX
int reg;
if (const_arg) {
@@ -487,8 +487,16 @@ static void tcg_out_call (TCGContext *s, tcg_target_long arg, int const_arg)
tcg_out32 (s, MTSPR | RA (0) | CTR);
tcg_out32 (s, LWZ | RT (2) | RA (reg) | 4);
tcg_out32 (s, BCCTR | BO_ALWAYS | LK);
-}
+#else
+ if (const_arg) {
+ tcg_out_b (s, LK, arg);
+ }
+ else {
+ tcg_out32 (s, MTSPR | RS (arg) | LR);
+ tcg_out32 (s, BCLR | BO_ALWAYS | LK);
+ }
#endif
+}
#if defined(CONFIG_SOFTMMU)
@@ -584,11 +592,7 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
tcg_out_movi (s, TCG_TYPE_I32, 5, mem_index);
#endif
-#ifdef _AIX
tcg_out_call (s, (tcg_target_long) qemu_ld_helpers[s_bits], 1);
-#else
- tcg_out_b (s, LK, (tcg_target_long) qemu_ld_helpers[s_bits]);
-#endif
switch (opc) {
case 0|4:
tcg_out32 (s, EXTSB | RA (data_reg) | RS (3));
@@ -819,11 +823,7 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc)
ir++;
tcg_out_movi (s, TCG_TYPE_I32, ir, mem_index);
-#ifdef _AIX
tcg_out_call (s, (tcg_target_long) qemu_st_helpers[opc], 1);
-#else
- tcg_out_b (s, LK, (tcg_target_long) qemu_st_helpers[opc]);
-#endif
label2_ptr = s->code_ptr;
tcg_out32 (s, B);
@@ -1188,17 +1188,7 @@ static void tcg_out_op(TCGContext *s, int opc, const TCGArg *args,
}
break;
case INDEX_op_call:
-#ifdef _AIX
tcg_out_call (s, args[0], const_args[0]);
-#else
- if (const_args[0]) {
- tcg_out_b (s, LK, args[0]);
- }
- else {
- tcg_out32 (s, MTSPR | RS (args[0]) | LR);
- tcg_out32 (s, BCLR | BO_ALWAYS | LK);
- }
-#endif
break;
case INDEX_op_jmp:
if (const_args[0]) {
diff --git a/tcg/x86_64/tcg-target.c b/tcg/x86_64/tcg-target.c
index 9709430c6..b4ba65f97 100644
--- a/tcg/x86_64/tcg-target.c
+++ b/tcg/x86_64/tcg-target.c
@@ -397,7 +397,13 @@ static inline void tcg_out_st(TCGContext *s, TCGType type, int arg,
static inline void tgen_arithi32(TCGContext *s, int c, int r0, int32_t val)
{
- if (val == (int8_t)val) {
+ if ((c == ARITH_ADD && val == 1) || (c == ARITH_SUB && val == -1)) {
+ /* inc */
+ tcg_out_modrm(s, 0xff, 0, r0);
+ } else if ((c == ARITH_ADD && val == -1) || (c == ARITH_SUB && val == 1)) {
+ /* dec */
+ tcg_out_modrm(s, 0xff, 1, r0);
+ } else if (val == (int8_t)val) {
tcg_out_modrm(s, 0x83, c, r0);
tcg_out8(s, val);
} else if (c == ARITH_AND && val == 0xffu) {
@@ -414,7 +420,13 @@ static inline void tgen_arithi32(TCGContext *s, int c, int r0, int32_t val)
static inline void tgen_arithi64(TCGContext *s, int c, int r0, int64_t val)
{
- if (val == (int8_t)val) {
+ if ((c == ARITH_ADD && val == 1) || (c == ARITH_SUB && val == -1)) {
+ /* inc */
+ tcg_out_modrm(s, 0xff | P_REXW, 0, r0);
+ } else if ((c == ARITH_ADD && val == -1) || (c == ARITH_SUB && val == 1)) {
+ /* dec */
+ tcg_out_modrm(s, 0xff | P_REXW, 1, r0);
+ } else if (val == (int8_t)val) {
tcg_out_modrm(s, 0x83 | P_REXW, c, r0);
tcg_out8(s, val);
} else if (c == ARITH_AND && val == 0xffu) {
diff --git a/vl.c b/vl.c
index 28e868fcc..2c00baa34 100644
--- a/vl.c
+++ b/vl.c
@@ -1459,7 +1459,8 @@ static int win32_start_timer(struct qemu_alarm_timer *t)
flags);
if (!data->timerId) {
- perror("Failed to initialize win32 alarm timer");
+ fprintf(stderr, "Failed to initialize win32 alarm timer: %d\n",
+ GetLastError());
timeEndPeriod(data->period);
return -1;
}
@@ -1496,7 +1497,8 @@ static void win32_rearm_timer(struct qemu_alarm_timer *t)
TIME_ONESHOT | TIME_PERIODIC);
if (!data->timerId) {
- perror("Failed to re-arm win32 alarm timer");
+ fprintf(stderr, "Failed to re-arm win32 alarm timer %d\n",
+ GetLastError());
timeEndPeriod(data->period);
exit(1);
@@ -3423,7 +3425,7 @@ static int qemu_event_init(void)
{
qemu_event_handle = CreateEvent(NULL, FALSE, FALSE, NULL);
if (!qemu_event_handle) {
- perror("Failed CreateEvent");
+ fprintf(stderr, "Failed CreateEvent: %d\n", GetLastError());
return -1;
}
qemu_add_wait_object(qemu_event_handle, dummy_event_handler, NULL);
@@ -3432,7 +3434,11 @@ static int qemu_event_init(void)
static void qemu_event_increment(void)
{
- SetEvent(qemu_event_handle);
+ if (!SetEvent(qemu_event_handle)) {
+ fprintf(stderr, "qemu_event_increment: SetEvent failed: %d\n",
+ GetLastError());
+ exit (1);
+ }
}
#endif