diff --git a/hw/alpha/Makefile.objs b/hw/alpha/Makefile.objs
index af1c07f..34c6bdb 100644
--- a/hw/alpha/Makefile.objs
+++ b/hw/alpha/Makefile.objs
@@ -1,4 +1,6 @@
 obj-y = mc146818rtc.o
-obj-y += alpha_pci.o alpha_dp264.o alpha_typhoon.o
+obj-y += alpha_typhoon.o
 
 obj-y := $(addprefix ../,$(obj-y))
+
+obj-y += pci.o dp264.o
diff --git a/hw/alpha_dp264.c b/hw/alpha/dp264.c
similarity index 100%
rename from hw/alpha_dp264.c
rename to hw/alpha/dp264.c
diff --git a/hw/alpha_pci.c b/hw/alpha/pci.c
similarity index 100%
rename from hw/alpha_pci.c
rename to hw/alpha/pci.c
diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs
index 6d049e7..8067e70 100644
--- a/hw/arm/Makefile.objs
+++ b/hw/arm/Makefile.objs
@@ -1,35 +1,51 @@
-obj-y = integratorcp.o versatilepb.o arm_pic.o
-obj-y += arm_boot.o
-obj-y += xilinx_zynq.o zynq_slcr.o
 obj-y += xilinx_spips.o
-obj-y += arm_gic.o arm_gic_common.o
-obj-y += realview_gic.o realview.o arm_sysctl.o arm11mpcore.o a9mpcore.o
-obj-y += exynos4210_gic.o exynos4210_combiner.o exynos4210.o
-obj-y += exynos4_boards.o exynos4210_uart.o exynos4210_pwm.o
-obj-y += exynos4210_pmu.o exynos4210_mct.o exynos4210_fimd.o
+obj-y += arm_mptimer.o
+obj-y += exynos4210_uart.o exynos4210_pwm.o
+obj-y += exynos4210_mct.o exynos4210_fimd.o
 obj-y += exynos4210_rtc.o exynos4210_i2c.o
-obj-y += arm_mptimer.o a15mpcore.o
-obj-y += armv7m.o armv7m_nvic.o stellaris.o stellaris_enet.o
-obj-y += highbank.o
-obj-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_timer.o pxa2xx_dma.o
+obj-y += stellaris_enet.o
+obj-y += pxa2xx_timer.o
 obj-y += pxa2xx_lcd.o pxa2xx_mmci.o pxa2xx_pcmcia.o pxa2xx_keypad.o
-obj-y += gumstix.o
-obj-y += zaurus.o ide/microdrive.o spitz.o tosa.o tc6393xb.o
-obj-y += omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o \
-                omap_gpio.o omap_intc.o omap_uart.o
-obj-y += omap2.o omap_dss.o soc_dma.o omap_gptimer.o omap_synctimer.o \
-                omap_gpmc.o omap_sdrc.o omap_spi.o omap_tap.o omap_l4.o
-obj-y += omap_sx1.o palm.o tsc210x.o
-obj-y += nseries.o blizzard.o onenand.o cbus.o tusb6010.o usb/hcd-musb.o
-obj-y += mst_fpga.o mainstone.o
-obj-y += z2.o
-obj-y += musicpal.o bitbang_i2c.o marvell_88w8618_audio.o
+obj-y += ide/microdrive.o
+obj-y += omap_lcdc.o omap_mmc.o omap_i2c.o omap_uart.o
+obj-y += omap_dss.o omap_gptimer.o omap_synctimer.o
+obj-y += tsc210x.o
+obj-y += blizzard.o onenand.o tusb6010.o usb/hcd-musb.o
+obj-y += bitbang_i2c.o marvell_88w8618_audio.o
 obj-y += framebuffer.o
+obj-y += imx_serial.o imx_timer.o
+obj-$(CONFIG_FDT) += ../device_tree.o
+
+obj-y := $(addprefix ../,$(obj-y))
+
+obj-y += integratorcp.o versatilepb.o pic.o
+obj-y += arm_sysctl.o
+obj-y += boot.o
+obj-y += xilinx_zynq.o zynq_slcr.o
+obj-y += gic.o gic_common.o
+obj-y += realview_gic.o realview.o arm11mpcore.o a9mpcore.o
+obj-y += exynos4210_gic.o exynos4210_combiner.o exynos4210.o
+obj-y += exynos4_boards.o exynos4210_pmu.o
+
+obj-y += a15mpcore.o
+obj-y += armv7m.o armv7m_nvic.o stellaris.o
+obj-y += highbank.o
+obj-y += pxa2xx.o pxa2xx_pic.o pxa2xx_gpio.o pxa2xx_dma.o
+
+obj-y += gumstix.o
+obj-y += zaurus.o spitz.o tosa.o tc6393xb.o
+obj-y += omap1.o omap_dma.o omap_clk.o omap_gpio.o omap_intc.o
+obj-y += omap2.o soc_dma.o
+obj-y += omap_gpmc.o omap_sdrc.o omap_spi.o omap_tap.o omap_l4.o
+obj-y += omap_sx1.o palm.o
+
+obj-y += mainstone.o
+obj-y += mst_fpga.o
+obj-y += musicpal.o
+obj-y += nseries.o cbus.o
 obj-y += vexpress.o
 obj-y += strongarm.o
 obj-y += collie.o
-obj-y += imx_serial.o imx_ccm.o imx_timer.o imx_avic.o
+obj-y += imx_ccm.o imx_avic.o
 obj-y += kzm.o
-obj-$(CONFIG_FDT) += ../device_tree.o
 
