[5849] Change MMIO callbacks to use offsets, not absolute addresses.
Revision: 5849
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5849 Author: pbrook Date: 2008-12-01 18:59:50 +0000 (Mon, 01 Dec 2008)
Log Message:
-----------
Change MMIO callbacks to use offsets, not absolute addresses.
Modified Paths:
--------------
trunk/cpu-all.h
trunk/exec.c
trunk/hw/arm_gic.c
trunk/hw/arm_sysctl.c
trunk/hw/arm_timer.c
trunk/hw/armv7m.c
trunk/hw/ds1225y.c
trunk/hw/e1000.c
trunk/hw/eepro100.c
trunk/hw/etraxfs_dma.c
trunk/hw/etraxfs_eth.c
trunk/hw/etraxfs_pic.c
trunk/hw/etraxfs_ser.c
trunk/hw/etraxfs_timer.c
trunk/hw/g364fb.c
trunk/hw/integratorcp.c
trunk/hw/iommu.c
trunk/hw/jazz_led.c
trunk/hw/m48t59.c
trunk/hw/mac_nvram.c
trunk/hw/mc146818rtc.c
trunk/hw/mcf5208.c
trunk/hw/mips_malta.c
trunk/hw/mpcore.c
trunk/hw/mst_fpga.c
trunk/hw/musicpal.c
trunk/hw/omap.h
trunk/hw/omap1.c
trunk/hw/omap2.c
trunk/hw/omap_dma.c
trunk/hw/omap_dss.c
trunk/hw/omap_i2c.c
trunk/hw/omap_lcdc.c
trunk/hw/omap_mmc.c
trunk/hw/onenand.c
trunk/hw/parallel.c
trunk/hw/pckbd.c
trunk/hw/pflash_cfi01.c
trunk/hw/pflash_cfi02.c
trunk/hw/pl011.c
trunk/hw/pl022.c
trunk/hw/pl031.c
trunk/hw/pl050.c
trunk/hw/pl061.c
trunk/hw/pl080.c
trunk/hw/pl110.c
trunk/hw/pl181.c
trunk/hw/pl190.c
trunk/hw/ppc405_boards.c
trunk/hw/ppc4xx_devs.c
trunk/hw/ppc_prep.c
trunk/hw/pxa.h
trunk/hw/pxa2xx.c
trunk/hw/pxa2xx_dma.c
trunk/hw/pxa2xx_gpio.c
trunk/hw/pxa2xx_keypad.c
trunk/hw/pxa2xx_lcd.c
trunk/hw/pxa2xx_mmci.c
trunk/hw/pxa2xx_pcmcia.c
trunk/hw/pxa2xx_pic.c
trunk/hw/pxa2xx_timer.c
trunk/hw/r2d.c
trunk/hw/realview_gic.c
trunk/hw/serial.c
trunk/hw/sh7750.c
trunk/hw/sh_intc.c
trunk/hw/sh_serial.c
trunk/hw/sh_timer.c
trunk/hw/slavio_intctl.c
trunk/hw/slavio_misc.c
trunk/hw/sm501.c
trunk/hw/smc91c111.c
trunk/hw/spitz.c
trunk/hw/stellaris.c
trunk/hw/stellaris_enet.c
trunk/hw/tc6393xb.c
trunk/hw/usb-ohci.c
trunk/hw/versatilepb.c
trunk/hw/vga.c
trunk/hw/vga_int.h
trunk/hw/vmware_vga.c
trunk/hw/zaurus.cModified: trunk/cpu-all.h
===================================================================
cpu-all.h +11 -3
@@ -877,9 +877,17 @@typedef void CPUWriteMemoryFunc (void *opaque,target_phys_addr_t addr,uint32_t value);typedef uint32_t CPUReadMemoryFunc (void *opaque,target_phys_addr_t addr); -void cpu_register_physical_memory (target_phys_addr_t start_addr, -ram_addr_t size, -ram_addr_t phys_offset); +void cpu_register_physical_memory_offset (target_phys_addr_t start_addr, +ram_addr_t size, +ram_addr_t phys_offset, +ram_addr_t region_offset); +static inline void cpu_register_physical_memory (target_phys_addr_t start_addr, +ram_addr_t size, +ram_addr_t phys_offset) +{ +cpu_register_physical_memory_offset (start_addr, size, phys_offset,0 ); +} +ram_addr_t cpu_get_physical_page_desc (target_phys_addr_t addr);ram_addr_t qemu_ram_alloc (ram_addr_t );void qemu_ram_free (ram_addr_t addr);
Modified: trunk/exec.c
===================================================================
exec.c +62 -20
238 lines not on this page · raw message
Modified: trunk/hw/arm_gic.c
===================================================================
hw/arm_gic.c +5 -11
@@ -23,14 +23,12 @@#ifdef NVIC static const uint8_t gic_id[] = {0x00 ,0xb0 ,0x1b ,0x00 ,0x0d ,0xe0 ,0x05 ,0xb1 }; -#define GIC_DIST_OFFSET 0/* The NVIC has 16 internal vectors. However these are not exposed through the normal GIC interface. */ #define GIC_BASE_IRQ 32#else static const uint8_t gic_id[] = {0x90 ,0x13 ,0x04 ,0x00 ,0x0d ,0xf0 ,0x05 ,0xb1 }; -#define GIC_DIST_OFFSET 0x1000#define GIC_BASE_IRQ 0#endif
@@ -76,7 +74,6 @@ typedef struct gic_state { - uint32_t base; qemu_irq parent_irq[NCPU]; int enabled; int cpu_enabled[NCPU];
@@ -252,7 +249,6 @@ cpu =gic_get_current_cpu (); cm =1 << cpu; - offset -= s->base +GIC_DIST_OFFSET ;if (offset <0x100 ) {#ifndef NVIC if (offset ==0 )
@@ -365,7 +361,7 @@#ifdef NVIC gic_state *s = (gic_state *)opaque;uint32_t addr; - addr = offset - s->base; + addr = offset;if (addr <0x100 || addr >0xd00 )return nvic_readl (s->nvic, addr);#endif
@@ -383,7 +379,6 @@int cpu; cpu =gic_get_current_cpu (); - offset -= s->base +GIC_DIST_OFFSET ;if (offset <0x100 ) {#ifdef NVIC goto bad_reg;
@@ -526,13 +521,13 @@gic_state *s = (gic_state *)opaque;#ifdef NVIC uint32_t addr; - addr = offset - s->base; + addr = offset;if (addr <0x100 || (addr >0xd00 && addr !=0xf00 )) {nvic_writel (s->nvic, addr, value);return ; }#endif -if (offset - s->base ==GIC_DIST_OFFSET +0xf00 ) { +if (offset ==0xf00 ) {int cpu;int irq;int mask;
@@ -723,7 +718,7 @@return 0 ; } -static gic_state *gic_init (uint32_t base,qemu_irq *parent_irq) +static gic_state *gic_init (uint32_t dist_base,qemu_irq *parent_irq) {gic_state *s;int iomemtype;
@@ -738,9 +733,8 @@ } iomemtype =cpu_register_io_memory (0 , gic_dist_readfn, gic_dist_writefn, s); -cpu_register_physical_memory (base +GIC_DIST_OFFSET ,0x00001000 , +cpu_register_physical_memory (dist_base,0x00001000 , iomemtype); - s->base = base;gic_reset (s);register_savevm ("arm_gic" ,-1 ,1 , gic_save, gic_load, s);return s;
Modified: trunk/hw/arm_sysctl.c
===================================================================
hw/arm_sysctl.c +0 -4
@@ -14,7 +14,6 @@#define LOCK_VALUE 0xa05f typedef struct { - uint32_t base; uint32_t sys_id; uint32_t leds; uint16_t lockval;
@@ -29,7 +28,6 @@ {arm_sysctl_state *s = (arm_sysctl_state *)opaque; - offset -= s->base;switch (offset) {case 0x00 :/* ID */ return s->sys_id;
@@ -108,7 +106,6 @@ uint32_t val) {arm_sysctl_state *s = (arm_sysctl_state *)opaque; - offset -= s->base;switch (offset) {case 0x08 :/* LED */
@@ -199,7 +196,6 @@ s = (arm_sysctl_state *)qemu_mallocz (sizeof (arm_sysctl_state));if (!s)return ; - s->base = base; s->sys_id = sys_id;/* The MPcore bootloader uses these flags to start secondary CPUs. We don't use a bootloader, so do this here. */
Modified: trunk/hw/arm_timer.c
===================================================================
hw/arm_timer.c +0 -8
@@ -190,7 +190,6 @@typedef struct {void *timer[2 ];int level[2 ]; -uint32_t base;qemu_irq irq; }sp804_state ;
@@ -208,7 +207,6 @@sp804_state *s = (sp804_state *)opaque;/* ??? Don't know the PrimeCell ID for this device. */ - offset -= s->base;if (offset <0x20 ) {return arm_timer_read (s->timer[0 ], offset); }else {
@@ -221,7 +219,6 @@ {sp804_state *s = (sp804_state *)opaque; - offset -= s->base;if (offset <0x20 ) {arm_timer_write (s->timer[0 ], offset, value); }else {
@@ -268,7 +265,6 @@ s = (sp804_state *)qemu_mallocz (sizeof (sp804_state)); qi =qemu_allocate_irqs (sp804_set_irq, s,2 ); - s->base = base; s->irq = irq;/* ??? The timers are actually configurable between 32kHz and 1MHz, but we don't implement that. */
@@ -285,7 +281,6 @@typedef struct {void *timer[3 ]; -uint32_t base; }icp_pit_state ;static uint32_t icp_pit_read (void *opaque,target_phys_addr_t offset)
@@ -294,7 +289,6 @@int n;/* ??? Don't know the PrimeCell ID for this device. */ - offset -= s->base; n = offset >>8 ;if (n >3 )cpu_abort (cpu_single_env,"sp804_read: Bad timer %d\n" , n);
@@ -308,7 +302,6 @@icp_pit_state *s = (icp_pit_state *)opaque;int n; - offset -= s->base; n = offset >>8 ;if (n >3 )cpu_abort (cpu_single_env,"sp804_write: Bad timer %d\n" , n);
@@ -335,7 +328,6 @@icp_pit_state *s; s = (icp_pit_state *)qemu_mallocz (sizeof (icp_pit_state)); - s->base = base;/* Timer 0 runs at the system clock speed (40MHz). */ s->timer[0 ] =arm_timer_init (40000000 , pic[irq]);/* The other two timers run at 1MHz. */
Modified: trunk/hw/armv7m.c
===================================================================
hw/armv7m.c +13 -9
@@ -14,11 +14,11 @@/* Bitbanded IO. Each word corresponds to a single bit. */ /* Get the byte address of the real memory for a bitband acess. */ -static inline uint32_t bitband_addr (uint32_t addr) +static inline uint32_t bitband_addr (void * opaque,uint32_t addr) {uint32_t res; - res = addr &0xe0000000 ; + res = *(uint32_t *)opaque; res |= (addr &0x1ffffff ) >>5 ;return res;
@@ -27,7 +27,7 @@static uint32_t bitband_readb (void *opaque,target_phys_addr_t offset) {uint8_t v; -cpu_physical_memory_read (bitband_addr (offset), &v,1 ); +cpu_physical_memory_read (bitband_addr (opaque, offset), &v,1 );return (v & (1 << ((offset >>2 ) &7 ))) !=0 ; }
@@ -37,7 +37,7 @@uint32_t addr;uint8_t mask;uint8_t v; - addr =bitband_addr (offset); + addr =bitband_addr (opaque, offset); mask = (1 << ((offset >>2 ) &7 ));cpu_physical_memory_read (addr, &v,1 );if (value &1 )
@@ -52,7 +52,7 @@uint32_t addr;uint16_t mask;uint16_t v; - addr =bitband_addr (offset) & ~1 ; + addr =bitband_addr (opaque, offset) & ~1 ; mask = (1 << ((offset >>2 ) &15 )); mask =tswap16 (mask);cpu_physical_memory_read (addr, (uint8_t *)&v,2 );
@@ -65,7 +65,7 @@uint32_t addr;uint16_t mask;uint16_t v; - addr =bitband_addr (offset) & ~1 ; + addr =bitband_addr (opaque, offset) & ~1 ; mask = (1 << ((offset >>2 ) &15 )); mask =tswap16 (mask);cpu_physical_memory_read (addr, (uint8_t *)&v,2 );
@@ -81,7 +81,7 @@uint32_t addr;uint32_t mask;uint32_t v; - addr =bitband_addr (offset) & ~3 ; + addr =bitband_addr (opaque, offset) & ~3 ; mask = (1 << ((offset >>2 ) &31 )); mask =tswap32 (mask);cpu_physical_memory_read (addr, (uint8_t *)&v,4 );
@@ -94,7 +94,7 @@uint32_t addr;uint32_t mask;uint32_t v; - addr =bitband_addr (offset) & ~3 ; + addr =bitband_addr (opaque, offset) & ~3 ; mask = (1 << ((offset >>2 ) &31 )); mask =tswap32 (mask);cpu_physical_memory_read (addr, (uint8_t *)&v,4 );
@@ -120,10 +120,14 @@static void armv7m_bitband_init (void ) {int iomemtype; +static uint32_t bitband1_offset =0x20000000 ; +static uint32_t bitband2_offset =0x40000000 ; iomemtype =cpu_register_io_memory (0 , bitband_readfn, bitband_writefn, -NULL ); + &bitband1_offset);cpu_register_physical_memory (0x22000000 ,0x02000000 , iomemtype); + iomemtype =cpu_register_io_memory (0 , bitband_readfn, bitband_writefn, + &bitband2_offset);cpu_register_physical_memory (0x42000000 ,0x02000000 , iomemtype); }
Modified: trunk/hw/ds1225y.c
===================================================================
hw/ds1225y.c +4 -13
@@ -30,7 +30,6 @@ typedef struct ds1225y_t { - target_phys_addr_t mem_base; uint32_t chip_size; QEMUFile *file; uint8_t *contents;
@@ -41,15 +40,10 @@static uint32_t nvram_readb (void *opaque,target_phys_addr_t addr) {ds1225y_t *s = opaque; -int64_t pos;uint32_t val; - pos = addr - s->mem_base; -if (pos >= s->chip_size) - pos -= s->chip_size; + val = s->contents[addr]; - val = s->contents[pos]; -#ifdef DEBUG_NVRAM printf ("nvram: read 0x%x at " TARGET_FMT_lx"\n" , val, addr);#endif
@@ -77,16 +71,14 @@static void nvram_writeb (void *opaque,target_phys_addr_t addr,uint32_t val) {ds1225y_t *s = opaque; -int64_t pos;#ifdef DEBUG_NVRAM printf ("nvram: write 0x%x at " TARGET_FMT_lx"\n" , val, addr);#endif - pos = addr - s->mem_base; - s->contents[pos] = val &0xff ; + s->contents[addr] = val &0xff ;if (s->file) { -qemu_fseek (s->file, pos,SEEK_SET ); +qemu_fseek (s->file, addr,SEEK_SET );qemu_put_byte (s->file, (int )val);qemu_fflush (s->file); }
@@ -117,7 +109,7 @@return ; } -nvram_writeb (opaque, addr - s->chip_size, val); +nvram_writeb (opaque, addr, val); }static void nvram_writew_protected (void *opaque,target_phys_addr_t addr,uint32_t val)
@@ -167,7 +159,6 @@if (!s->contents) {return NULL ; } - s->mem_base = mem_base; s->protection =7 ;/* Read current file */
Modified: trunk/hw/e1000.c
===================================================================
hw/e1000.c +4 -6
@@ -76,7 +76,6 @@PCIDevice dev;VLANClientState *vc;NICInfo *nd; -uint32_t mmio_base;int mmio_index;uint32_t mac_reg[0x8000 ];
@@ -786,7 +785,7 @@ e1000_mmio_writel(void *opaque, target_phys_addr_t addr, uint32_t val) {E1000State *s = opaque; -unsigned int index = ((addr - s->mmio_base) &0x1ffff ) >>2 ; +unsigned int index = (addr &0x1ffff ) >>2 ;#ifdef TARGET_WORDS_BIGENDIAN val =bswap32 (val);
@@ -820,7 +819,7 @@ e1000_mmio_readl(void *opaque, target_phys_addr_t addr) {E1000State *s = opaque; -unsigned int index = ((addr - s->mmio_base) &0x1ffff ) >>2 ; +unsigned int index = (addr &0x1ffff ) >>2 ;if (index <NREADOPS && macreg_readops[index]) {
@@ -870,7 +869,7 @@int i, j;pci_device_save (&s->dev, f); -qemu_put_be32s (f, &s->mmio_base); +qemu_put_be32 (f,0 );qemu_put_be32s (f, &s->rxbuf_size);qemu_put_be32s (f, &s->rxbuf_min_shift);qemu_put_be32s (f, &s->eecd_state.val_in);
@@ -916,7 +915,7 @@return ret;if (version_id ==1 )qemu_get_sbe32s (f, &i);/* once some unused instance id */ -qemu_get_be32s (f, &s->mmio_base); +qemu_get_be32 (f);/* Ignored. Was mmio_base. */ qemu_get_be32s (f, &s->rxbuf_size);qemu_get_be32s (f, &s->rxbuf_min_shift);qemu_get_be32s (f, &s->eecd_state.val_in);
@@ -1005,7 +1004,6 @@DBGOUT (MMIO ,"e1000_mmio_map addr=0x%08x 0x%08x\n" , addr, size); - d->mmio_base = addr;cpu_register_physical_memory (addr,PNPMMIO_SIZE , d->mmio_index); }
Modified: trunk/hw/eepro100.c
===================================================================
hw/eepro100.c +0 -6
@@ -1392,7 +1392,6 @@static void pci_mmio_writeb (void *opaque,target_phys_addr_t addr,uint32_t val) {EEPRO100State *s = opaque; - addr -= s->region[0 ];//~ logout("addr=%s val=0x%02x\n", regname(addr), val); eepro100_write1 (s, addr, val); }
@@ -1400,7 +1399,6 @@static void pci_mmio_writew (void *opaque,target_phys_addr_t addr,uint32_t val) {EEPRO100State *s = opaque; - addr -= s->region[0 ];//~ logout("addr=%s val=0x%02x\n", regname(addr), val); eepro100_write2 (s, addr, val); }
@@ -1408,7 +1406,6 @@static void pci_mmio_writel (void *opaque,target_phys_addr_t addr,uint32_t val) {EEPRO100State *s = opaque; - addr -= s->region[0 ];//~ logout("addr=%s val=0x%02x\n", regname(addr), val); eepro100_write4 (s, addr, val); }
@@ -1416,7 +1413,6 @@static uint32_t pci_mmio_readb (void *opaque,target_phys_addr_t addr) {EEPRO100State *s = opaque; - addr -= s->region[0 ];//~ logout("addr=%s\n", regname(addr)); return eepro100_read1 (s, addr); }
@@ -1424,7 +1420,6 @@static uint32_t pci_mmio_readw (void *opaque,target_phys_addr_t addr) {EEPRO100State *s = opaque; - addr -= s->region[0 ];//~ logout("addr=%s\n", regname(addr)); return eepro100_read2 (s, addr); }
@@ -1432,7 +1427,6 @@static uint32_t pci_mmio_readl (void *opaque,target_phys_addr_t addr) {EEPRO100State *s = opaque; - addr -= s->region[0 ];//~ logout("addr=%s\n", regname(addr)); return eepro100_read4 (s, addr); }
Modified: trunk/hw/etraxfs_dma.c
===================================================================
hw/etraxfs_dma.c +7 -9
@@ -188,7 +188,6 @@struct fs_dma_ctrl {CPUState *env; -target_phys_addr_t base;int nr_channels;struct fs_dma_channel *channels;
@@ -212,10 +211,10 @@ && ctrl->channels[c].client; } -static inline int fs_channel (target_phys_addr_t base,target_phys_addr_t addr) +static inline int fs_channel (target_phys_addr_t addr) {/* Every channel has a 0x2000 ctrl register map. */ -return (addr - base) >>13 ; +return addr >>13 ; }#ifdef USE_THIS_DEAD_CODE
@@ -572,7 +571,7 @@uint32_t r =0 ;/* Make addr relative to this instances base. */ - c =fs_channel (ctrl->base, addr); + c =fs_channel (addr); addr &=0x1fff ;switch (addr) {
@@ -618,7 +617,7 @@int c;/* Make addr relative to this instances base. */ - c =fs_channel (ctrl->base, addr); + c =fs_channel (addr); addr &=0x1fff ;switch (addr) {
@@ -753,7 +752,6 @@ ctrl->bh =qemu_bh_new (DMA_run, ctrl); - ctrl->base = base; ctrl->env = env; ctrl->nr_channels = nr_channels; ctrl->channels =qemu_mallocz (sizeof ctrl->channels[0 ] * nr_channels);
@@ -766,9 +764,9 @@ dma_read, dma_write, ctrl); -cpu_register_physical_memory (base + i *0x2000 , -sizeof ctrl->channels[i].regs, - ctrl->channels[i].regmap); +cpu_register_physical_memory_offset (base + i *0x2000 , +sizeof ctrl->channels[i].regs, ctrl->channels[i].regmap, + i *0x2000 ); }return ctrl;
Modified: trunk/hw/etraxfs_eth.c
===================================================================
hw/etraxfs_eth.c +0 -6
@@ -314,7 +314,6 @@ {CPUState *env;qemu_irq *irq; -target_phys_addr_t base;VLANClientState *vc;int ethregs;
@@ -375,8 +374,6 @@struct fs_eth *eth = opaque;uint32_t r =0 ; -/* Make addr relative to this instances base. */ - addr -= eth->base;switch (addr) {case R_STAT :/* Attach an MDIO/PHY abstraction. */
@@ -428,8 +425,6 @@ {struct fs_eth *eth = opaque; -/* Make addr relative to this instances base. */ - addr -= eth->base;switch (addr) {case RW_MA0_LO :
@@ -589,7 +584,6 @@ dma[1 ].client.pull =NULL ; eth->env = env; - eth->base = base; eth->irq = irq; eth->dma_out = dma; eth->dma_in = dma +1 ;
Modified: trunk/hw/etraxfs_pic.c
===================================================================
hw/etraxfs_pic.c +0 -6
@@ -31,7 +31,6 @@struct fs_pic_state_t {CPUState *env; -target_phys_addr_t base;uint32_t rw_mask;/* Active interrupt lines. */
@@ -56,8 +55,6 @@struct fs_pic_state_t *fs = opaque;uint32_t rval; -/* Transform this to a relative addr. */ - addr -= fs->base;switch (addr) {case 0x0 :
@@ -99,8 +96,6 @@ {struct fs_pic_state_t *fs = opaque;D (printf ("%s addr=%x val=%x\n" , __func__, addr, value)); -/* Transform this to a relative addr. */ - addr -= fs->base;switch (addr) {case 0x0 :
@@ -233,7 +228,6 @@ intr_vect_regs =cpu_register_io_memory (0 , pic_read, pic_write, fs);cpu_register_physical_memory (base,0x14 , intr_vect_regs); - fs->base = base;return pic; err:
Modified: trunk/hw/etraxfs_ser.c
===================================================================
hw/etraxfs_ser.c +0 -4
@@ -50,8 +50,6 @@CharDriverState *chr;qemu_irq *irq; -target_phys_addr_t base; -int pending_tx;/* Control registers. */
@@ -240,8 +238,6 @@ s->env = env; s->irq = irq; - s->base = base; - s->chr = chr;/* transmitter begins ready and idle. */
Modified: trunk/hw/etraxfs_timer.c
===================================================================
hw/etraxfs_timer.c +0 -6
@@ -47,7 +47,6 @@CPUState *env;qemu_irq *irq;qemu_irq *nmi; -target_phys_addr_t base;QEMUBH *bh_t0;QEMUBH *bh_t1;
@@ -90,8 +89,6 @@struct fs_timer_t *t = opaque;uint32_t r =0 ; -/* Make addr relative to this instances base. */ - addr -= t->base;switch (addr) {case R_TMR0_DATA :break ;
@@ -273,8 +270,6 @@ {struct fs_timer_t *t = opaque; -/* Make addr relative to this instances base. */ - addr -= t->base;switch (addr) {case RW_TMR0_DIV :
@@ -357,7 +352,6 @@ t->irq = irqs; t->nmi = nmi; t->env = env; - t->base = base; timer_regs =cpu_register_io_memory (0 , timer_read, timer_write, t);cpu_register_physical_memory (base,0x5c , timer_regs);
Modified: trunk/hw/g364fb.c
===================================================================
hw/g364fb.c +3 -7
@@ -26,7 +26,6 @@//#define DEBUG_G364 typedef struct G364State { - target_phys_addr_t vram_base; unsigned int vram_size; uint8_t *vram_buffer; uint32_t ctla;
@@ -300,9 +299,8 @@static uint32_t g364fb_mem_readb (void *opaque,target_phys_addr_t addr) {G364State *s = opaque; -target_phys_addr_t relative_addr = addr - s->vram_base; -return s->vram_buffer[relative_addr]; +return s->vram_buffer[addr]; }static uint32_t g364fb_mem_readw (void *opaque,target_phys_addr_t addr)
@@ -326,9 +324,8 @@static void g364fb_mem_writeb (void *opaque,target_phys_addr_t addr,uint32_t val) {G364State *s = opaque; -target_phys_addr_t relative_addr = addr - s->vram_base; - s->vram_buffer[relative_addr] = val; + s->vram_buffer[addr] = val; }static void g364fb_mem_writew (void *opaque,target_phys_addr_t addr,uint32_t val)
@@ -375,14 +372,13 @@g364fb_reset (s); s->ds = ds; - s->vram_base = vram_base; s->console =graphic_console_init (ds, g364fb_update_display, g364fb_invalidate_display, g364fb_screen_dump,NULL , s); io_vram =cpu_register_io_memory (0 , g364fb_mem_read, g364fb_mem_write, s); -cpu_register_physical_memory (s->vram_base, vram_size, io_vram); +cpu_register_physical_memory (vram_base, vram_size, io_vram); io_ctrl =cpu_register_io_memory (0 , g364fb_ctrl_read, g364fb_ctrl_write, s);cpu_register_physical_memory (ctrl_base,0x10000 , io_ctrl);
Modified: trunk/hw/integratorcp.c
===================================================================
hw/integratorcp.c +1 -18
@@ -38,7 +38,6 @@static uint32_t integratorcm_read (void *opaque,target_phys_addr_t offset) {integratorcm_state *s = (integratorcm_state *)opaque; - offset -=0x10000000 ;if (offset >=0x100 && offset <0x200 ) {/* CM_SPD */ if (offset >=0x180 )
@@ -141,7 +140,6 @@ uint32_t value) {integratorcm_state *s = (integratorcm_state *)opaque; - offset -=0x10000000 ;switch (offset >>2 ) {case 2 :/* CM_OSC */ if (s->cm_lock ==0xa05f )
@@ -268,7 +266,6 @@ typedef struct icp_pic_state { - uint32_t base; uint32_t level; uint32_t irq_enabled; uint32_t fiq_enabled;
@@ -300,7 +297,6 @@ {icp_pic_state *s = (icp_pic_state *)opaque; - offset -= s->base;switch (offset >>2 ) {case 0 :/* IRQ_STATUS */ return s->level & s->irq_enabled;
@@ -329,7 +325,6 @@ uint32_t value) {icp_pic_state *s = (icp_pic_state *)opaque; - offset -= s->base;switch (offset >>2 ) {case 2 :/* IRQ_ENABLESET */
@@ -386,7 +381,6 @@if (!s)return NULL ; qi =qemu_allocate_irqs (icp_pic_set_irq, s,32 ); - s->base = base; s->parent_irq = parent_irq; s->parent_fiq = parent_fiq; iomemtype = cpu_register_io_memory(0, icp_pic_readfn,
@@ -397,14 +391,8 @@ }/* CP control registers. */ -typedef struct { -uint32_t base; -}icp_control_state ; -static uint32_t icp_control_read (void *opaque,target_phys_addr_t offset) { -icp_control_state *s = (icp_control_state *)opaque; - offset -= s->base;switch (offset >>2 ) {case 0 :/* CP_IDFIELD */ return 0x41034003 ;
@@ -424,8 +412,6 @@static void icp_control_write (void *opaque,target_phys_addr_t offset,uint32_t value) { -icp_control_state *s = (icp_control_state *)opaque; - offset -= s->base;switch (offset >>2 ) {case 1 :/* CP_FLASHPROG */ case 2 :/* CP_INTREG */
@@ -452,13 +438,10 @@static void icp_control_init (uint32_t base) {int iomemtype; -icp_control_state *s; - s = (icp_control_state *)qemu_mallocz (sizeof (icp_control_state)); iomemtype =cpu_register_io_memory (0 , icp_control_readfn, - icp_control_writefn, s); + icp_control_writefn,NULL );cpu_register_physical_memory (base,0x00800000 , iomemtype); - s->base = base;/* ??? Save/restore. */ }
Modified: trunk/hw/iommu.c
===================================================================
hw/iommu.c +2 -4
@@ -114,7 +114,6 @@#define PAGE_MASK (PAGE_SIZE - 1) typedef struct IOMMUState { - target_phys_addr_t addr; uint32_t regs[IOMMU_NREGS]; target_phys_addr_t iostart; uint32_t version;
@@ -127,7 +126,7 @@target_phys_addr_t saddr;uint32_t ret; - saddr = (addr - s->addr) >>2 ; + saddr = addr >>2 ;switch (saddr) {default : ret = s->regs[saddr];
@@ -148,7 +147,7 @@IOMMUState *s = opaque;target_phys_addr_t saddr; - saddr = (addr - s->addr) >>2 ; + saddr = addr >>2 ;DPRINTF ("write reg[%d] = %x\n" , (int )saddr, val);switch (saddr) {case IOMMU_CTRL :
@@ -358,7 +357,6 @@if (!s)return NULL ; - s->addr = addr; s->version = version; s->irq = irq;
Modified: trunk/hw/jazz_led.c
===================================================================
hw/jazz_led.c +3 -7
@@ -34,7 +34,6 @@ } screen_state_t; typedef struct LedState { - target_phys_addr_t base; uint8_t segments; DisplayState *ds; QEMUConsole *console;
@@ -44,10 +43,9 @@static uint32_t led_readb (void *opaque,target_phys_addr_t addr) {LedState *s = opaque; -int relative_addr = addr - s->base;uint32_t val; -switch (relative_addr) { +switch (addr) {case 0 : val = s->segments;break ;
@@ -94,9 +92,8 @@static void led_writeb (void *opaque,target_phys_addr_t addr,uint32_t val) {LedState *s = opaque; -int relative_addr = addr - s->base; -switch (relative_addr) { +switch (addr) {case 0 : s->segments = val; s->state |=REDRAW_SEGMENTS ;
@@ -311,12 +308,11 @@if (!s)return ; - s->base = base; s->ds = ds; s->state =REDRAW_SEGMENTS |REDRAW_BACKGROUND ; io =cpu_register_io_memory (0 , led_read, led_write, s); -cpu_register_physical_memory (s->base,1 , io); +cpu_register_physical_memory (base,1 , io); s->console = graphic_console_init(ds, jazz_led_update_display, jazz_led_invalidate_display,
Modified: trunk/hw/m48t59.c
===================================================================
hw/m48t59.c +0 -8
@@ -46,7 +46,6 @@/* Hardware parameters */ qemu_irq IRQ ;int mem_index; -target_phys_addr_t mem_base;uint32_t io_base;uint16_t size;/* RTC management */
@@ -514,7 +513,6 @@ {m48t59_t *NVRAM = opaque; - addr -=NVRAM ->mem_base;m48t59_write (NVRAM , addr, value &0xff ); }
@@ -522,7 +520,6 @@ {m48t59_t *NVRAM = opaque; - addr -=NVRAM ->mem_base;m48t59_write (NVRAM , addr, (value >>8 ) &0xff );m48t59_write (NVRAM , addr +1 , value &0xff ); }
@@ -531,7 +528,6 @@ {m48t59_t *NVRAM = opaque; - addr -=NVRAM ->mem_base;m48t59_write (NVRAM , addr, (value >>24 ) &0xff );m48t59_write (NVRAM , addr +1 , (value >>16 ) &0xff );m48t59_write (NVRAM , addr +2 , (value >>8 ) &0xff );
@@ -543,7 +539,6 @@m48t59_t *NVRAM = opaque;uint32_t retval; - addr -=NVRAM ->mem_base; retval =m48t59_read (NVRAM , addr);return retval; }
@@ -553,7 +548,6 @@m48t59_t *NVRAM = opaque;uint32_t retval; - addr -=NVRAM ->mem_base; retval =m48t59_read (NVRAM , addr) <<8 ; retval |=m48t59_read (NVRAM , addr +1 );return retval;
@@ -564,7 +558,6 @@m48t59_t *NVRAM = opaque;uint32_t retval; - addr -=NVRAM ->mem_base; retval =m48t59_read (NVRAM , addr) <<24 ; retval |=m48t59_read (NVRAM , addr +1 ) <<16 ; retval |=m48t59_read (NVRAM , addr +2 ) <<8 ;
@@ -636,7 +629,6 @@ } s->IRQ =IRQ ; s->size = size; - s->mem_base = mem_base; s->io_base = io_base; s->addr =0 ; s->type = type;
Modified: trunk/hw/mac_nvram.c
===================================================================
hw/mac_nvram.c +0 -4
@@ -26,7 +26,6 @@#include "ppc_mac.h" struct MacIONVRAMState { -target_phys_addr_t mem_base;target_phys_addr_t size;int mem_index;uint8_t data[0x2000 ];
@@ -62,7 +61,6 @@ {MacIONVRAMState *s = opaque; - addr -= s->mem_base; addr = (addr >>4 ) &0x1fff ; s->data[addr] = value;// printf("macio_nvram_writeb %04x = %02x\n", addr, value);
@@ -73,7 +71,6 @@MacIONVRAMState *s = opaque;uint32_t value; - addr -= s->mem_base; addr = (addr >>4 ) &0x1fff ; value = s->data[addr];// printf("macio_nvram_readb %04x = %02x\n", addr, value);
@@ -112,7 +109,6 @@MacIONVRAMState *s; s = opaque; - s->mem_base = mem_base;cpu_register_physical_memory (mem_base, s->size, s->mem_index); }
Modified: trunk/hw/mc146818rtc.c
===================================================================
hw/mc146818rtc.c +6 -8
@@ -59,7 +59,6 @@uint8_t cmos_index;struct tm current_tm;qemu_irq irq; -target_phys_addr_t base;int it_shift;/* periodic timer */ QEMUTimer *periodic_timer;
@@ -492,7 +491,7 @@ {RTCState *s = opaque; -return cmos_ioport_read (s, (addr - s->base) >> s->it_shift) &0xFF ; +return cmos_ioport_read (s, addr >> s->it_shift) &0xFF ; } static void cmos_mm_writeb (void *opaque,
@@ -500,7 +499,7 @@ {RTCState *s = opaque; -cmos_ioport_write (s, (addr - s->base) >> s->it_shift, value &0xFF ); +cmos_ioport_write (s, addr >> s->it_shift, value &0xFF ); }static uint32_t cmos_mm_readw (void *opaque,target_phys_addr_t addr)
@@ -508,7 +507,7 @@RTCState *s = opaque;uint32_t val; - val =cmos_ioport_read (s, (addr - s->base) >> s->it_shift) &0xFFFF ; + val =cmos_ioport_read (s, addr >> s->it_shift) &0xFFFF ;#ifdef TARGET_WORDS_BIGENDIAN val =bswap16 (val);#endif
@@ -522,7 +521,7 @@#ifdef TARGET_WORDS_BIGENDIAN value =bswap16 (value);#endif -cmos_ioport_write (s, (addr - s->base) >> s->it_shift, value &0xFFFF ); +cmos_ioport_write (s, addr >> s->it_shift, value &0xFFFF ); }static uint32_t cmos_mm_readl (void *opaque,target_phys_addr_t addr)
@@ -530,7 +529,7 @@RTCState *s = opaque;uint32_t val; - val =cmos_ioport_read (s, (addr - s->base) >> s->it_shift); + val =cmos_ioport_read (s, addr >> s->it_shift);#ifdef TARGET_WORDS_BIGENDIAN val =bswap32 (val);#endif
@@ -544,7 +543,7 @@#ifdef TARGET_WORDS_BIGENDIAN value =bswap32 (value);#endif -cmos_ioport_write (s, (addr - s->base) >> s->it_shift, value); +cmos_ioport_write (s, addr >> s->it_shift, value); }static CPUReadMemoryFunc *rtc_mm_read[] = {
@@ -573,7 +572,6 @@ s->cmos_data[RTC_REG_B ] =0x02 ; s->cmos_data[RTC_REG_C ] =0x00 ; s->cmos_data[RTC_REG_D ] =0x80 ; - s->base = base;rtc_set_date_from_host (s);
Modified: trunk/hw/mcf5208.c
===================================================================
hw/mcf5208.c +45 -50
147 lines not on this page · raw message
Modified: trunk/hw/mips_malta.c
===================================================================
hw/mips_malta.c +1 -0
@@ -433,6 +433,7 @@ malta_fpga_write, s);cpu_register_physical_memory (base,0x900 , malta); +/* 0xa00 is less than a page, so will still get the right offsets. */ cpu_register_physical_memory (base +0xa00 ,0x100000 -0xa00 , malta); s->display =qemu_chr_open ("fpga" ,"vc:320x200" );
Modified: trunk/hw/mpcore.c
===================================================================
hw/mpcore.c +1 -1
@@ -265,7 +265,7 @@ s = (mpcore_priv_state *)qemu_mallocz (sizeof (mpcore_priv_state));if (!s)return NULL ; - s->gic =gic_init (base, pic_irq); + s->gic =gic_init (base +0x1000 , pic_irq);if (!s->gic)return NULL ; iomemtype = cpu_register_io_memory(0, mpcore_priv_readfn,
Modified: trunk/hw/mst_fpga.c
===================================================================
hw/mst_fpga.c +1 -6
@@ -14,7 +14,6 @@/* Mainstone FPGA for extern irqs */ #define FPGA_GPIO_PIN 0#define MST_NUM_IRQS 16 -#define MST_BASE MST_FPGA_PHYS#define MST_LEDDAT1 0x10#define MST_LEDDAT2 0x14#define MST_LEDCTRL 0x40
@@ -29,7 +28,6 @@#define MST_PCMCIA1 0xe4 typedef struct mst_irq_state{ - target_phys_addr_t target_base; qemu_irq *parent; qemu_irq *pins;
@@ -83,7 +81,6 @@ mst_fpga_readb(void *opaque, target_phys_addr_t addr) {mst_irq_state *s = (mst_irq_state *) opaque; - addr -= s->target_base;switch (addr) {case MST_LEDDAT1 :
@@ -121,7 +118,6 @@ mst_fpga_writeb(void *opaque, target_phys_addr_t addr, uint32_t value) {mst_irq_state *s = (mst_irq_state *) opaque; - addr -= s->target_base; value &=0xffffffff ;switch (addr) {
@@ -231,7 +227,6 @@if (!s)return NULL ; - s->target_base = base; s->parent = &cpu->pic[irq];/* alloc the external 16 irqs */
@@ -240,7 +235,7 @@ iomemtype =cpu_register_io_memory (0 , mst_fpga_readfn, mst_fpga_writefn, s); -cpu_register_physical_memory (MST_BASE ,0x00100000 , iomemtype); +cpu_register_physical_memory (base,0x00100000 , iomemtype);register_savevm ("mainstone_fpga" ,0 ,0 , mst_fpga_save, mst_fpga_load, s);return qi; }
Modified: trunk/hw/musicpal.c
===================================================================
hw/musicpal.c +0 -26
@@ -239,7 +239,6 @@static const char audio_name[] ="mv88w8618" ; typedef struct musicpal_audio_state { - uint32_t base; qemu_irq irq; uint32_t playback_mode; uint32_t status;
@@ -334,7 +333,6 @@ {musicpal_audio_state *s = opaque; - offset -= s->base;switch (offset) {case MP_AUDIO_PLAYBACK_MODE :return s->playback_mode;
@@ -361,7 +359,6 @@ {musicpal_audio_state *s = opaque; - offset -= s->base;switch (offset) {case MP_AUDIO_PLAYBACK_MODE : if (value & MP_AUDIO_PLAYBACK_EN &&
@@ -448,7 +445,6 @@ s =qemu_mallocz (sizeof (musicpal_audio_state));if (!s)return NULL ; - s->base = base; s->irq = irq; i2c =qemu_mallocz (sizeof (i2c_interface));
@@ -549,7 +545,6 @@ } mv88w8618_rx_desc; typedef struct mv88w8618_eth_state { - uint32_t base; qemu_irq irq; uint32_t smir; uint32_t icr;
@@ -617,7 +612,6 @@ {mv88w8618_eth_state *s = opaque; - offset -= s->base;switch (offset) {case MP_ETH_SMIR :if (s->smir &MP_ETH_SMIR_OPCODE ) {
@@ -660,7 +654,6 @@ {mv88w8618_eth_state *s = opaque; - offset -= s->base;switch (offset) {case MP_ETH_SMIR : s->smir = value;
@@ -724,7 +717,6 @@ s =qemu_mallocz (sizeof (mv88w8618_eth_state));if (!s)return ; - s->base = base; s->irq = irq; s->vc =qemu_new_vlan_client (nd->vlan, eth_receive, eth_can_receive, s); iomemtype = cpu_register_io_memory(0, mv88w8618_eth_readfn,
@@ -752,7 +744,6 @@#define MP_LCD_TEXTCOLOR 0xe0e0ff/* RRGGBB */ typedef struct musicpal_lcd_state { - uint32_t base; uint32_t mode; uint32_t irqctrl; int page;
@@ -852,7 +843,6 @@ {musicpal_lcd_state *s = opaque; - offset -= s->base;switch (offset) {case MP_LCD_IRQCTRL :return s->irqctrl;
@@ -867,7 +857,6 @@ {musicpal_lcd_state *s = opaque; - offset -= s->base;switch (offset) {case MP_LCD_IRQCTRL : s->irqctrl = value;
@@ -922,7 +911,6 @@ s =qemu_mallocz (sizeof (musicpal_lcd_state));if (!s)return ; - s->base = base; s->ds = ds; iomemtype =cpu_register_io_memory (0 , musicpal_lcd_readfn, musicpal_lcd_writefn, s);
@@ -940,7 +928,6 @@ typedef struct mv88w8618_pic_state { - uint32_t base; uint32_t level; uint32_t enabled; qemu_irq parent_irq;
@@ -966,7 +953,6 @@ {mv88w8618_pic_state *s = opaque; - offset -= s->base;switch (offset) {case MP_PIC_STATUS :return s->level & s->enabled;
@@ -981,7 +967,6 @@ {mv88w8618_pic_state *s = opaque; - offset -= s->base;switch (offset) {case MP_PIC_ENABLE_SET : s->enabled |= value;
@@ -1025,7 +1010,6 @@if (!s)return NULL ; qi =qemu_allocate_irqs (mv88w8618_pic_set_irq, s,32 ); - s->base = base; s->parent_irq = parent_irq; iomemtype =cpu_register_io_memory (0 , mv88w8618_pic_readfn, mv88w8618_pic_writefn, s);
@@ -1059,7 +1043,6 @@typedef struct mv88w8618_pit_state {void *timer[4 ];uint32_t control; -uint32_t base; }mv88w8618_pit_state ;static void mv88w8618_timer_tick (void *opaque)
@@ -1089,7 +1072,6 @@mv88w8618_pit_state *s = opaque;mv88w8618_timer_state *t; - offset -= s->base;switch (offset) { case MP_PIT_TIMER1_VALUE ... MP_PIT_TIMER4_VALUE: t = s->timer[(offset-MP_PIT_TIMER1_VALUE ) >>2 ];
@@ -1107,7 +1089,6 @@mv88w8618_timer_state *t;int i; - offset -= s->base;switch (offset) { case MP_PIT_TIMER1_LENGTH ... MP_PIT_TIMER4_LENGTH: t = s->timer[offset >>2 ];
@@ -1155,7 +1136,6 @@if (!s)return ; - s->base = base;/* Letting them all run at 1 MHz is likely just a pragmatic * simplification. */ s->timer[0 ] =mv88w8618_timer_init (1000000 , pic[irq]);
@@ -1172,7 +1152,6 @@#define MP_FLASHCFG_CFGR0 0x04typedef struct mv88w8618_flashcfg_state { -uint32_t base;uint32_t cfgr0; }mv88w8618_flashcfg_state ;
@@ -1181,7 +1160,6 @@ {mv88w8618_flashcfg_state *s = opaque; - offset -= s->base;switch (offset) {case MP_FLASHCFG_CFGR0 :return s->cfgr0;
@@ -1196,7 +1174,6 @@ {mv88w8618_flashcfg_state *s = opaque; - offset -= s->base;switch (offset) {case MP_FLASHCFG_CFGR0 : s->cfgr0 = value;
@@ -1225,7 +1202,6 @@if (!s)return ; - s->base = base; s->cfgr0 =0xfffe4285 ;/* Default as set by U-Boot for 8 MB flash */ iomemtype =cpu_register_io_memory (0 , mv88w8618_flashcfg_readfn, mv88w8618_flashcfg_writefn, s);
@@ -1266,7 +1242,6 @@static uint32_t musicpal_read (void *opaque,target_phys_addr_t offset) { - offset -=0x80000000 ;switch (offset) {case MP_BOARD_REVISION :return 0x0031 ;
@@ -1307,7 +1282,6 @@static void musicpal_write (void *opaque,target_phys_addr_t offset,uint32_t value) { - offset -=0x80000000 ;switch (offset) {case MP_GPIO_OE_HI :/* used for LCD brightness control */ lcd_brightness = (lcd_brightness & MP_GPIO_LCD_BRIGHTNESS) |
Modified: trunk/hw/omap.h
===================================================================
hw/omap.h +0 -11
@@ -890,11 +890,9 @@struct omap_lcd_panel_s *lcd; -target_phys_addr_t ulpd_pm_base;uint32_t ulpd_pm_regs[21 ];int64_t ulpd_gauge_start; -target_phys_addr_t pin_cfg_base;uint32_t func_mux_ctrl[14 ];uint32_t comp_mode_ctrl[1 ];uint32_t pull_dwn_ctrl[4 ];
@@ -905,25 +903,19 @@int compat1509;uint32_t mpui_ctrl; -target_phys_addr_t mpui_base;struct omap_tipb_bridge_s *private_tipb;struct omap_tipb_bridge_s *public_tipb; -target_phys_addr_t tcmi_base;uint32_t tcmi_regs[17 ];struct dpll_ctl_s { -target_phys_addr_t base;uint16_t mode;omap_clk dpll; } dpll[3 ];omap_clk clks;struct { -target_phys_addr_t mpu_base; -target_phys_addr_t dsp_base; -int cold_start;int clocking_scheme;uint16_t arm_ckctl;
@@ -944,10 +936,7 @@struct omap_gp_timer_s *gptimer[12 ]; -target_phys_addr_t tap_base; -struct omap_synctimer_s { -target_phys_addr_t base;uint32_t val;uint16_t readh; } synctimer;
Modified: trunk/hw/omap1.c
===================================================================
hw/omap1.c +85 -133
769 lines not on this page · raw message
Modified: trunk/hw/omap2.c
===================================================================
hw/omap2.c +57 -101
557 lines not on this page · raw message
Modified: trunk/hw/omap_dma.c
===================================================================
hw/omap_dma.c +28 -31
106 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/omap_dss.c
===================================================================
hw/omap_dss.c +14 -39
53 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/omap_i2c.c
===================================================================
hw/omap_i2c.c +2 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/omap_lcdc.c
===================================================================
hw/omap_lcdc.c +3 -7
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/omap_mmc.c
===================================================================
hw/omap_mmc.c +2 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/onenand.c
===================================================================
hw/onenand.c +5 -5
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/parallel.c
===================================================================
hw/parallel.c +6 -8
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pckbd.c
===================================================================
hw/pckbd.c +2 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pflash_cfi01.c
===================================================================
hw/pflash_cfi01.c +0 -2
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pflash_cfi02.c
===================================================================
hw/pflash_cfi02.c +0 -2
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pl011.c
===================================================================
hw/pl011.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pl022.c
===================================================================
hw/pl022.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pl031.c
===================================================================
hw/pl031.c +0 -5
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pl050.c
===================================================================
hw/pl050.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pl061.c
===================================================================
hw/pl061.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pl080.c
===================================================================
hw/pl080.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pl110.c
===================================================================
hw/pl110.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pl181.c
===================================================================
hw/pl181.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pl190.c
===================================================================
hw/pl190.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/ppc405_boards.c
===================================================================
hw/ppc405_boards.c +0 -8
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/ppc4xx_devs.c
===================================================================
hw/ppc4xx_devs.c +4 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/ppc_prep.c
===================================================================
hw/ppc_prep.c +1 -1
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pxa.h
===================================================================
hw/pxa.h +0 -1
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pxa2xx.c
===================================================================
hw/pxa2xx.c +11 -29
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pxa2xx_dma.c
===================================================================
hw/pxa2xx_dma.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pxa2xx_gpio.c
===================================================================
hw/pxa2xx_gpio.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pxa2xx_keypad.c
===================================================================
hw/pxa2xx_keypad.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pxa2xx_lcd.c
===================================================================
hw/pxa2xx_lcd.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pxa2xx_mmci.c
===================================================================
hw/pxa2xx_mmci.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pxa2xx_pcmcia.c
===================================================================
hw/pxa2xx_pcmcia.c +3 -15
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pxa2xx_pic.c
===================================================================
hw/pxa2xx_pic.c +2 -8
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/pxa2xx_timer.c
===================================================================
hw/pxa2xx_timer.c +0 -6
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/r2d.c
===================================================================
hw/r2d.c +0 -7
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/realview_gic.c
===================================================================
hw/realview_gic.c +1 -3
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/serial.c
===================================================================
hw/serial.c +6 -8
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/sh7750.c
===================================================================
hw/sh7750.c +2 -1
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/sh_intc.c
===================================================================
hw/sh_intc.c +2 -1
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/sh_serial.c
===================================================================
hw/sh_serial.c +6 -8
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/sh_timer.c
===================================================================
hw/sh_timer.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/slavio_intctl.c
===================================================================
hw/slavio_intctl.c +2 -2
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/slavio_misc.c
===================================================================
hw/slavio_misc.c +6 -3
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/sm501.c
===================================================================
hw/sm501.c +22 -33
55 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/smc91c111.c
===================================================================
hw/smc91c111.c +1 -6
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/spitz.c
===================================================================
hw/spitz.c +1 -6
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/stellaris.c
===================================================================
hw/stellaris.c +0 -16
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/stellaris_enet.c
===================================================================
hw/stellaris_enet.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/tc6393xb.c
===================================================================
hw/tc6393xb.c +2 -6
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/usb-ohci.c
===================================================================
hw/usb-ohci.c +1 -8
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/versatilepb.c
===================================================================
hw/versatilepb.c +0 -4
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/vga.c
===================================================================
hw/vga.c +6 -7
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/vga_int.h
===================================================================
hw/vga_int.h +0 -1
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/vmware_vga.c
===================================================================
hw/vmware_vga.c +0 -6
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Modified: trunk/hw/zaurus.c
===================================================================
hw/zaurus.c +1 -5
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
Quoted 5 lines · Paul Brook
Revision: 5849
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5849 Author: pbrook Date: 2008-12-01 18:59:50 +0000 (Mon, 01 Dec 2008)
Quoted 7 lines
Log Message:
-----------
Change MMIO callbacks to use offsets, not absolute addresses.Signed-off-by Paul Brook <[email protected]>
This patch breaks sparc illegal access fault handling because the address of the fault is no longer available, only the offset.
Quoted 6 lines · Robert Reif
Quoted 5 lines · Paul Brook
Revision: 5849
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5849 Author: pbrook Date: 2008-12-01 18:59:50 +0000 (Mon, 01 Dec 2008)
Quoted 8 lines
Quoted 5 lines
Log Message:
-----------
Change MMIO callbacks to use offsets, not absolute addresses.Signed-off-by Paul Brook <[email protected]>This patch breaks sparc illegal access fault handling because the address of the fault is no longer available, only the offset.
Really? DEBUG_UNASSIGNED prints the expected values for ARM targets, and the sparc code looks like it should be using the same value.
Paul
Quoted 15 lines · Paul Brook
Quoted 13 lines · Robert Reif
Quoted 11 lines · Paul Brook
Revision: 5849
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5849 Author: pbrook Date: 2008-12-01 18:59:50 +0000 (Mon, 01 Dec 2008)Log Message:
-----------
Change MMIO callbacks to use offsets, not absolute addresses.Signed-off-by Paul Brook <[email protected]>
Quoted 9 lines
Quoted 3 lines
This patch breaks sparc illegal access fault handling because the address of the fault is no longer available, only the offset.
Really?
DEBUG_UNASSIGNEDprints the expected values for ARM targets, and the sparc code looks like it should be using the same value.Paul
in exec.c
static uint32_t unassigned_mem_readb(void *opaque, target_phys_addr_t addr) {
#ifdef DEBUG_UNASSIGNED
printf("Unassigned mem read byte " TARGET_FMT_plx "\n", addr);
#endif
#if defined(TARGET_SPARC)
do_unassigned_access(addr, 0, 0, 0, 1);
#endif
return 0;
}
addr is now the offset rather than the physical address and it is passed to do_unassigned_access which then puts the offset into the fault address register.
Quoted 3 lines
addr is now the offset rather than the physical address and it is passed to
do_unassigned_accesswhich then puts the offset into the fault address register.
This is why you need to provide actual testcases. Turns out it works fine as long as the l2 phys_map (PhysPageDesc) for that page isn't populated.
Should be fixed now.
Paul
Quoted 3 lines · Paul Brook
Should be fixed now.
Not really. This fixes that specific case but it doesn't fix the general case where a hardware device needs to call do_unassigned_access because the hardware device still only has the offset.
You could store the physical base in each hardware device and recreate the physical address but that requires changing all hardware devices that need to do that. Why should the hardware drivers go through the trouble to recreate a physical address when just a few instructions before then the physical address was known but irreversibly destroyed when it was converted to an offset.
Quoted 6 lines · Robert Reif
Quoted 1 line · Paul Brook
Should be fixed now.
Not really. This fixes that specific case but it doesn't fix the general case where a hardware device needs to call
do_unassigned_accessbecause the hardware device still only has the offset.
qemu has precisely zero devices that do this.
Also note that the current do_unaligned_access is bogus. You can't raise synchronous exceptions from IO handlers. MMU exceptions have special handling to make sure CPU state is consistent, and trap instructions explicitly synchronise virtual CPU state before raising the exception.
Quoted 6 lines
You could store the physical base in each hardware device and recreate the physical address but that requires changing all hardware devices that need to do that. Why should the hardware drivers go through the trouble to recreate a physical address when just a few instructions before then the physical address was known but irreversibly destroyed when it was converted to an offset.
Part of the reason for making this change is that it's a first step towards making devices bus agnostic. If you have an IOMMU then the address the device sees is different to the address the CPU sees. The most effective way to avoid problems with this to have the device not know/care.
Paul
Quoted 4 lines · Paul Brook
Quoted 2 lines · Robert Reif
Paul Brook wrote:
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
Should be fixed now.
Not really. This fixes that specific case but it doesn't fix the general case where a hardware device needs to call
do_unassigned_accessbecause the hardware device still only has the offset.qemu has precisely zero devices that do this.
Just because something is currently not implemented properly is not a good reason to prevent a proper solution from ever being implemented in the future.
Quoted 3 lines
Also note that the current
do_unaligned_accessis bogus. You can't raise synchronous exceptions from IO handlers. MMU exceptions have special handling to make sure CPU state is consistent, and trap instructions explicitly synchronise virtual CPU state before raising the exception.
This is a problem that currently prevents sun open boot images from passing their built in self tests. The BIST does something that should generate an immediate response but the response doesn't happen until sometime later so the tests fail and then later complainswhen the response finally happens. This has been explained to me as a limitation of QEMU.
Quoted 8 lines
Quoted 7 lines
You could store the physical base in each hardware device and recreate the physical address but that requires changing all hardware devices that need to do that. Why should the hardware drivers go through the trouble to recreate a physical address when just a few instructions before then the physical address was known but irreversibly destroyed when it was converted to an offset.
Quoted 7 lines
Part of the reason for making this change is that it's a first step towards making devices bus agnostic. If you have an IOMMU then the address the device sees is different to the address the CPU sees. The most effective way to avoid problems with this to have the device not know/care.
Paul
Sparc devices are passed in their physical addresses. They are currently hard wired
because there is no proper bus/slot layer and only on-broad devices are implemented
anyway. However each system may have the same hardware located at different locations
so this may not be typical QEMU behavior. Real hardware deals with real addresses. An IOMMU is irrelevant because the IOMMU emulation will take care of the virtual to physical translation.
Quoted 8 lines
Sparc devices are passed in their physical addresses. They are currently hard wired
because there is no proper bus/slot layer and only on-broad devices are implemented
anyway. However each system may have the same hardware located at different locations
so this may not be typical QEMU behavior. Real hardware deals with real addresses.
Oh real hardware address decoding is typically implemented as chip selects in the host bridge, routing tables in the switch fabric, and/or having individual devices do address decoding and claiming transactions on a shared bus. Modelling full per-device address decoding simply isn't feasible, we have to use additional knowledge (e.g. PCI BARs or fixed address fanges) to perform that decoding at a higher level.
Quoted 2 lines
An IOMMU is irrelevant because the IOMMU emulation will take care of the virtual to physical translation.
Not really. An IOMMU exists as part of a bus bridge, and translates between different physical addresses on different busses. Virtual addresses (at least in any conventional sense) are an entirely separate layer that exists only within the CPU. Admittedly most IOMMU only act on device->CPU transactions, with CPU->device accesses using a static mapping.
I'm pretty sure that the address reported by the CPU fault registers is the CPU bus address. With an IOMMU this is likely to be different to the address seen by the peripheral.
Paul
Quoted 10 lines · Paul Brook
Quoted 9 lines
Sparc devices are passed in their physical addresses. They are currently hard wired
because there is no proper bus/slot layer and only on-broad devices are implemented
anyway. However each system may have the same hardware located at different locations
so this may not be typical QEMU behavior. Real hardware deals with real addresses.
Quoted 3 lines
Oh real hardware address decoding is typically implemented as chip selects in the host bridge, routing tables in the switch fabric, and/or having individual devices do address decoding and claiming transactions on a shared bus. Modelling full per-device address decoding simply isn't feasible, we have to use additional knowledge (e.g. PCI BARs or fixed address fanges) to perform that decoding at a higher level.
The layers above the device emulation must be responsible for generating the the physical address appropriately. This is looking at the problem from a sparc perspective.
Sparc hardware is very fault happy and will generate a fault if you look at it funny. This isn't an issue when running a fully debugged OS but limits QEMU's usefulness as a OS development platform.
The open boot self tests do strange and unimplemented things and I would like to see more of that work in the future. The same applies to more than the currently supported OSs. I would rather have the hardware emulation work properly and run any OS than the current approach of trying a specific OS and hardware configuration and fixing what breaks. All I want is QEMU to be a better product.
How do you propose having the hardware drivers generate meaningful and timely faults when an improper access is performed so it behaves like real low level software expects the hardware to behave? A device could generate a fault and pass the offset up to a higher layer that has knowledge of the real physical address but that currently doesn't exist.
Quoted 3 lines
How do you propose having the hardware drivers generate meaningful and timely faults when an improper access is performed so it behaves like real low level software expects the hardware to behave?
If you're wanting to generate faults from IO devices then getting the right physical address is the least of your concerns. First you need to figure out how to avoid corrupting the rest of the CPU state.
Paul
Quoted 10 lines · Paul Brook
Quoted 4 lines
How do you propose having the hardware drivers generate meaningful and timely faults when an improper access is performed so it behaves like real low level software expects the hardware to behave?
If you're wanting to generate faults from IO devices then getting the right physical address is the least of your concerns. First you need to figure out how to avoid corrupting the rest of the CPU state.
Paul
The MMU does it so it must be possible. Is it a design issue, performance issue, just not worth the trouble or no one has really cared up until now? Please enlighten me further. Is it reasonable to expect it to work someday or should I just accept that it won't?
Quoted 5 lines · Robert Reif
Quoted 4 lines · Paul Brook
Quoted 3 lines
How do you propose having the hardware drivers generate meaningful and timely faults when an improper access is performed so it behaves like real low level software expects the hardware to behave?
Quoted 8 lines
Quoted 3 lines
If you're wanting to generate faults from IO devices then getting the right physical address is the least of your concerns. First you need to figure out how to avoid corrupting the rest of the CPU state.
The MMU does it so it must be possible. Is it a design issue, performance issue, just not worth the trouble or no one has really cared up until now? Please enlighten me further. Is it reasonable to expect it to work someday or should I just accept that it won't?
Bits of both. The TLB is tightly tied into the code generator. Once we get out of the first-level TLB lookup you've not got anywhere near enough information to be able to restore the CPU state. The only way to raise exceptions from within an IO handler is to sync CPU state before every memory access, and you really don't want to do that. This is why the existing unassigned access fault code is busted.
In practice you probably want to have the IO handler set a flag somewhere indicating that the access faulted, then add a check to the low-level TLB code to fault in much the same way as for a TLB fault. You can probably avoid slowing down the fast-path ram access case, but you're likely to take a hit on all IO operations. Either way the fault mechanism is largely separate from the device. I'm pretty sure this is consistent with read hardware where the device just indicates that something bad happened, and the CPU figures out everything else itself.
Paul
Quoted 17 lines · Paul Brook
Quoted 10 lines · Robert Reif
Quoted 7 lines · Paul Brook
Quoted 3 lines
How do you propose having the hardware drivers generate meaningful and timely faults when an improper access is performed so it behaves like real low level software expects the hardware to behave?
If you're wanting to generate faults from IO devices then getting the right physical address is the least of your concerns. First you need to figure out how to avoid corrupting the rest of the CPU state.
Quoted 4 lines
The MMU does it so it must be possible. Is it a design issue, performance issue, just not worth the trouble or no one has really cared up until now? Please enlighten me further. Is it reasonable to expect it to work someday or should I just accept that it won't?
Quoted 6 lines
Bits of both. The TLB is tightly tied into the code generator. Once we get out
of the first-level TLB lookup you've not got anywhere near enough information to be able to restore the CPU state. The only way to raise exceptions from within an IO handler is to sync CPU state before every memory access, and you really don't want to do that. This is why the existing unassigned access fault code is busted.
But because of possible MMU and unaligned access faults we already save PC and NPC (not in all cases). Handling of those faults works, it's really needed for correct operation. For some faults PC/NPC save is not necessary, the fault handler can calculate env->pc from host PC. Why would the unassigned fault be different?
Quoted 7 lines
Quoted 6 lines
Bits of both. The TLB is tightly tied into the code generator. Once we get out of the first-level TLB lookup you've not got anywhere near enough information to be able to restore the CPU state. The only way to raise exceptions from within an IO handler is to sync CPU state before every memory access, and you really don't want to do that. This is why the existing unassigned access fault code is busted.
Quoted 5 lines
But because of possible MMU and unaligned access faults we already save PC and NPC (not in all cases). Handling of those faults works, it's really needed for correct operation. For some faults PC/NPC save is not necessary, the fault handler can calculate
env->pcfrom host PC. Why would the unassigned fault be different?
I'm not sure how I can be any clearer.
You either have to explicitly sync state (In teh case of SPARC this means saving PC and NPC), or you have to know about the fault in the low-level TLB processing code where you still have enough information to recover this information. Once you get into an IO handler you've no way of figuring out what the current CPU state is. The "not in all cases"/"some faults" you mention above is relatively rare instructions that may fault v.s. every memory access.
Paul
Quoted 16 lines · Paul Brook
Quoted 7 lines
Quoted 6 lines
Bits of both. The TLB is tightly tied into the code generator. Once we get out of the first-level TLB lookup you've not got anywhere near enough information to be able to restore the CPU state. The only way to raise exceptions from within an IO handler is to sync CPU state before every memory access, and you really don't want to do that. This is why the existing unassigned access fault code is busted.
Quoted 5 lines
But because of possible MMU and unaligned access faults we already save PC and NPC (not in all cases). Handling of those faults works, it's really needed for correct operation. For some faults PC/NPC save is not necessary, the fault handler can calculate
env->pcfrom host PC. Why would the unassigned fault be different?I'm not sure how I can be any clearer.
Quoted 7 lines
You either have to explicitly sync state (In teh case of SPARC this means saving PC and NPC), or you have to know about the fault in the low-level TLB processing code where you still have enough information to recover this information. Once you get into an IO handler you've no way of figuring out what the current CPU state is. The "not in all cases"/"some faults" you mention above is relatively rare instructions that may fault v.s. every memory access.
Well, until r4431 we always saved PC and NPC for all memory access instructions, but with that commit, some of the checks could be removed and everything still work.
http://svn.savannah.gnu.org/viewvc?view=rev&root=qemu&revision=4431
I'm pretty sure that the instructions without checks generate faults successfully, and also the 64/128 bit instructions where the checks remain didn't work with the checks removed. And it was not possible to remove the checks or state saving without the cpu_restore_state2 by Fabrice. This area is still a bit murky for me.
Quoted 11 lines
Quoted 7 lines
You either have to explicitly sync state (In teh case of SPARC this
means saving PC and NPC), or you have to know about the fault in the low-level TLB processing code where you still have enough information to recover this information. Once you get into an IO handler you've no way of figuring out what the current CPU state is. The "not in all cases"/"some faults" you mention above is relatively rare instructions that may fault v.s. every memory access.Well, until r4431 we always saved PC and NPC for all memory access instructions, but with that commit, some of the checks could be removed and everything still work.
I don't believe that everything still works. Alignemnt checks work because they are enfored by the low-level TLB code. I'm pretty sure unassigned access faults are broken.
Paul