summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile20
-rw-r--r--Makefile.target1
-rwxr-xr-xconfigure23
-rwxr-xr-xcreate_config2
-rw-r--r--hw/apb_pci.c2
-rw-r--r--hw/arm_sysctl.c2
-rw-r--r--hw/armv7m.c6
-rw-r--r--hw/axis_dev88.c2
-rw-r--r--hw/escc.c4
-rw-r--r--hw/esp.c2
-rw-r--r--hw/etraxfs.c2
-rw-r--r--hw/fdc.c8
-rw-r--r--hw/grackle_pci.c2
-rw-r--r--hw/i2c.c2
-rw-r--r--hw/ide/isa.c2
-rw-r--r--hw/ide/pci.c2
-rw-r--r--hw/ide/qdev.c2
-rw-r--r--hw/integratorcp.c2
-rw-r--r--hw/isa-bus.c11
-rw-r--r--hw/m48t59.c4
-rw-r--r--hw/mc146818rtc.c2
-rw-r--r--hw/mips_malta.c2
-rw-r--r--hw/musicpal.c4
-rw-r--r--hw/ne2000-isa.c2
-rw-r--r--hw/parallel.c2
-rw-r--r--hw/pc.c2
-rw-r--r--hw/pci-hotplug.c4
-rw-r--r--hw/pci.c5
-rw-r--r--hw/piix_pci.c2
-rw-r--r--hw/qdev.c28
-rw-r--r--hw/qdev.h3
-rw-r--r--hw/scsi-bus.c4
-rw-r--r--hw/serial.c2
-rw-r--r--hw/smc91c111.c2
-rw-r--r--hw/ssi.c2
-rw-r--r--hw/stellaris.c2
-rw-r--r--hw/sun4m.c28
-rw-r--r--hw/sun4u.c4
-rw-r--r--hw/syborg.c4
-rw-r--r--hw/sysbus.c2
-rw-r--r--hw/unin_pci.c2
-rw-r--r--hw/usb-bus.c2
-rw-r--r--hw/usb-msd.c3
-rw-r--r--hw/vga-pci.c2
-rw-r--r--hw/xilinx.h6
-rw-r--r--pc-bios/optionrom/Makefile3
-rw-r--r--rules.mak21
-rw-r--r--target-cris/helper.c8
-rw-r--r--target-cris/translate.c4
-rw-r--r--target-i386/translate.c10
-rw-r--r--tcg/tcg.c2
-rw-r--r--usb-linux.c8
52 files changed, 156 insertions, 122 deletions
diff --git a/Makefile b/Makefile
index ef585d094..c69662eb9 100644
--- a/Makefile
+++ b/Makefile
@@ -11,8 +11,13 @@ config-host.mak:
@exit 1
endif
+# Don't try to regenerate Makefile or configure
+# We don't generate any of them
+Makefile: ;
+configure: ;
+
.PHONY: all clean cscope distclean dvi html info install install-doc \
- recurse-all speed tar tarbin test
+ recurse-all speed tar tarbin test build-all
VPATH=$(SRC_PATH):$(SRC_PATH)/hw
@@ -24,7 +29,10 @@ else
DOCS=
endif
-build-all: $(TOOLS) $(DOCS) recurse-all
+SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
+
+build-all: config-host.h
+ $(call quiet-command, $(MAKE) $(SUBDIR_MAKEFLAGS) $(TOOLS) $(DOCS) recurse-all,)
config-host.mak: configure
ifneq ($(wildcard config-host.mak),)
@@ -32,7 +40,9 @@ ifneq ($(wildcard config-host.mak),)
@sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
endif
-SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
+config-host.h: config-host.h-timestamp
+config-host.h-timestamp: config-host.mak
+
SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
ifeq ($(KVM_KMOD),yes)
@@ -47,7 +57,7 @@ kvm-kmod:
endif
-subdir-%:
+subdir-%: config-host.h
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
$(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
@@ -208,7 +218,7 @@ clean:
done
distclean: clean
- rm -f config-host.mak config-host.h config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi
+ 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 libuser; do \
rm -rf $$d || exit 1 ; \
diff --git a/Makefile.target b/Makefile.target
index acee285fe..ff614d815 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -1,5 +1,6 @@
# -*- Mode: makefile -*-
+include ../config-host.mak
include config.mak
include $(SRC_PATH)/rules.mak
diff --git a/configure b/configure
index ff7e8b253..95eaaa251 100755
--- a/configure
+++ b/configure
@@ -1506,7 +1506,6 @@ fi
##########################################
# linux-aio probe
-AIOLIBS=""
if test "$linux_aio" != "no" ; then
cat > $TMPC <<EOF
@@ -1957,13 +1956,8 @@ echo "-> Your SDL version is too old - please upgrade to have SDL support"
fi
config_host_mak="config-host.mak"
-config_host_h="config-host.h"
config_host_ld="config-host.ld"
-#echo "Creating $config_host_mak and $config_host_h"
-
-test -f $config_host_h && mv $config_host_h ${config_host_h}~
-
echo "# Automatically generated by configure - do not modify" > $config_host_mak
printf "# Configured with:" >> $config_host_mak
printf " '%s'" "$0" "$@" >> $config_host_mak
@@ -2231,18 +2225,6 @@ echo "LIBS+=$LIBS" >> $config_host_mak
echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
echo "EXESUF=$EXESUF" >> $config_host_mak
-echo "/* Automatically generated by configure - do not modify */" > $config_host_h
-
-/bin/sh $source_path/create_config < $config_host_mak >> $config_host_h
-
-if test -f ${config_host_h}~ ; then
- if cmp -s $config_host_h ${config_host_h}~ ; then
- mv ${config_host_h}~ $config_host_h
- else
- rm ${config_host_h}~
- fi
-fi
-
# generate list of library paths for linker script
$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
@@ -2314,8 +2296,6 @@ ln -s $source_path/Makefile.target $target_dir/Makefile
echo "# Automatically generated by configure - do not modify" > $config_mak
-echo "include ../config-host.mak" >> $config_mak
-
bflt="no"
elfload32="no"
target_nptl="no"
@@ -2652,8 +2632,7 @@ fi
echo "LDFLAGS+=$ldflags" >> $config_mak
echo "QEMU_CFLAGS+=$cflags" >> $config_mak
-echo "/* Automatically generated by configure - do not modify */" > $config_h
-echo "#include \"../config-host.h\"" >> $config_h
+echo "#include \"../config-host.h\"" > $config_h
/bin/sh $source_path/create_config < $config_mak >> $config_h
diff --git a/create_config b/create_config
index 5bc8fb6b4..30d0487e2 100755
--- a/create_config
+++ b/create_config
@@ -1,5 +1,7 @@
#!/bin/sh
+echo "/* Automatically generated by create_config - do not modify */"
+
while read line; do
case $line in
diff --git a/hw/apb_pci.c b/hw/apb_pci.c
index eb7704250..72f15afd9 100644
--- a/hw/apb_pci.c
+++ b/hw/apb_pci.c
@@ -236,7 +236,7 @@ PCIBus *pci_apb_init(target_phys_addr_t special_base,
/* Ultrasparc PBM main bus */
dev = qdev_create(NULL, "pbm");
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
/* apb_config */
sysbus_mmio_map(s, 0, special_base + 0x2000ULL);
diff --git a/hw/arm_sysctl.c b/hw/arm_sysctl.c
index 26300ef8a..72c7ccbe3 100644
--- a/hw/arm_sysctl.c
+++ b/hw/arm_sysctl.c
@@ -212,7 +212,7 @@ void arm_sysctl_init(uint32_t base, uint32_t sys_id)
dev = qdev_create(NULL, "realview_sysctl");
qdev_prop_set_uint32(dev, "sys_id", sys_id);
- qdev_init(dev);
+ qdev_init_nofail(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
}
diff --git a/hw/armv7m.c b/hw/armv7m.c
index a96288d0d..034323d26 100644
--- a/hw/armv7m.c
+++ b/hw/armv7m.c
@@ -141,12 +141,12 @@ static void armv7m_bitband_init(void)
dev = qdev_create(NULL, "ARM,bitband-memory");
qdev_prop_set_uint32(dev, "base", 0x20000000);
- qdev_init(dev);
+ qdev_init_nofail(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0x22000000);
dev = qdev_create(NULL, "ARM,bitband-memory");
qdev_prop_set_uint32(dev, "base", 0x40000000);
- qdev_init(dev);
+ qdev_init_nofail(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0x42000000);
}
@@ -202,7 +202,7 @@ qemu_irq *armv7m_init(int flash_size, int sram_size,
nvic = qdev_create(NULL, "armv7m_nvic");
env->v7m.nvic = nvic;
- qdev_init(nvic);
+ qdev_init_nofail(nvic);
cpu_pic = arm_pic_init_cpu(env);
sysbus_connect_irq(sysbus_from_qdev(nvic), 0, cpu_pic[ARM_PIC_CPU_IRQ]);
for (i = 0; i < 64; i++) {
diff --git a/hw/axis_dev88.c b/hw/axis_dev88.c
index 81a41c944..d6f14bcd2 100644
--- a/hw/axis_dev88.c
+++ b/hw/axis_dev88.c
@@ -300,7 +300,7 @@ void axisdev88_init (ram_addr_t ram_size,
dev = qdev_create(NULL, "etraxfs,pic");
/* FIXME: Is there a proper way to signal vectors to the CPU core? */
qdev_prop_set_ptr(dev, "interrupt_vector", &env->interrupt_vector);
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_mmio_map(s, 0, 0x3001c000);
sysbus_connect_irq(s, 0, cpu_irq[0]);
diff --git a/hw/escc.c b/hw/escc.c
index 382719ded..29704284d 100644
--- a/hw/escc.c
+++ b/hw/escc.c
@@ -741,7 +741,7 @@ int escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB,
qdev_prop_set_chr(dev, "chrA", chrA);
qdev_prop_set_uint32(dev, "chnBtype", ser);
qdev_prop_set_uint32(dev, "chnAtype", ser);
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_connect_irq(s, 0, irqB);
sysbus_connect_irq(s, 1, irqA);
@@ -904,7 +904,7 @@ void slavio_serial_ms_kbd_init(target_phys_addr_t base, qemu_irq irq,
qdev_prop_set_chr(dev, "chrA", NULL);
qdev_prop_set_uint32(dev, "chnBtype", mouse);
qdev_prop_set_uint32(dev, "chnAtype", kbd);
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_connect_irq(s, 0, irq);
sysbus_connect_irq(s, 1, irq);
diff --git a/hw/esp.c b/hw/esp.c
index 5d8602041..c2567a6b8 100644
--- a/hw/esp.c
+++ b/hw/esp.c
@@ -647,7 +647,7 @@ void esp_init(target_phys_addr_t espaddr, int it_shift,
esp->dma_memory_write = dma_memory_write;
esp->dma_opaque = dma_opaque;
esp->it_shift = it_shift;
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_connect_irq(s, 0, irq);
sysbus_mmio_map(s, 0, espaddr);
diff --git a/hw/etraxfs.c b/hw/etraxfs.c
index 4f451c54c..7937e48ef 100644
--- a/hw/etraxfs.c
+++ b/hw/etraxfs.c
@@ -92,7 +92,7 @@ void bareetraxfs_init (ram_addr_t ram_size,
dev = qdev_create(NULL, "etraxfs,pic");
/* FIXME: Is there a proper way to signal vectors to the CPU core? */
qdev_prop_set_ptr(dev, "interrupt_vector", &env->interrupt_vector);
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_mmio_map(s, 0, 0x3001c000);
sysbus_connect_irq(s, 0, cpu_irq[0]);
diff --git a/hw/fdc.c b/hw/fdc.c
index 6a6e7a8de..a21e05f0e 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1847,7 +1847,7 @@ fdctrl_t *fdctrl_init_isa(DriveInfo **fds)
dev = isa_create("isa-fdc");
qdev_prop_set_drive(&dev->qdev, "driveA", fds[0]);
qdev_prop_set_drive(&dev->qdev, "driveB", fds[1]);
- if (qdev_init(&dev->qdev) != 0)
+ if (qdev_init(&dev->qdev) < 0)
return NULL;
return &(DO_UPCAST(fdctrl_isabus_t, busdev, dev)->state);
}
@@ -1866,8 +1866,7 @@ fdctrl_t *fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
fdctrl->dma_chann = dma_chann; /* FIXME */
qdev_prop_set_drive(dev, "driveA", fds[0]);
qdev_prop_set_drive(dev, "driveB", fds[1]);
- if (qdev_init(dev) != 0)
- return NULL;
+ qdev_init_nofail(dev);
sysbus_connect_irq(&sys->busdev, 0, irq);
sysbus_mmio_map(&sys->busdev, 0, mmio_base);
@@ -1883,8 +1882,7 @@ fdctrl_t *sun4m_fdctrl_init (qemu_irq irq, target_phys_addr_t io_base,
dev = qdev_create(NULL, "SUNW,fdtwo");
qdev_prop_set_drive(dev, "drive", fds[0]);
- if (qdev_init(dev) != 0)
- return NULL;
+ qdev_init_nofail(dev);
sys = DO_UPCAST(fdctrl_sysbus_t, busdev.qdev, dev);
fdctrl = &sys->state;
sysbus_connect_irq(&sys->busdev, 0, irq);
diff --git a/hw/grackle_pci.c b/hw/grackle_pci.c
index d878cf674..b49cf1ed7 100644
--- a/hw/grackle_pci.c
+++ b/hw/grackle_pci.c
@@ -138,7 +138,7 @@ PCIBus *pci_grackle_init(uint32_t base, qemu_irq *pic)
GrackleState *d;
dev = qdev_create(NULL, "grackle");
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
d = FROM_SYSBUS(GrackleState, s);
d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci",
diff --git a/hw/i2c.c b/hw/i2c.c
index 6cd4701a9..5c291ce0a 100644
--- a/hw/i2c.c
+++ b/hw/i2c.c
@@ -189,6 +189,6 @@ DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, uint8_t addr)
dev = qdev_create(&bus->qbus, name);
qdev_prop_set_uint8(dev, "address", addr);
- qdev_init(dev);
+ qdev_init_nofail(dev);
return dev;
}
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index 3205f40b3..9f0fdd649 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -85,7 +85,7 @@ int isa_ide_init(int iobase, int iobase2, int isairq,
qdev_prop_set_uint32(&dev->qdev, "iobase", iobase);
qdev_prop_set_uint32(&dev->qdev, "iobase2", iobase2);
qdev_prop_set_uint32(&dev->qdev, "irq", isairq);
- if (qdev_init(&dev->qdev) != 0)
+ if (qdev_init(&dev->qdev) < 0)
return -1;
s = DO_UPCAST(ISAIDEState, dev, dev);
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index 6d090bcca..9504e4457 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -445,7 +445,7 @@ void pci_cmd646_ide_init(PCIBus *bus, DriveInfo **hd_table,
dev = pci_create(bus, -1, "CMD646 IDE");
qdev_prop_set_uint32(&dev->qdev, "secondary", secondary_ide_enabled);
- qdev_init(&dev->qdev);
+ qdev_init_nofail(&dev->qdev);
pci_ide_create_devs(dev, hd_table);
}
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index c562bc61a..81e79950d 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -85,7 +85,7 @@ IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive)
dev = qdev_create(&bus->qbus, "ide-drive");
qdev_prop_set_uint32(dev, "unit", unit);
qdev_prop_set_drive(dev, "drive", drive);
- if (qdev_init(dev) != 0)
+ if (qdev_init(dev) < 0)
return NULL;
return DO_UPCAST(IDEDevice, qdev, dev);
}
diff --git a/hw/integratorcp.c b/hw/integratorcp.c
index 21e7712a6..bee82988b 100644
--- a/hw/integratorcp.c
+++ b/hw/integratorcp.c
@@ -477,7 +477,7 @@ static void integratorcp_init(ram_addr_t ram_size,
dev = qdev_create(NULL, "integrator_core");
qdev_prop_set_uint32(dev, "memsz", ram_size >> 20);
- qdev_init(dev);
+ qdev_init_nofail(dev);
sysbus_mmio_map((SysBusDevice *)dev, 0, 0x10000000);
cpu_pic = arm_pic_init_cpu(env);
diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 4ecc0f839..4d489d205 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -45,7 +45,7 @@ ISABus *isa_bus_new(DeviceState *dev)
}
if (NULL == dev) {
dev = qdev_create(NULL, "isabus-bridge");
- qdev_init(dev);
+ qdev_init_nofail(dev);
}
isabus = FROM_QBUS(ISABus, qbus_create(&isa_bus_info, dev, NULL));
@@ -114,8 +114,8 @@ ISADevice *isa_create(const char *name)
DeviceState *dev;
if (!isabus) {
- fprintf(stderr, "Tried to create isa device %s with no isa bus present.\n", name);
- return NULL;
+ hw_error("Tried to create isa device %s with no isa bus present.\n",
+ name);
}
dev = qdev_create(&isabus->qbus, name);
return DO_UPCAST(ISADevice, qdev, dev);
@@ -126,10 +126,7 @@ ISADevice *isa_create_simple(const char *name)
ISADevice *dev;
dev = isa_create(name);
- if (qdev_init(&dev->qdev) != 0) {
- qdev_free(&dev->qdev);
- return NULL;
- }
+ qdev_init_nofail(&dev->qdev);
return dev;
}
diff --git a/hw/m48t59.c b/hw/m48t59.c
index b9892cc1f..0f45071eb 100644
--- a/hw/m48t59.c
+++ b/hw/m48t59.c
@@ -636,7 +636,7 @@ m48t59_t *m48t59_init (qemu_irq IRQ, target_phys_addr_t mem_base,
qdev_prop_set_uint32(dev, "type", type);
qdev_prop_set_uint32(dev, "size", size);
qdev_prop_set_uint32(dev, "io_base", io_base);
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_connect_irq(s, 0, IRQ);
if (io_base != 0) {
@@ -662,7 +662,7 @@ m48t59_t *m48t59_init_isa(uint32_t io_base, uint16_t size, int type)
qdev_prop_set_uint32(&dev->qdev, "type", type);
qdev_prop_set_uint32(&dev->qdev, "size", size);
qdev_prop_set_uint32(&dev->qdev, "io_base", io_base);
- qdev_init(&dev->qdev);
+ qdev_init_nofail(&dev->qdev);
d = DO_UPCAST(M48t59ISAState, busdev, dev);
s = &d->state;
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index bec5687e4..d82131ace 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -637,7 +637,7 @@ RTCState *rtc_init(int base_year)
dev = isa_create("mc146818rtc");
qdev_prop_set_int32(&dev->qdev, "base_year", base_year);
- qdev_init(&dev->qdev);
+ qdev_init_nofail(&dev->qdev);
return DO_UPCAST(RTCState, dev, dev);
}
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index d0266d524..b26bbeeef 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -933,7 +933,7 @@ void mips_malta_init (ram_addr_t ram_size,
eeprom = qdev_create((BusState *)smbus, "smbus-eeprom");
qdev_prop_set_uint8(eeprom, "address", 0x50 + i);
qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256));
- qdev_init(eeprom);
+ qdev_init_nofail(eeprom);
}
pit = pit_init(0x40, isa_reserve_irq(0));
DMA_init(0);
diff --git a/hw/musicpal.c b/hw/musicpal.c
index 1fad36f2e..02d4c70ba 100644
--- a/hw/musicpal.c
+++ b/hw/musicpal.c
@@ -1551,7 +1551,7 @@ static void musicpal_init(ram_addr_t ram_size,
qemu_check_nic_model(&nd_table[0], "mv88w8618");
dev = qdev_create(NULL, "mv88w8618_eth");
dev->nd = &nd_table[0];
- qdev_init(dev);
+ qdev_init_nofail(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, MP_ETH_BASE);
sysbus_connect_irq(sysbus_from_qdev(dev), 0, pic[MP_ETH_IRQ]);
@@ -1589,7 +1589,7 @@ static void musicpal_init(ram_addr_t ram_size,
dev = qdev_create(NULL, "mv88w8618_audio");
s = sysbus_from_qdev(dev);
qdev_prop_set_ptr(dev, "wm8750", wm8750_dev);
- qdev_init(dev);
+ qdev_init_nofail(dev);
sysbus_mmio_map(s, 0, MP_AUDIO_BASE);
sysbus_connect_irq(s, 0, pic[MP_AUDIO_IRQ]);
#endif
diff --git a/hw/ne2000-isa.c b/hw/ne2000-isa.c
index 54c0478a4..e3467316e 100644
--- a/hw/ne2000-isa.c
+++ b/hw/ne2000-isa.c
@@ -87,7 +87,7 @@ void isa_ne2000_init(int base, int irq, NICInfo *nd)
dev->qdev.nd = nd; /* hack alert */
qdev_prop_set_uint32(&dev->qdev, "iobase", base);
qdev_prop_set_uint32(&dev->qdev, "irq", irq);
- qdev_init(&dev->qdev);
+ qdev_init_nofail(&dev->qdev);
}
static ISADeviceInfo ne2000_isa_info = {
diff --git a/hw/parallel.c b/hw/parallel.c
index 2635edcaf..92eecb152 100644
--- a/hw/parallel.c
+++ b/hw/parallel.c
@@ -493,7 +493,7 @@ ParallelState *parallel_init(int index, CharDriverState *chr)
qdev_prop_set_uint32(&dev->qdev, "iobase", isa_parallel_io[index]);
qdev_prop_set_uint32(&dev->qdev, "irq", 7);
qdev_prop_set_chr(&dev->qdev, "chardev", chr);
- if (qdev_init(&dev->qdev) != 0)
+ if (qdev_init(&dev->qdev) < 0)
return NULL;
return &DO_UPCAST(ISAParallelState, dev, dev)->state;
}
diff --git a/hw/pc.c b/hw/pc.c
index 725c6f67f..e3edf111b 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1321,7 +1321,7 @@ static void pc_init1(ram_addr_t ram_size,
eeprom = qdev_create((BusState *)smbus, "smbus-eeprom");
qdev_prop_set_uint8(eeprom, "address", 0x50 + i);
qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256));
- qdev_init(eeprom);
+ qdev_init_nofail(eeprom);
}
piix4_acpi_system_hot_add_init(pci_bus, cpu_model);
}
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c
index ef818219f..b7cdbcc20 100644
--- a/hw/pci-hotplug.c
+++ b/hw/pci-hotplug.c
@@ -173,8 +173,8 @@ static PCIDevice *qemu_pci_hot_add_storage(Monitor *mon,
default:
dev = NULL;
}
- if (dev)
- qdev_init(&dev->qdev);
+ if (!dev || qdev_init(&dev->qdev) < 0)
+ return NULL;
return dev;
}
diff --git a/hw/pci.c b/hw/pci.c
index 4588305f6..4986433d5 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -936,6 +936,7 @@ static const char * const pci_nic_names[] = {
};
/* Initialize a PCI NIC. */
+/* FIXME callers should check for failure, but don't */
PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
const char *default_devaddr)
{
@@ -1048,7 +1049,7 @@ PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did,
dev = pci_create(bus, devfn, "pci-bridge");
qdev_prop_set_uint32(&dev->qdev, "vendorid", vid);
qdev_prop_set_uint32(&dev->qdev, "deviceid", did);
- qdev_init(&dev->qdev);
+ qdev_init_nofail(&dev->qdev);
s = DO_UPCAST(PCIBridge, dev, dev);
pci_register_secondary_bus(&s->bus, &s->dev, map_irq, name);
@@ -1112,7 +1113,7 @@ PCIDevice *pci_create(PCIBus *bus, int devfn, const char *name)
PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
{
PCIDevice *dev = pci_create(bus, devfn, name);
- qdev_init(&dev->qdev);
+ qdev_init_nofail(&dev->qdev);
return dev;
}
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index b1134333b..ad4b8d157 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -242,7 +242,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *
s = FROM_SYSBUS(I440FXState, sysbus_from_qdev(dev));
b = pci_bus_new(&s->busdev.qdev, NULL, 0);
s->bus = b;
- qdev_init(dev);
+ qdev_init_nofail(dev);
d = pci_create_simple(b, 0, "i440FX");
*pi440fx_state = DO_UPCAST(PCII440FXState, dev, d);
diff --git a/hw/qdev.c b/hw/qdev.c
index b2d11cebb..906e89755 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -30,9 +30,9 @@
#include "sysemu.h"
#include "monitor.h"
-/* This is a nasty hack to allow passing a NULL bus to qdev_create. */
static int qdev_hotplug = 0;
+/* This is a nasty hack to allow passing a NULL bus to qdev_create. */
static BusState *main_system_bus;
static DeviceInfo *device_info_list;
@@ -214,9 +214,8 @@ DeviceState *qdev_device_add(QemuOpts *opts)
qdev_free(qdev);
return NULL;
}
- if (qdev_init(qdev) != 0) {
+ if (qdev_init(qdev) < 0) {
qemu_error("Error initializing device %s\n", driver);
- qdev_free(qdev);
return NULL;
}
qdev->opts = opts;
@@ -232,15 +231,19 @@ static void qdev_reset(void *opaque)
/* Initialize a device. Device properties should be set before calling
this function. IRQs and MMIO regions should be connected/mapped after
- calling this function. */
+ calling this function.
+ On failure, destroy the device and return negative value.
+ Return 0 on success. */
int qdev_init(DeviceState *dev)
{
int rc;
assert(dev->state == DEV_STATE_CREATED);
rc = dev->info->init(dev, dev->info);
- if (rc < 0)
+ if (rc < 0) {
+ qdev_free(dev);
return rc;
+ }
qemu_register_reset(qdev_reset, dev);
if (dev->info->vmsd)
vmstate_register(-1, dev->info->vmsd, dev);
@@ -266,6 +269,21 @@ int qdev_simple_unplug_cb(DeviceState *dev)
return 0;
}
+/* Like qdev_init(), but terminate program via hw_error() instead of
+ returning an error value. This is okay during machine creation.
+ Don't use for hotplug, because there callers need to recover from
+ failure. Exception: if you know the device's init() callback can't
+ fail, then qdev_init_nofail() can't fail either, and is therefore
+ usable even then. But relying on the device implementation that
+ way is somewhat unclean, and best avoided. */
+void qdev_init_nofail(DeviceState *dev)
+{
+ DeviceInfo *info = dev->info;
+
+ if (qdev_init(dev) < 0)
+ hw_error("Initialization of device %s failed\n", info->name);
+}
+
/* Unlink device from bus and free the structure. */
void qdev_free(DeviceState *dev)
{
diff --git a/hw/qdev.h b/hw/qdev.h
index 893ae925c..8cd843e76 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -100,7 +100,8 @@ struct CompatProperty {
DeviceState *qdev_create(BusState *bus, const char *name);
DeviceState *qdev_device_add(QemuOpts *opts);
-int qdev_init(DeviceState *dev);
+int qdev_init(DeviceState *dev) __attribute__((warn_unused_result));
+void qdev_init_nofail(DeviceState *dev);
int qdev_unplug(DeviceState *dev);
void qdev_free(DeviceState *dev);
int qdev_simple_unplug_cb(DeviceState *dev);
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index fe8991e9c..41992e52d 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -82,6 +82,7 @@ void scsi_qdev_register(SCSIDeviceInfo *info)
}
/* handle legacy '-drive if=scsi,...' cmd line args */
+/* FIXME callers should check for failure, but don't */
SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, DriveInfo *dinfo, int unit)
{
const char *driver;
@@ -91,7 +92,8 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, DriveInfo *dinfo, int unit)
dev = qdev_create(&bus->qbus, driver);
qdev_prop_set_uint32(dev, "scsi-id", unit);
qdev_prop_set_drive(dev, "drive", dinfo);
- qdev_init(dev);
+ if (qdev_init(dev) < 0)
+ return NULL;
return DO_UPCAST(SCSIDevice, qdev, dev);
}
diff --git a/hw/serial.c b/hw/serial.c
index e04492310..eb14f11ba 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -759,7 +759,7 @@ SerialState *serial_isa_init(int index, CharDriverState *chr)
qdev_prop_set_uint32(&dev->qdev, "iobase", isa_serial_io[index]);
qdev_prop_set_uint32(&dev->qdev, "irq", isa_serial_irq[index]);
qdev_prop_set_chr(&dev->qdev, "chardev", chr);
- if (qdev_init(&dev->qdev) != 0)
+ if (qdev_init(&dev->qdev) < 0)
return NULL;
return &DO_UPCAST(ISASerialState, dev, dev)->state;
}
diff --git a/hw/smc91c111.c b/hw/smc91c111.c
index a08bdb0a5..d58821a3a 100644
--- a/hw/smc91c111.c
+++ b/hw/smc91c111.c
@@ -735,7 +735,7 @@ void smc91c111_init(NICInfo *nd, uint32_t base, qemu_irq irq)
qemu_check_nic_model(nd, "smc91c111");
dev = qdev_create(NULL, "smc91c111");
dev->nd = nd;
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_mmio_map(s, 0, base);
sysbus_connect_irq(s, 0, irq);
diff --git a/hw/ssi.c b/hw/ssi.c
index 73cb54150..cfe7c072f 100644
--- a/hw/ssi.c
+++ b/hw/ssi.c
@@ -46,7 +46,7 @@ DeviceState *ssi_create_slave(SSIBus *bus, const char *name)
{
DeviceState *dev;
dev = qdev_create(&bus->qbus, name);
- qdev_init(dev);
+ qdev_init_nofail(dev);
return dev;
}
diff --git a/hw/stellaris.c b/hw/stellaris.c
index bcde0a297..162891447 100644
--- a/hw/stellaris.c
+++ b/hw/stellaris.c
@@ -1384,7 +1384,7 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
enet = qdev_create(NULL, "stellaris_enet");
enet->nd = &nd_table[0];
- qdev_init(enet);
+ qdev_init_nofail(enet);
sysbus_mmio_map(sysbus_from_qdev(enet), 0, 0x40048000);
sysbus_connect_irq(sysbus_from_qdev(enet), 0, pic[42]);
}
diff --git a/hw/sun4m.c b/hw/sun4m.c
index 01c7cb4a7..8f46a0f2a 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -359,7 +359,7 @@ static void *iommu_init(target_phys_addr_t addr, uint32_t version, qemu_irq irq)
dev = qdev_create(NULL, "iommu");
qdev_prop_set_uint32(dev, "version", version);
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_connect_irq(s, 0, irq);
sysbus_mmio_map(s, 0, addr);
@@ -375,7 +375,7 @@ static void *sparc32_dma_init(target_phys_addr_t daddr, qemu_irq parent_irq,
dev = qdev_create(NULL, "sparc32_dma");
qdev_prop_set_ptr(dev, "iommu_opaque", iommu);
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_connect_irq(s, 0, parent_irq);
*dev_irq = qdev_get_gpio_in(dev, 0);
@@ -396,7 +396,7 @@ static void lance_init(NICInfo *nd, target_phys_addr_t leaddr,
dev = qdev_create(NULL, "lance");
dev->nd = nd;
qdev_prop_set_ptr(dev, "dma", dma_opaque);
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_mmio_map(s, 0, leaddr);
sysbus_connect_irq(s, 0, irq);
@@ -413,7 +413,7 @@ static DeviceState *slavio_intctl_init(target_phys_addr_t addr,
unsigned int i, j;
dev = qdev_create(NULL, "slavio_intctl");
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
@@ -442,7 +442,7 @@ static void slavio_timer_init_all(target_phys_addr_t addr, qemu_irq master_irq,
dev = qdev_create(NULL, "slavio_timer");
qdev_prop_set_uint32(dev, "num_cpus", num_cpus);
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_connect_irq(s, 0, master_irq);
sysbus_mmio_map(s, 0, addr + SYS_TIMER_OFFSET);
@@ -468,7 +468,7 @@ static void slavio_misc_init(target_phys_addr_t base,
SysBusDevice *s;
dev = qdev_create(NULL, "slavio_misc");
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
if (base) {
/* 8 bit registers */
@@ -505,7 +505,7 @@ static void ecc_init(target_phys_addr_t base, qemu_irq irq, uint32_t version)
dev = qdev_create(NULL, "eccmemctl");
qdev_prop_set_uint32(dev, "version", version);
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_connect_irq(s, 0, irq);
sysbus_mmio_map(s, 0, base);
@@ -520,7 +520,7 @@ static void apc_init(target_phys_addr_t power_base, qemu_irq cpu_halt)
SysBusDevice *s;
dev = qdev_create(NULL, "apc");
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
/* Power management (APC) XXX: not a Slavio device */
sysbus_mmio_map(s, 0, power_base);
@@ -539,7 +539,7 @@ static void tcx_init(target_phys_addr_t addr, int vram_size, int width,
qdev_prop_set_uint16(dev, "width", width);
qdev_prop_set_uint16(dev, "height", height);
qdev_prop_set_uint16(dev, "depth", depth);
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
/* 8-bit plane */
sysbus_mmio_map(s, 0, addr + 0x00800000ULL);
@@ -569,7 +569,7 @@ static void idreg_init(target_phys_addr_t addr)
SysBusDevice *s;
dev = qdev_create(NULL, "macio_idreg");
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_mmio_map(s, 0, addr);
@@ -607,7 +607,7 @@ static void prom_init(target_phys_addr_t addr, const char *bios_name)
int ret;
dev = qdev_create(NULL, "openprom");
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_mmio_map(s, 0, addr);
@@ -697,7 +697,7 @@ static void ram_init(target_phys_addr_t addr, ram_addr_t RAM_size,
d = FROM_SYSBUS(RamDevice, s);
d->size = RAM_size;
- qdev_init(dev);
+ qdev_init_nofail(dev);
sysbus_mmio_map(s, 0, addr);
}
@@ -1344,7 +1344,7 @@ static DeviceState *sbi_init(target_phys_addr_t addr, qemu_irq **parent_irq)
unsigned int i;
dev = qdev_create(NULL, "sbi");
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
@@ -1534,7 +1534,7 @@ static DeviceState *sun4c_intctl_init(target_phys_addr_t addr,
unsigned int i;
dev = qdev_create(NULL, "sun4c_intctl");
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
diff --git a/hw/sun4u.c b/hw/sun4u.c
index 58d708a72..276b17b24 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -415,7 +415,7 @@ static void prom_init(target_phys_addr_t addr, const char *bios_name)
int ret;
dev = qdev_create(NULL, "openprom");
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_mmio_map(s, 0, addr);
@@ -498,7 +498,7 @@ static void ram_init(target_phys_addr_t addr, ram_addr_t RAM_size)
d = FROM_SYSBUS(RamDevice, s);
d->size = RAM_size;
- qdev_init(dev);
+ qdev_init_nofail(dev);
sysbus_mmio_map(s, 0, addr);
}
diff --git a/hw/syborg.c b/hw/syborg.c
index d8d38d48e..2aec7691f 100644
--- a/hw/syborg.c
+++ b/hw/syborg.c
@@ -65,7 +65,7 @@ static void syborg_init(ram_addr_t ram_size,
dev = qdev_create(NULL, "syborg,timer");
qdev_prop_set_uint32(dev, "frequency", 1000000);
- qdev_init(dev);
+ qdev_init_nofail(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0xC0002000);
sysbus_connect_irq(sysbus_from_qdev(dev), 0, pic[1]);
@@ -84,7 +84,7 @@ static void syborg_init(ram_addr_t ram_size,
qemu_check_nic_model(&nd_table[0], "virtio");
dev = qdev_create(NULL, "syborg,virtio-net");
dev->nd = &nd_table[0];
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
sysbus_mmio_map(s, 0, 0xc000c000);
sysbus_connect_irq(s, 0, pic[9]);
diff --git a/hw/sysbus.c b/hw/sysbus.c
index f6516fd1d..1f7f13841 100644
--- a/hw/sysbus.c
+++ b/hw/sysbus.c
@@ -143,7 +143,7 @@ DeviceState *sysbus_create_varargs(const char *name,
dev = qdev_create(NULL, name);
s = sysbus_from_qdev(dev);
- qdev_init(dev);
+ qdev_init_nofail(dev);
if (addr != (target_phys_addr_t)-1) {
sysbus_mmio_map(s, 0, addr);
}
diff --git a/hw/unin_pci.c b/hw/unin_pci.c
index a20215392..4abb5c88d 100644
--- a/hw/unin_pci.c
+++ b/hw/unin_pci.c
@@ -253,7 +253,7 @@ PCIBus *pci_pmac_init(qemu_irq *pic)
/* Use values found on a real PowerMac */
/* Uninorth main bus */
dev = qdev_create(NULL, "Uni-north main");
- qdev_init(dev);
+ qdev_init_nofail(dev);
s = sysbus_from_qdev(dev);
d = FROM_SYSBUS(UNINState, s);
d->host_state.bus = pci_register_bus(&d->busdev.qdev, "pci",
diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index 0c6327935..98987a197 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -101,7 +101,7 @@ USBDevice *usb_create(USBBus *bus, const char *name)
USBDevice *usb_create_simple(USBBus *bus, const char *name)
{
USBDevice *dev = usb_create(bus, name);
- qdev_init(&dev->qdev);
+ qdev_init_nofail(&dev->qdev);
return dev;
}
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index e090014f7..dd3010e00 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -571,7 +571,8 @@ USBDevice *usb_msd_init(const char *filename)
/* create guest device */
dev = usb_create(NULL /* FIXME */, "QEMU USB MSD");
qdev_prop_set_drive(&dev->qdev, "drive", dinfo);
- qdev_init(&dev->qdev);
+ if (qdev_init(&dev->qdev) < 0)
+ return NULL;
return dev;
}
diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index 1037e70ec..c3be3a0f6 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -130,7 +130,7 @@ int pci_vga_init(PCIBus *bus,
dev = pci_create(bus, -1, "VGA");
qdev_prop_set_uint32(&dev->qdev, "bios-offset", vga_bios_offset);
qdev_prop_set_uint32(&dev->qdev, "bios-size", vga_bios_offset);
- qdev_init(&dev->qdev);
+ qdev_init_nofail(&dev->qdev);
return 0;
}
diff --git a/hw/xilinx.h b/hw/xilinx.h
index 070679c24..5e6aeeaf6 100644
--- a/hw/xilinx.h
+++ b/hw/xilinx.h
@@ -9,7 +9,7 @@ xilinx_intc_create(target_phys_addr_t base, qemu_irq irq, int kind_of_intr)
dev = qdev_create(NULL, "xilinx,intc");
qdev_prop_set_uint32(dev, "kind-of-intr", kind_of_intr);
- qdev_init(dev);
+ qdev_init_nofail(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq);
return dev;
@@ -24,7 +24,7 @@ xilinx_timer_create(target_phys_addr_t base, qemu_irq irq, int nr, int freq)
dev = qdev_create(NULL, "xilinx,timer");
qdev_prop_set_uint32(dev, "nr-timers", nr);
qdev_prop_set_uint32(dev, "frequency", freq);
- qdev_init(dev);
+ qdev_init_nofail(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq);
return dev;
@@ -43,7 +43,7 @@ xilinx_ethlite_create(NICInfo *nd, target_phys_addr_t base, qemu_irq irq,
dev->nd = nd;
qdev_prop_set_uint32(dev, "txpingpong", txpingpong);
qdev_prop_set_uint32(dev, "rxpingpong", rxpingpong);
- qdev_init(dev);
+ qdev_init_nofail(dev);
sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq);
return dev;
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index 3b25e3101..73e74d839 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -6,6 +6,7 @@ include ../../config-host.mak
include $(SRC_PATH)/rules.mak
VPATH=$(SRC_PATH)/pc-bios/optionrom
+.PHONY : all clean build-all
CFLAGS := -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
CFLAGS += -I$(SRC_PATH)
@@ -24,4 +25,4 @@ build-all: multiboot.bin extboot.bin
$(call quiet-command,$(SHELL) $(SRC_PATH)/pc-bios/optionrom/signrom.sh $< $@," Signing $(TARGET_DIR)$@")
clean:
- $(RM) *.o *.d *.raw *.img *.bin *~
+ rm -f *.o *.d *.raw *.img *.bin *~
diff --git a/rules.mak b/rules.mak
index 54ac88ab3..ca95351d9 100644
--- a/rules.mak
+++ b/rules.mak
@@ -1,4 +1,16 @@
+# Don't use implicit rules or variables
+# we have explicit rules for everything
+MAKEFLAGS += -rR
+
+# Files with this suffixes are final, don't try to generate them
+# using implicit rules
+%.d:
+%.h:
+%.c:
+%.m:
+%.mak:
+
%.o: %.c
$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<," CC $(TARGET_DIR)$@")
@@ -23,3 +35,12 @@ quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1))
cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
>/dev/null 2>&1 && echo OK), $2, $3)
+
+# Generate timestamp files for .h include files
+
+%.h: %.h-timestamp
+ @test -f $@ || cp $< $@
+
+%.h-timestamp: %.mak
+ $(call quiet-command, $(SRC_PATH)/create_config < $< > $@, " GEN $*.h")
+ @cmp $@ $*.h >/dev/null 2>&1 || cp $@ $*.h
diff --git a/target-cris/helper.c b/target-cris/helper.c
index c0e11d1aa..a12ac10ee 100644
--- a/target-cris/helper.c
+++ b/target-cris/helper.c
@@ -82,8 +82,8 @@ int cpu_cris_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
target_ulong phy;
D(printf ("%s addr=%x pc=%x rw=%x\n", __func__, address, env->pc, rw));
- address &= TARGET_PAGE_MASK;
- miss = cris_mmu_translate(&res, env, address, rw, mmu_idx);
+ miss = cris_mmu_translate(&res, env, address & TARGET_PAGE_MASK,
+ rw, mmu_idx);
if (miss)
{
if (env->exception_index == EXCP_BUSFAULT)
@@ -92,6 +92,7 @@ int cpu_cris_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
"addr=%x rw=%d\n",
address, rw);
+ env->pregs[PR_EDA] = address;
env->exception_index = EXCP_BUSFAULT;
env->fault_vector = res.bf_vec;
r = 1;
@@ -104,7 +105,8 @@ int cpu_cris_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
*/
phy = res.phy & ~0x80000000;
prot = res.prot;
- r = tlb_set_page(env, address, phy, prot, mmu_idx, is_softmmu);
+ r = tlb_set_page(env, address & TARGET_PAGE_MASK,
+ phy, prot, mmu_idx, is_softmmu);
}
if (r > 0)
D_LOG("%s returns %d irqreq=%x addr=%x"
diff --git a/target-cris/translate.c b/target-cris/translate.c
index c6068f78f..a18d69c84 100644
--- a/target-cris/translate.c
+++ b/target-cris/translate.c
@@ -197,10 +197,6 @@ static inline void t_gen_mov_TN_preg(TCGv tn, int r)
tcg_gen_mov_tl(tn, tcg_const_tl(0));
else if (r == PR_VR)
tcg_gen_mov_tl(tn, tcg_const_tl(32));
- else if (r == PR_EDA) {
- printf("read from EDA!\n");
- tcg_gen_mov_tl(tn, cpu_PR[r]);
- }
else
tcg_gen_mov_tl(tn, cpu_PR[r]);
}
diff --git a/target-i386/translate.c b/target-i386/translate.c
index e3cb49f33..251194394 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -7305,7 +7305,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
#endif
{
int label1;
- TCGv t0, t1, t2;
+ TCGv t0, t1, t2, a0;
if (!s->pe || s->vm86)
goto illegal_op;
@@ -7320,8 +7320,11 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
if (mod != 3) {
gen_lea_modrm(s, modrm, &reg_addr, &offset_addr);
gen_op_ld_v(ot + s->mem_index, t0, cpu_A0);
+ a0 = tcg_temp_local_new();
+ tcg_gen_mov_tl(a0, cpu_A0);
} else {
gen_op_mov_v_reg(ot, t0, rm);
+ TCGV_UNUSED(a0);
}
gen_op_mov_v_reg(ot, t1, reg);
tcg_gen_andi_tl(cpu_tmp0, t0, 3);
@@ -7334,8 +7337,9 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
tcg_gen_movi_tl(t2, CC_Z);
gen_set_label(label1);
if (mod != 3) {
- gen_op_st_v(ot + s->mem_index, t0, cpu_A0);
- } else {
+ gen_op_st_v(ot + s->mem_index, t0, a0);
+ tcg_temp_free(a0);
+ } else {
gen_op_mov_reg_v(ot, rm, t0);
}
if (s->cc_op != CC_OP_DYNAMIC)
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 9f57b6a2d..3c0e296f0 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1904,7 +1904,7 @@ static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf,
#ifdef DEBUG_DISAS
if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP_OPT))) {
- qemu_log("OP after la:\n");
+ qemu_log("OP after liveness analysis:\n");
tcg_dump_ops(s, logfile);
qemu_log("\n");
}
diff --git a/usb-linux.c b/usb-linux.c
index 2b7b09214..9e5d9c40e 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -980,12 +980,14 @@ static USBDevice *usb_host_device_open_addr(int bus_num, int addr, const char *p
hostdev_link(dev);
- qdev_init(&d->qdev);
+ if (qdev_init(&d->qdev) < 0)
+ goto fail_no_qdev;
return (USBDevice *) dev;
fail:
if (d)
qdev_free(&d->qdev);
+fail_no_qdev:
if (fd != -1)
close(fd);
return NULL;
@@ -1389,15 +1391,13 @@ static int usb_host_auto_scan(void *opaque, int bus_num, int addr,
/* We got a match */
- /* Allredy attached ? */
+ /* Already attached ? */
if (hostdev_find(bus_num, addr))
return 0;
dprintf("husb: auto open: bus_num %d addr %d\n", bus_num, addr);
dev = usb_host_device_open_addr(bus_num, addr, product_name);
- if (dev)
- qdev_init(&dev->qdev);
}
return 0;