-obj-y := $(addprefix ../,$(obj-y))
diff --git a/hw/a15mpcore.c b/hw/arm/a15mpcore.c
similarity index 100%
rename from hw/a15mpcore.c
rename to hw/arm/a15mpcore.c
diff --git a/hw/a9mpcore.c b/hw/arm/a9mpcore.c
similarity index 100%
rename from hw/a9mpcore.c
rename to hw/arm/a9mpcore.c
diff --git a/hw/arm11mpcore.c b/hw/arm/arm11mpcore.c
similarity index 100%
rename from hw/arm11mpcore.c
rename to hw/arm/arm11mpcore.c
diff --git a/hw/arm_sysctl.c b/hw/arm/arm_sysctl.c
similarity index 100%
rename from hw/arm_sysctl.c
rename to hw/arm/arm_sysctl.c
diff --git a/hw/armv7m.c b/hw/arm/armv7m.c
similarity index 100%
rename from hw/armv7m.c
rename to hw/arm/armv7m.c
diff --git a/hw/armv7m_nvic.c b/hw/arm/armv7m_nvic.c
similarity index 100%
rename from hw/armv7m_nvic.c
rename to hw/arm/armv7m_nvic.c
diff --git a/hw/arm_boot.c b/hw/arm/boot.c
similarity index 100%
rename from hw/arm_boot.c
rename to hw/arm/boot.c
diff --git a/hw/cbus.c b/hw/arm/cbus.c
similarity index 100%
rename from hw/cbus.c
rename to hw/arm/cbus.c
diff --git a/hw/collie.c b/hw/arm/collie.c
similarity index 100%
rename from hw/collie.c
rename to hw/arm/collie.c
diff --git a/hw/exynos4210.c b/hw/arm/exynos4210.c
similarity index 100%
rename from hw/exynos4210.c
rename to hw/arm/exynos4210.c
diff --git a/hw/exynos4210_combiner.c b/hw/arm/exynos4210_combiner.c
similarity index 100%
rename from hw/exynos4210_combiner.c
rename to hw/arm/exynos4210_combiner.c
diff --git a/hw/exynos4210_gic.c b/hw/arm/exynos4210_gic.c
similarity index 100%
rename from hw/exynos4210_gic.c
rename to hw/arm/exynos4210_gic.c
diff --git a/hw/exynos4210_pmu.c b/hw/arm/exynos4210_pmu.c
similarity index 100%
rename from hw/exynos4210_pmu.c
rename to hw/arm/exynos4210_pmu.c
diff --git a/hw/exynos4_boards.c b/hw/arm/exynos4_boards.c
similarity index 100%
rename from hw/exynos4_boards.c
rename to hw/arm/exynos4_boards.c
diff --git a/hw/arm_gic.c b/hw/arm/gic.c
similarity index 100%
rename from hw/arm_gic.c
rename to hw/arm/gic.c
diff --git a/hw/arm_gic_common.c b/hw/arm/gic_common.c
similarity index 100%
rename from hw/arm_gic_common.c
rename to hw/arm/gic_common.c
diff --git a/hw/gumstix.c b/hw/arm/gumstix.c
similarity index 100%
rename from hw/gumstix.c
rename to hw/arm/gumstix.c
diff --git a/hw/highbank.c b/hw/arm/highbank.c
similarity index 100%
rename from hw/highbank.c
rename to hw/arm/highbank.c
diff --git a/hw/imx_avic.c b/hw/arm/imx_avic.c
similarity index 100%
rename from hw/imx_avic.c
rename to hw/arm/imx_avic.c
diff --git a/hw/imx_ccm.c b/hw/arm/imx_ccm.c
similarity index 100%
rename from hw/imx_ccm.c
rename to hw/arm/imx_ccm.c
diff --git a/hw/integratorcp.c b/hw/arm/integratorcp.c
similarity index 100%
rename from hw/integratorcp.c
rename to hw/arm/integratorcp.c
diff --git a/hw/kzm.c b/hw/arm/kzm.c
similarity index 100%
rename from hw/kzm.c
rename to hw/arm/kzm.c
diff --git a/hw/mainstone.c b/hw/arm/mainstone.c
similarity index 100%
rename from hw/mainstone.c
rename to hw/arm/mainstone.c
diff --git a/hw/mst_fpga.c b/hw/arm/mst_fpga.c
similarity index 100%
rename from hw/mst_fpga.c
rename to hw/arm/mst_fpga.c
diff --git a/hw/musicpal.c b/hw/arm/musicpal.c
similarity index 100%
rename from hw/musicpal.c
rename to hw/arm/musicpal.c
diff --git a/hw/nseries.c b/hw/arm/nseries.c
similarity index 100%
rename from hw/nseries.c
rename to hw/arm/nseries.c
diff --git a/hw/omap1.c b/hw/arm/omap1.c
similarity index 100%
rename from hw/omap1.c
rename to hw/arm/omap1.c
diff --git a/hw/omap2.c b/hw/arm/omap2.c
similarity index 100%
rename from hw/omap2.c
rename to hw/arm/omap2.c
diff --git a/hw/omap_clk.c b/hw/arm/omap_clk.c
similarity index 100%
rename from hw/omap_clk.c
rename to hw/arm/omap_clk.c
diff --git a/hw/omap_dma.c b/hw/arm/omap_dma.c
similarity index 100%
rename from hw/omap_dma.c
rename to hw/arm/omap_dma.c
diff --git a/hw/omap_gpio.c b/hw/arm/omap_gpio.c
similarity index 100%
rename from hw/omap_gpio.c
rename to hw/arm/omap_gpio.c
diff --git a/hw/omap_gpmc.c b/hw/arm/omap_gpmc.c
similarity index 100%
rename from hw/omap_gpmc.c
rename to hw/arm/omap_gpmc.c
diff --git a/hw/omap_intc.c b/hw/arm/omap_intc.c
similarity index 100%
rename from hw/omap_intc.c
rename to hw/arm/omap_intc.c
diff --git a/hw/omap_l4.c b/hw/arm/omap_l4.c
similarity index 100%
rename from hw/omap_l4.c
rename to hw/arm/omap_l4.c
diff --git a/hw/omap_sdrc.c b/hw/arm/omap_sdrc.c
similarity index 100%
rename from hw/omap_sdrc.c
rename to hw/arm/omap_sdrc.c
diff --git a/hw/omap_spi.c b/hw/arm/omap_spi.c
similarity index 100%
rename from hw/omap_spi.c
rename to hw/arm/omap_spi.c
diff --git a/hw/omap_sx1.c b/hw/arm/omap_sx1.c
similarity index 100%
rename from hw/omap_sx1.c
rename to hw/arm/omap_sx1.c
diff --git a/hw/omap_tap.c b/hw/arm/omap_tap.c
similarity index 100%
rename from hw/omap_tap.c
rename to hw/arm/omap_tap.c
diff --git a/hw/palm.c b/hw/arm/palm.c
similarity index 100%
rename from hw/palm.c
rename to hw/arm/palm.c
diff --git a/hw/arm_pic.c b/hw/arm/pic.c
similarity index 100%
rename from hw/arm_pic.c
rename to hw/arm/pic.c
diff --git a/hw/pxa2xx.c b/hw/arm/pxa2xx.c
similarity index 100%
rename from hw/pxa2xx.c
rename to hw/arm/pxa2xx.c
diff --git a/hw/pxa2xx_dma.c b/hw/arm/pxa2xx_dma.c
similarity index 100%
rename from hw/pxa2xx_dma.c
rename to hw/arm/pxa2xx_dma.c
diff --git a/hw/pxa2xx_gpio.c b/hw/arm/pxa2xx_gpio.c
similarity index 100%
rename from hw/pxa2xx_gpio.c
rename to hw/arm/pxa2xx_gpio.c
diff --git a/hw/pxa2xx_pic.c b/hw/arm/pxa2xx_pic.c
similarity index 100%
rename from hw/pxa2xx_pic.c
rename to hw/arm/pxa2xx_pic.c
diff --git a/hw/realview.c b/hw/arm/realview.c
similarity index 100%
rename from hw/realview.c
rename to hw/arm/realview.c
diff --git a/hw/realview_gic.c b/hw/arm/realview_gic.c
similarity index 100%
rename from hw/realview_gic.c
rename to hw/arm/realview_gic.c
diff --git a/hw/soc_dma.c b/hw/arm/soc_dma.c
similarity index 100%
rename from hw/soc_dma.c
rename to hw/arm/soc_dma.c
diff --git a/hw/spitz.c b/hw/arm/spitz.c
similarity index 100%
rename from hw/spitz.c
rename to hw/arm/spitz.c
diff --git a/hw/stellaris.c b/hw/arm/stellaris.c
similarity index 100%
rename from hw/stellaris.c
rename to hw/arm/stellaris.c
diff --git a/hw/strongarm.c b/hw/arm/strongarm.c
similarity index 100%
rename from hw/strongarm.c
rename to hw/arm/strongarm.c
diff --git a/hw/tc6393xb.c b/hw/arm/tc6393xb.c
similarity index 100%
rename from hw/tc6393xb.c
rename to hw/arm/tc6393xb.c
diff --git a/hw/tosa.c b/hw/arm/tosa.c
similarity index 100%
rename from hw/tosa.c
rename to hw/arm/tosa.c
diff --git a/hw/versatilepb.c b/hw/arm/versatilepb.c
similarity index 100%
rename from hw/versatilepb.c
rename to hw/arm/versatilepb.c
diff --git a/hw/vexpress.c b/hw/arm/vexpress.c
similarity index 100%
rename from hw/vexpress.c
rename to hw/arm/vexpress.c
diff --git a/hw/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
similarity index 100%
rename from hw/xilinx_zynq.c
rename to hw/arm/xilinx_zynq.c
diff --git a/hw/z2.c b/hw/arm/z2.c
similarity index 100%
rename from hw/z2.c
rename to hw/arm/z2.c
diff --git a/hw/zaurus.c b/hw/arm/zaurus.c
similarity index 100%
rename from hw/zaurus.c
rename to hw/arm/zaurus.c
diff --git a/hw/zynq_slcr.c b/hw/arm/zynq_slcr.c
similarity index 100%
rename from hw/zynq_slcr.c
rename to hw/arm/zynq_slcr.c
diff --git a/hw/cris/Makefile.objs b/hw/cris/Makefile.objs
index aa9298a..b7d3849 100644
--- a/hw/cris/Makefile.objs
+++ b/hw/cris/Makefile.objs
@@ -1,13 +1,14 @@
+obj-y += etraxfs_eth.o
+obj-y += etraxfs_timer.o
+obj-y += etraxfs_ser.o
+
+obj-y := $(addprefix ../,$(obj-y))
+
 # Boards
-obj-y = cris_pic_cpu.o
-obj-y += cris-boot.o
+obj-y += pic_cpu.o
+obj-y += boot.o
 obj-y += axis_dev88.o
 
 # IO blocks
 obj-y += etraxfs_dma.o
 obj-y += etraxfs_pic.o
-obj-y += etraxfs_eth.o
-obj-y += etraxfs_timer.o
-obj-y += etraxfs_ser.o
-
-obj-y := $(addprefix ../,$(obj-y))
diff --git a/hw/axis_dev88.c b/hw/cris/axis_dev88.c
similarity index 100%
rename from hw/axis_dev88.c
rename to hw/cris/axis_dev88.c
diff --git a/hw/cris-boot.c b/hw/cris/boot.c
similarity index 100%
rename from hw/cris-boot.c
rename to hw/cris/boot.c
diff --git a/hw/etraxfs_dma.c b/hw/cris/etraxfs_dma.c
similarity index 100%
rename from hw/etraxfs_dma.c
rename to hw/cris/etraxfs_dma.c
diff --git a/hw/etraxfs_pic.c b/hw/cris/etraxfs_pic.c
similarity index 100%
rename from hw/etraxfs_pic.c
rename to hw/cris/etraxfs_pic.c
diff --git a/hw/cris_pic_cpu.c b/hw/cris/pic_cpu.c
similarity index 100%
rename from hw/cris_pic_cpu.c
rename to hw/cris/pic_cpu.c
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 025803a..364f4ba 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -1,17 +1,23 @@
-obj-y += mc146818rtc.o pc.o
-obj-y += apic_common.o apic.o kvmvapic.o
-obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o
-obj-y += vmport.o
-obj-y += pci/pci-hotplug.o smbios.o wdt_ib700.o
-obj-y += debugcon.o debugexit.o multiboot.o
-obj-y += pc_piix.o
-obj-y += pc_sysfw.o
-obj-y += lpc_ich9.o q35.o pc_q35.o
-obj-$(CONFIG_XEN) += xen_platform.o xen_apic.o
+obj-y += mc146818rtc.o
+obj-y += piix_pci.o
+obj-y += pci/pci-hotplug.o wdt_ib700.o
+obj-y += debugcon.o debugexit.o
+obj-y += lpc_ich9.o q35.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
 obj-y += kvm/
 obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
-obj-y += pc-testdev.o
 
 obj-y := $(addprefix ../,$(obj-y))
+
+obj-y += apic_common.o apic.o kvmvapic.o
+obj-y += sga.o ioapic_common.o ioapic.o
+obj-y += vmport.o
+obj-y += multiboot.o
+obj-y += pc.o
+obj-y += pc_piix.o
+obj-y += pc_q35.o
+obj-y += pc_sysfw.o
+obj-y += pc-testdev.o
+obj-y += smbios.o
+obj-$(CONFIG_XEN) += xen_platform.o xen_apic.o
diff --git a/hw/apic.c b/hw/i386/apic.c
similarity index 100%
rename from hw/apic.c
rename to hw/i386/apic.c
diff --git a/hw/apic_common.c b/hw/i386/apic_common.c
similarity index 100%
rename from hw/apic_common.c
rename to hw/i386/apic_common.c
diff --git a/hw/ioapic.c b/hw/i386/ioapic.c
similarity index 100%
rename from hw/ioapic.c
rename to hw/i386/ioapic.c
diff --git a/hw/ioapic_common.c b/hw/i386/ioapic_common.c
similarity index 100%
rename from hw/ioapic_common.c
rename to hw/i386/ioapic_common.c
diff --git a/hw/kvmvapic.c b/hw/i386/kvmvapic.c
similarity index 100%
rename from hw/kvmvapic.c
rename to hw/i386/kvmvapic.c
diff --git a/hw/multiboot.c b/hw/i386/multiboot.c
similarity index 100%
rename from hw/multiboot.c
rename to hw/i386/multiboot.c
diff --git a/hw/pc-testdev.c b/hw/i386/pc-testdev.c
similarity index 100%
rename from hw/pc-testdev.c
rename to hw/i386/pc-testdev.c
diff --git a/hw/pc.c b/hw/i386/pc.c
similarity index 100%
rename from hw/pc.c
rename to hw/i386/pc.c
diff --git a/hw/pc_piix.c b/hw/i386/pc_piix.c
similarity index 100%
rename from hw/pc_piix.c
rename to hw/i386/pc_piix.c
diff --git a/hw/pc_q35.c b/hw/i386/pc_q35.c
similarity index 100%
rename from hw/pc_q35.c
rename to hw/i386/pc_q35.c
diff --git a/hw/pc_sysfw.c b/hw/i386/pc_sysfw.c
similarity index 100%
rename from hw/pc_sysfw.c
rename to hw/i386/pc_sysfw.c
diff --git a/hw/sga.c b/hw/i386/sga.c
similarity index 100%
rename from hw/sga.c
rename to hw/i386/sga.c
diff --git a/hw/smbios.c b/hw/i386/smbios.c
similarity index 100%
rename from hw/smbios.c
rename to hw/i386/smbios.c
diff --git a/hw/vmport.c b/hw/i386/vmport.c
similarity index 100%
rename from hw/vmport.c
rename to hw/i386/vmport.c
diff --git a/hw/xen_apic.c b/hw/i386/xen_apic.c
similarity index 100%
rename from hw/xen_apic.c
rename to hw/i386/xen_apic.c
diff --git a/hw/xen_machine_pv.c b/hw/i386/xen_machine_pv.c
similarity index 100%
rename from hw/xen_machine_pv.c
rename to hw/i386/xen_machine_pv.c
diff --git a/hw/xen_platform.c b/hw/i386/xen_platform.c
similarity index 100%
rename from hw/xen_platform.c
rename to hw/i386/xen_platform.c
diff --git a/hw/lm32/Makefile.objs b/hw/lm32/Makefile.objs
index 4e1843c..a8c2197 100644
--- a/hw/lm32/Makefile.objs
+++ b/hw/lm32/Makefile.objs
@@ -1,23 +1,24 @@
-# LM32 boards
-obj-y += lm32_boards.o
-obj-y += milkymist.o
-
-# LM32 peripherals
-obj-y += lm32_pic.o
 obj-y += lm32_juart.o
 obj-y += lm32_timer.o
 obj-y += lm32_uart.o
-obj-y += lm32_sys.o
 obj-y += milkymist-ac97.o
-obj-y += milkymist-hpdmc.o
 obj-y += milkymist-memcard.o
 obj-y += milkymist-minimac2.o
-obj-y += milkymist-pfpu.o
 obj-y += milkymist-softusb.o
-obj-y += milkymist-sysctl.o
 obj-$(CONFIG_OPENGL) += milkymist-tmu2.o
 obj-y += milkymist-uart.o
 obj-y += milkymist-vgafb.o
 obj-y += framebuffer.o
 
 obj-y := $(addprefix ../,$(obj-y))
+
+# LM32 boards
+obj-y += lm32_boards.o
+obj-y += milkymist.o
+
+# LM32 peripherals
+obj-y += lm32_pic.o
+obj-y += lm32_sys.o
+obj-y += milkymist-hpdmc.o
+obj-y += milkymist-pfpu.o
+obj-y += milkymist-sysctl.o
diff --git a/hw/lm32_boards.c b/hw/lm32/lm32_boards.c
similarity index 100%
rename from hw/lm32_boards.c
rename to hw/lm32/lm32_boards.c
diff --git a/hw/lm32_pic.c b/hw/lm32/lm32_pic.c
similarity index 100%
rename from hw/lm32_pic.c
rename to hw/lm32/lm32_pic.c
diff --git a/hw/lm32_sys.c b/hw/lm32/lm32_sys.c
similarity index 100%
rename from hw/lm32_sys.c
rename to hw/lm32/lm32_sys.c
diff --git a/hw/milkymist-hpdmc.c b/hw/lm32/milkymist-hpdmc.c
similarity index 100%
rename from hw/milkymist-hpdmc.c
rename to hw/lm32/milkymist-hpdmc.c
diff --git a/hw/milkymist-pfpu.c b/hw/lm32/milkymist-pfpu.c
similarity index 100%
rename from hw/milkymist-pfpu.c
rename to hw/lm32/milkymist-pfpu.c
diff --git a/hw/milkymist-sysctl.c b/hw/lm32/milkymist-sysctl.c
similarity index 100%
rename from hw/milkymist-sysctl.c
rename to hw/lm32/milkymist-sysctl.c
diff --git a/hw/milkymist.c b/hw/lm32/milkymist.c
similarity index 100%
rename from hw/milkymist.c
rename to hw/lm32/milkymist.c
diff --git a/hw/m68k/Makefile.objs b/hw/m68k/Makefile.objs
index 93b6d25..4d19b02 100644
--- a/hw/m68k/Makefile.objs
+++ b/hw/m68k/Makefile.objs
@@ -1,4 +1,6 @@
-obj-y = an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
-obj-y += dummy_m68k.o
+obj-y = mcf_uart.o mcf_fec.o
 
 obj-y := $(addprefix ../,$(obj-y))
+
+obj-y += an5206.o mcf_intc.o mcf5206.o mcf5208.o
+obj-y += dummy_m68k.o
diff --git a/hw/an5206.c b/hw/m68k/an5206.c
similarity index 100%
rename from hw/an5206.c
rename to hw/m68k/an5206.c
diff --git a/hw/dummy_m68k.c b/hw/m68k/dummy_m68k.c
similarity index 100%
rename from hw/dummy_m68k.c
rename to hw/m68k/dummy_m68k.c
diff --git a/hw/mcf5206.c b/hw/m68k/mcf5206.c
similarity index 100%
rename from hw/mcf5206.c
rename to hw/m68k/mcf5206.c
diff --git a/hw/mcf5208.c b/hw/m68k/mcf5208.c
similarity index 100%
rename from hw/mcf5208.c
rename to hw/m68k/mcf5208.c
diff --git a/hw/mcf_intc.c b/hw/m68k/mcf_intc.c
similarity index 100%
rename from hw/mcf_intc.c
rename to hw/m68k/mcf_intc.c
diff --git a/hw/microblaze/Makefile.objs b/hw/microblaze/Makefile.objs
index 3028e65..b5cd920 100644
--- a/hw/microblaze/Makefile.objs
+++ b/hw/microblaze/Makefile.objs
@@ -1,10 +1,12 @@
-obj-y = petalogix_s3adsp1800_mmu.o
-obj-y += petalogix_ml605_mmu.o
-obj-y += microblaze_boot.o
 obj-y += xilinx_spi.o
 
-obj-y += microblaze_pic_cpu.o
 obj-y += xilinx_ethlite.o
 obj-$(CONFIG_FDT) += ../device_tree.o
 
 obj-y := $(addprefix ../,$(obj-y))
+
+obj-y = petalogix_s3adsp1800_mmu.o
+obj-y += petalogix_ml605_mmu.o
+
+obj-y += boot.o
+obj-y += pic_cpu.o
diff --git a/hw/microblaze_boot.c b/hw/microblaze/boot.c
similarity index 100%
rename from hw/microblaze_boot.c
rename to hw/microblaze/boot.c
diff --git a/hw/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_ml605_mmu.c
similarity index 100%
rename from hw/petalogix_ml605_mmu.c
rename to hw/microblaze/petalogix_ml605_mmu.c
diff --git a/hw/petalogix_s3adsp1800_mmu.c b/hw/microblaze/petalogix_s3adsp1800_mmu.c
similarity index 100%
rename from hw/petalogix_s3adsp1800_mmu.c
rename to hw/microblaze/petalogix_s3adsp1800_mmu.c
diff --git a/hw/microblaze_pic_cpu.c b/hw/microblaze/pic_cpu.c
similarity index 100%
rename from hw/microblaze_pic_cpu.c
rename to hw/microblaze/pic_cpu.c
diff --git a/hw/mips/Makefile.objs b/hw/mips/Makefile.objs
index 29a5d0d..1e3bca1 100644
--- a/hw/mips/Makefile.objs
+++ b/hw/mips/Makefile.objs
@@ -1,6 +1,8 @@
-obj-y = mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
-obj-y += mips_addr.o mips_timer.o mips_int.o
 obj-y += gt64xxx.o mc146818rtc.o
-obj-$(CONFIG_FULONG) += bonito.o vt82c686.o mips_fulong2e.o
+obj-$(CONFIG_FULONG) += bonito.o vt82c686.o
 
 obj-y := $(addprefix ../,$(obj-y))
+
+obj-y += mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
+obj-y += addr.o cputimer.o mips_int.o
+obj-$(CONFIG_FULONG) += mips_fulong2e.o
diff --git a/hw/mips_addr.c b/hw/mips/addr.c
similarity index 100%
rename from hw/mips_addr.c
rename to hw/mips/addr.c
diff --git a/hw/mips_timer.c b/hw/mips/cputimer.c
similarity index 100%
rename from hw/mips_timer.c
rename to hw/mips/cputimer.c
diff --git a/hw/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
similarity index 100%
rename from hw/mips_fulong2e.c
rename to hw/mips/mips_fulong2e.c
diff --git a/hw/mips_int.c b/hw/mips/mips_int.c
similarity index 100%
rename from hw/mips_int.c
rename to hw/mips/mips_int.c
diff --git a/hw/mips_jazz.c b/hw/mips/mips_jazz.c
similarity index 100%
rename from hw/mips_jazz.c
rename to hw/mips/mips_jazz.c
diff --git a/hw/mips_malta.c b/hw/mips/mips_malta.c
similarity index 100%
rename from hw/mips_malta.c
rename to hw/mips/mips_malta.c
diff --git a/hw/mips_mipssim.c b/hw/mips/mips_mipssim.c
similarity index 100%
rename from hw/mips_mipssim.c
rename to hw/mips/mips_mipssim.c
diff --git a/hw/mips_r4k.c b/hw/mips/mips_r4k.c
similarity index 100%
rename from hw/mips_r4k.c
rename to hw/mips/mips_r4k.c
diff --git a/hw/openrisc/Makefile.objs b/hw/openrisc/Makefile.objs
index 38ff8f5..f18ff92 100644
--- a/hw/openrisc/Makefile.objs
+++ b/hw/openrisc/Makefile.objs
@@ -1,3 +1 @@
 obj-y = openrisc_pic.o openrisc_sim.o openrisc_timer.o
-
-obj-y := $(addprefix ../,$(obj-y))
diff --git a/hw/openrisc_pic.c b/hw/openrisc/openrisc_pic.c
similarity index 100%
rename from hw/openrisc_pic.c
rename to hw/openrisc/openrisc_pic.c
diff --git a/hw/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
similarity index 100%
rename from hw/openrisc_sim.c
rename to hw/openrisc/openrisc_sim.c
diff --git a/hw/openrisc_timer.c b/hw/openrisc/openrisc_timer.c
similarity index 100%
rename from hw/openrisc_timer.c
rename to hw/openrisc/openrisc_timer.c
diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs
index f762050..6445ecd 100644
--- a/hw/ppc/Makefile.objs
+++ b/hw/ppc/Makefile.objs
@@ -1,21 +1,10 @@
-# shared objects
-obj-y = ppc.o ppc_booke.o
 # PREP target
 obj-y += mc146818rtc.o
 # IBM pSeries (sPAPR)
-obj-$(CONFIG_PSERIES) += spapr.o spapr_hcall.o spapr_rtas.o spapr_vio.o
-obj-$(CONFIG_PSERIES) += xics.o spapr_vty.o spapr_llan.o spapr_vscsi.o
-obj-$(CONFIG_PSERIES) += spapr_pci.o pci/pci-hotplug.o spapr_iommu.o
-obj-$(CONFIG_PSERIES) += spapr_events.o spapr_nvram.o
+obj-$(CONFIG_PSERIES) += spapr_vty.o spapr_llan.o spapr_vscsi.o
+obj-$(CONFIG_PSERIES) += spapr_pci.o pci/pci-hotplug.o
 # PowerPC 4xx boards
-obj-y += ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
-obj-y += ppc440_bamboo.o
-# PowerPC E500 boards
-obj-$(CONFIG_FDT) += mpc8544_guts.o ppce500_spin.o
-# PowerPC 440 Xilinx ML507 reference board.
-obj-y += virtex_ml507.o
-# PowerPC OpenPIC
-obj-y += openpic.o
+obj-y += ppc4xx_pci.o
 obj-$(CONFIG_FDT) += ../device_tree.o
 
 # Xilinx PPC peripherals
@@ -23,6 +12,8 @@ obj-y += xilinx_ethlite.o
 
 obj-y := $(addprefix ../,$(obj-y))
 
+# shared objects
+obj-y = ppc.o ppc_booke.o
 # PReP
 obj-y += prep.o
 # OldWorld PowerMac
@@ -31,3 +22,17 @@ obj-y += mac_oldworld.o
 obj-y += mac_newworld.o
 # e500
 obj-$(CONFIG_FDT) += e500.o mpc8544ds.o e500plat.o
+# PowerPC E500 boards
+obj-$(CONFIG_FDT) += mpc8544_guts.o ppce500_spin.o
+# PowerPC 4xx boards
+obj-y += ppc4xx_devs.o ppc405_uc.o ppc405_boards.o
+obj-y += ppc440_bamboo.o
+# PowerPC 440 Xilinx ML507 reference board.
+obj-y += virtex_ml507.o
+# PowerPC OpenPIC
+obj-y += openpic.o
+# IBM pSeries (sPAPR)
+obj-$(CONFIG_PSERIES) += spapr.o spapr_hcall.o spapr_rtas.o spapr_vio.o
+obj-$(CONFIG_PSERIES) += xics.o
+obj-$(CONFIG_PSERIES) += spapr_iommu.o
+obj-$(CONFIG_PSERIES) += spapr_events.o spapr_nvram.o
diff --git a/hw/ppce500_spin.c b/hw/ppc/e500_spin.c
similarity index 100%
rename from hw/ppce500_spin.c
rename to hw/ppc/e500_spin.c
diff --git a/hw/mpc8544_guts.c b/hw/ppc/mpc8544_guts.c
similarity index 100%
rename from hw/mpc8544_guts.c
rename to hw/ppc/mpc8544_guts.c
diff --git a/hw/openpic.c b/hw/ppc/openpic.c
similarity index 100%
rename from hw/openpic.c
rename to hw/ppc/openpic.c
diff --git a/hw/ppc.c b/hw/ppc/ppc.c
similarity index 100%
rename from hw/ppc.c
rename to hw/ppc/ppc.c
diff --git a/hw/ppc405_boards.c b/hw/ppc/ppc405_boards.c
similarity index 100%
rename from hw/ppc405_boards.c
rename to hw/ppc/ppc405_boards.c
diff --git a/hw/ppc405_uc.c b/hw/ppc/ppc405_uc.c
similarity index 100%
rename from hw/ppc405_uc.c
rename to hw/ppc/ppc405_uc.c
diff --git a/hw/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c
similarity index 100%
rename from hw/ppc440_bamboo.c
rename to hw/ppc/ppc440_bamboo.c
diff --git a/hw/ppc4xx_devs.c b/hw/ppc/ppc4xx_devs.c
similarity index 100%
rename from hw/ppc4xx_devs.c
rename to hw/ppc/ppc4xx_devs.c
diff --git a/hw/ppc_booke.c b/hw/ppc/ppc_booke.c
similarity index 100%
rename from hw/ppc_booke.c
rename to hw/ppc/ppc_booke.c
diff --git a/hw/spapr.c b/hw/ppc/spapr.c
similarity index 100%
rename from hw/spapr.c
rename to hw/ppc/spapr.c
diff --git a/hw/spapr_events.c b/hw/ppc/spapr_events.c
similarity index 100%
rename from hw/spapr_events.c
rename to hw/ppc/spapr_events.c
diff --git a/hw/spapr_hcall.c b/hw/ppc/spapr_hcall.c
similarity index 100%
rename from hw/spapr_hcall.c
rename to hw/ppc/spapr_hcall.c
diff --git a/hw/spapr_iommu.c b/hw/ppc/spapr_iommu.c
similarity index 100%
rename from hw/spapr_iommu.c
rename to hw/ppc/spapr_iommu.c
diff --git a/hw/spapr_nvram.c b/hw/ppc/spapr_nvram.c
similarity index 100%
rename from hw/spapr_nvram.c
rename to hw/ppc/spapr_nvram.c
diff --git a/hw/spapr_rtas.c b/hw/ppc/spapr_rtas.c
similarity index 100%
rename from hw/spapr_rtas.c
rename to hw/ppc/spapr_rtas.c
diff --git a/hw/spapr_vio.c b/hw/ppc/spapr_vio.c
similarity index 100%
rename from hw/spapr_vio.c
rename to hw/ppc/spapr_vio.c
diff --git a/hw/virtex_ml507.c b/hw/ppc/virtex_ml507.c
similarity index 100%
rename from hw/virtex_ml507.c
rename to hw/ppc/virtex_ml507.c
diff --git a/hw/xics.c b/hw/ppc/xics.c
similarity index 100%
rename from hw/xics.c
rename to hw/ppc/xics.c
diff --git a/hw/sh4/Makefile.objs b/hw/sh4/Makefile.objs
index 68c5921..ecb5e31 100644
--- a/hw/sh4/Makefile.objs
+++ b/hw/sh4/Makefile.objs
@@ -1,5 +1,7 @@
-obj-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
-obj-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o
+obj-y += sh_timer.o sh_serial.o sh_pci.o sm501.o
 obj-y += ide/mmio.o
 
 obj-y := $(addprefix ../,$(obj-y))
+
+obj-y += shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
+obj-y += sh_intc.o
diff --git a/hw/r2d.c b/hw/sh4/r2d.c
similarity index 100%
rename from hw/r2d.c
rename to hw/sh4/r2d.c
diff --git a/hw/sh7750.c b/hw/sh4/sh7750.c
similarity index 100%
rename from hw/sh7750.c
rename to hw/sh4/sh7750.c
diff --git a/hw/sh7750_regnames.c b/hw/sh4/sh7750_regnames.c
similarity index 100%
rename from hw/sh7750_regnames.c
rename to hw/sh4/sh7750_regnames.c
diff --git a/hw/sh_intc.c b/hw/sh4/sh_intc.c
similarity index 100%
rename from hw/sh_intc.c
rename to hw/sh4/sh_intc.c
diff --git a/hw/shix.c b/hw/sh4/shix.c
similarity index 100%
rename from hw/shix.c
rename to hw/sh4/shix.c
diff --git a/hw/tc58128.c b/hw/sh4/tc58128.c
similarity index 100%
rename from hw/tc58128.c
rename to hw/sh4/tc58128.c
diff --git a/hw/sparc/Makefile.objs b/hw/sparc/Makefile.objs
index a39a511..48cccf9 100644
--- a/hw/sparc/Makefile.objs
+++ b/hw/sparc/Makefile.objs
@@ -1,8 +1,16 @@
-obj-y = sun4m.o lance.o tcx.o sun4m_iommu.o slavio_intctl.o
-obj-y += slavio_timer.o slavio_misc.o sparc32_dma.o
-obj-y += cs4231.o eccmemctl.o sbi.o sun4c_intctl.o leon3.o
+obj-y = lance.o tcx.o
+obj-y += slavio_timer.o
+obj-y += cs4231.o eccmemctl.o
 
 # GRLIB
-obj-y += grlib_gptimer.o grlib_irqmp.o grlib_apbuart.o
+obj-y += grlib_gptimer.o grlib_apbuart.o
 
 obj-y := $(addprefix ../,$(obj-y))
+
+obj-y = sun4m.o sun4m_iommu.o slavio_intctl.o
+obj-y += slavio_misc.o sparc32_dma.o
+obj-y += sbi.o sun4c_intctl.o leon3.o
+
+# GRLIB
+obj-y += grlib_irqmp.o
+
diff --git a/hw/grlib_irqmp.c b/hw/sparc/grlib_irqmp.c
similarity index 100%
rename from hw/grlib_irqmp.c
rename to hw/sparc/grlib_irqmp.c
diff --git a/hw/leon3.c b/hw/sparc/leon3.c
similarity index 100%
rename from hw/leon3.c
rename to hw/sparc/leon3.c
diff --git a/hw/sbi.c b/hw/sparc/sbi.c
similarity index 100%
rename from hw/sbi.c
rename to hw/sparc/sbi.c
diff --git a/hw/slavio_intctl.c b/hw/sparc/slavio_intctl.c
similarity index 100%
rename from hw/slavio_intctl.c
rename to hw/sparc/slavio_intctl.c
diff --git a/hw/slavio_misc.c b/hw/sparc/slavio_misc.c
similarity index 100%
rename from hw/slavio_misc.c
rename to hw/sparc/slavio_misc.c
diff --git a/hw/sparc32_dma.c b/hw/sparc/sparc32_dma.c
similarity index 100%
rename from hw/sparc32_dma.c
rename to hw/sparc/sparc32_dma.c
diff --git a/hw/sun4c_intctl.c b/hw/sparc/sun4c_intctl.c
similarity index 100%
rename from hw/sun4c_intctl.c
rename to hw/sparc/sun4c_intctl.c
diff --git a/hw/sun4m.c b/hw/sparc/sun4m.c
similarity index 100%
rename from hw/sun4m.c
rename to hw/sparc/sun4m.c
diff --git a/hw/sun4m_iommu.c b/hw/sparc/sun4m_iommu.c
similarity index 100%
rename from hw/sun4m_iommu.c
rename to hw/sparc/sun4m_iommu.c
diff --git a/hw/sparc64/Makefile.objs b/hw/sparc64/Makefile.objs
index 8c65fc4..4df0d90 100644
--- a/hw/sparc64/Makefile.objs
+++ b/hw/sparc64/Makefile.objs
@@ -1,4 +1,6 @@
-obj-y = sun4u.o apb_pci.o
+obj-y = apb_pci.o
 obj-y += mc146818rtc.o
 
 obj-y := $(addprefix ../,$(obj-y))
+
+obj-y += sun4u.o
diff --git a/hw/sun4u.c b/hw/sparc64/sun4u.c
similarity index 100%
rename from hw/sun4u.c
rename to hw/sparc64/sun4u.c
diff --git a/hw/unicore32/Makefile.objs b/hw/unicore32/Makefile.objs
index 0725ce3..e0fd628 100644
--- a/hw/unicore32/Makefile.objs
+++ b/hw/unicore32/Makefile.objs
@@ -2,5 +2,3 @@
 
 # PKUnity-v3 SoC and board information
 obj-${CONFIG_PUV3} += puv3.o
-
-obj-y := $(addprefix ../,$(obj-y))
diff --git a/hw/puv3.c b/hw/unicore32/puv3.c
similarity index 100%
rename from hw/puv3.c
rename to hw/unicore32/puv3.c
diff --git a/hw/xtensa/Makefile.objs b/hw/xtensa/Makefile.objs
index 79698e9..24fd8b2 100644
--- a/hw/xtensa/Makefile.objs
+++ b/hw/xtensa/Makefile.objs
@@ -1,5 +1,3 @@
 obj-y += xtensa_pic.o
 obj-y += xtensa_sim.o
 obj-y += xtensa_lx60.o
-
-obj-y := $(addprefix ../,$(obj-y))
