Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ls4ZW-0006X9-RZ for qemu-devel@nongnu.org; Thu, 09 Apr 2009 20:26:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ls4ZV-0006Vb-NK for qemu-devel@nongnu.org; Thu, 09 Apr 2009 20:26:18 -0400 Received: from [199.232.76.173] (port=35842 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ls4ZV-0006VL-HS for qemu-devel@nongnu.org; Thu, 09 Apr 2009 20:26:17 -0400 Received: from savannah.gnu.org ([199.232.41.3]:47991 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ls4ZV-00027n-8Z for qemu-devel@nongnu.org; Thu, 09 Apr 2009 20:26:17 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ls4ZU-00074a-Jy for qemu-devel@nongnu.org; Fri, 10 Apr 2009 00:26:16 +0000 Received: from pbrook by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1Ls4ZU-00074W-7F for qemu-devel@nongnu.org; Fri, 10 Apr 2009 00:26:16 +0000 MIME-Version: 1.0 Errors-To: pbrook Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Paul Brook Message-Id: Date: Fri, 10 Apr 2009 00:26:16 +0000 Subject: [Qemu-devel] [7060] More phys_ram_base removal. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 7060 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7060 Author: pbrook Date: 2009-04-10 00:26:15 +0000 (Fri, 10 Apr 2009) Log Message: ----------- More phys_ram_base removal. Signed-off-by: Paul Brook Modified Paths: -------------- trunk/hw/armv7m.c trunk/hw/devices.h trunk/hw/pc.c trunk/hw/ppc_newworld.c trunk/hw/ppc_oldworld.c trunk/hw/r2d.c trunk/hw/sm501.c trunk/hw/tc6393xb.c trunk/hw/tc6393xb_template.h Modified: trunk/hw/armv7m.c =================================================================== --- trunk/hw/armv7m.c 2009-04-09 22:21:07 UTC (rev 7059) +++ trunk/hw/armv7m.c 2009-04-10 00:26:15 UTC (rev 7060) @@ -193,8 +193,8 @@ regular ROM image and perform the normal CPU reset sequence. Otherwise jump directly to the entry point. */ if (lowaddr == 0) { - env->regs[13] = tswap32(*(uint32_t *)phys_ram_base); - pc = tswap32(*(uint32_t *)(phys_ram_base + 4)); + env->regs[13] = ldl_phys(0); + pc = ldl_phys(4); } else { pc = entry; } Modified: trunk/hw/devices.h =================================================================== --- trunk/hw/devices.h 2009-04-09 22:21:07 UTC (rev 7059) +++ trunk/hw/devices.h 2009-04-10 00:26:15 UTC (rev 7060) @@ -74,6 +74,5 @@ qemu_irq tc6393xb_l3v_get(struct tc6393xb_s *s); /* sm501.c */ -void sm501_init(uint32_t base, unsigned long local_mem_base, - uint32_t local_mem_bytes, CharDriverState *chr); +void sm501_init(uint32_t base, uint32_t local_mem_bytes, CharDriverState *chr); #endif Modified: trunk/hw/pc.c =================================================================== --- trunk/hw/pc.c 2009-04-09 22:21:07 UTC (rev 7059) +++ trunk/hw/pc.c 2009-04-10 00:26:15 UTC (rev 7060) @@ -871,7 +871,7 @@ goto bios_error; } bios_offset = qemu_ram_alloc(bios_size); - ret = load_image(buf, phys_ram_base + bios_offset); + ret = load_image(buf, qemu_get_ram_ptr(bios_offset)); if (ret != bios_size) { bios_error: fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", buf); Modified: trunk/hw/ppc_newworld.c =================================================================== --- trunk/hw/ppc_newworld.c 2009-04-09 22:21:07 UTC (rev 7059) +++ trunk/hw/ppc_newworld.c 2009-04-10 00:26:15 UTC (rev 7060) @@ -110,6 +110,7 @@ BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; void *fw_cfg; void *dbdma; + uint8_t *vga_bios_ptr; linux_boot = (kernel_filename != NULL); @@ -154,8 +155,9 @@ /* allocate and load VGA BIOS */ vga_bios_offset = qemu_ram_alloc(VGA_BIOS_SIZE); + vga_bios_ptr = qemu_get_ram_ptr(vga_bios_offset); snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME); - vga_bios_size = load_image(buf, phys_ram_base + vga_bios_offset + 8); + vga_bios_size = load_image(buf, vga_bios_ptr + 8); if (vga_bios_size < 0) { /* if no bios is present, we can still work */ fprintf(stderr, "qemu: warning: could not load VGA bios '%s'\n", buf); @@ -163,12 +165,11 @@ } else { /* set a specific header (XXX: find real Apple format for NDRV drivers) */ - phys_ram_base[vga_bios_offset] = 'N'; - phys_ram_base[vga_bios_offset + 1] = 'D'; - phys_ram_base[vga_bios_offset + 2] = 'R'; - phys_ram_base[vga_bios_offset + 3] = 'V'; - cpu_to_be32w((uint32_t *)(phys_ram_base + vga_bios_offset + 4), - vga_bios_size); + vga_bios_ptr[0] = 'N'; + vga_bios_ptr[1] = 'D'; + vga_bios_ptr[2] = 'R'; + vga_bios_ptr[3] = 'V'; + cpu_to_be32w((uint32_t *)(vga_bios_ptr + 4), vga_bios_size); vga_bios_size += 8; } @@ -199,8 +200,8 @@ /* load initrd */ if (initrd_filename) { initrd_base = INITRD_LOAD_ADDR; - initrd_size = load_image(initrd_filename, - phys_ram_base + initrd_base); + initrd_size = load_image_targphys(initrd_filename, initrd_base, + ram_size - initrd_base); if (initrd_size < 0) { cpu_abort(env, "qemu: could not load initial ram disk '%s'\n", initrd_filename); Modified: trunk/hw/ppc_oldworld.c =================================================================== --- trunk/hw/ppc_oldworld.c 2009-04-09 22:21:07 UTC (rev 7059) +++ trunk/hw/ppc_oldworld.c 2009-04-10 00:26:15 UTC (rev 7060) @@ -138,6 +138,7 @@ int index; void *fw_cfg; void *dbdma; + uint8_t *vga_bios_ptr; linux_boot = (kernel_filename != NULL); @@ -187,8 +188,9 @@ /* allocate and load VGA BIOS */ vga_bios_offset = qemu_ram_alloc(VGA_BIOS_SIZE); + vga_bios_ptr = qemu_get_ram_ptr(vga_bios_offset); snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME); - vga_bios_size = load_image(buf, phys_ram_base + vga_bios_offset + 8); + vga_bios_size = load_image(buf, vga_bios_ptr + 8); if (vga_bios_size < 0) { /* if no bios is present, we can still work */ fprintf(stderr, "qemu: warning: could not load VGA bios '%s'\n", buf); @@ -196,12 +198,11 @@ } else { /* set a specific header (XXX: find real Apple format for NDRV drivers) */ - phys_ram_base[vga_bios_offset] = 'N'; - phys_ram_base[vga_bios_offset + 1] = 'D'; - phys_ram_base[vga_bios_offset + 2] = 'R'; - phys_ram_base[vga_bios_offset + 3] = 'V'; - cpu_to_be32w((uint32_t *)(phys_ram_base + vga_bios_offset + 4), - vga_bios_size); + vga_bios_ptr[0] = 'N'; + vga_bios_ptr[1] = 'D'; + vga_bios_ptr[2] = 'R'; + vga_bios_ptr[3] = 'V'; + cpu_to_be32w((uint32_t *)(vga_bios_ptr + 4), vga_bios_size); vga_bios_size += 8; } Modified: trunk/hw/r2d.c =================================================================== --- trunk/hw/r2d.c 2009-04-09 22:21:07 UTC (rev 7059) +++ trunk/hw/r2d.c 2009-04-10 00:26:15 UTC (rev 7060) @@ -200,7 +200,7 @@ { CPUState *env; struct SH7750State *s; - ram_addr_t sdram_addr, sm501_vga_ram_addr; + ram_addr_t sdram_addr; qemu_irq *irq; PCIBus *pci; int i; @@ -222,9 +222,7 @@ irq = r2d_fpga_init(0x04000000, sh7750_irl(s)); pci = sh_pci_register_bus(r2d_pci_set_irq, r2d_pci_map_irq, irq, 0, 4); - sm501_vga_ram_addr = qemu_ram_alloc(SM501_VRAM_SIZE); - sm501_init(0x10000000, sm501_vga_ram_addr, SM501_VRAM_SIZE, - serial_hds[2]); + sm501_init(0x10000000, SM501_VRAM_SIZE, serial_hds[2]); /* onboard CF (True IDE mode, Master only). */ if ((i = drive_get_index(IF_IDE, 0, 0)) != -1) Modified: trunk/hw/sm501.c =================================================================== --- trunk/hw/sm501.c 2009-04-09 22:21:07 UTC (rev 7059) +++ trunk/hw/sm501.c 2009-04-10 00:26:15 UTC (rev 7060) @@ -455,6 +455,7 @@ target_phys_addr_t base; uint32_t local_mem_size_index; uint8_t * local_mem; + ram_addr_t local_mem_offset; uint32_t last_width; uint32_t last_height; @@ -972,6 +973,7 @@ int y_start = -1; int page_min = 0x7fffffff; int page_max = -1; + ram_addr_t offset = s->local_mem_offset; /* choose draw_line function */ switch (s->dc_crt_control & 3) { @@ -1005,10 +1007,9 @@ /* draw each line according to conditions */ for (y = 0; y < height; y++) { int update = full_update; - uint8_t * line_end = &src[width * src_bpp - 1]; - int page0 = (src - phys_ram_base) & TARGET_PAGE_MASK; - int page1 = (line_end - phys_ram_base) & TARGET_PAGE_MASK; - int page; + ram_addr_t page0 = offset & TARGET_PAGE_MASK; + ram_addr_t page1 = (offset + width * src_bpp - 1) & TARGET_PAGE_MASK; + ram_addr_t page; /* check dirty flags for each line */ for (page = page0; page <= page1; page += TARGET_PAGE_SIZE) @@ -1033,6 +1034,7 @@ } src += width * src_bpp; + offset += width * src_bpp; } /* complete flush to display */ @@ -1053,8 +1055,7 @@ sm501_draw_crt(s); } -void sm501_init(uint32_t base, unsigned long local_mem_base, - uint32_t local_mem_bytes, CharDriverState *chr) +void sm501_init(uint32_t base, uint32_t local_mem_bytes, CharDriverState *chr) { SM501State * s; int sm501_system_config_index; @@ -1073,8 +1074,9 @@ s->dc_crt_control = 0x00010000; /* allocate local memory */ - s->local_mem = (uint8 *)phys_ram_base + local_mem_base; - cpu_register_physical_memory(base, local_mem_bytes, local_mem_base); + s->local_mem_offset = qemu_ram_alloc(local_mem_bytes); + s->local_mem = qemu_get_ram_ptr(s->local_mem_offset); + cpu_register_physical_memory(base, local_mem_bytes, s->local_mem_offset); /* map mmio */ sm501_system_config_index Modified: trunk/hw/tc6393xb.c =================================================================== --- trunk/hw/tc6393xb.c 2009-04-09 22:21:07 UTC (rev 7059) +++ trunk/hw/tc6393xb.c 2009-04-10 00:26:15 UTC (rev 7060) @@ -123,6 +123,7 @@ DisplayState *ds; ram_addr_t vram_addr; + uint16_t *vram_ptr; uint32_t scr_width, scr_height; /* in pixels */ qemu_irq l3v; unsigned blank : 1, @@ -593,6 +594,7 @@ cpu_register_physical_memory(base, 0x10000, iomemtype); s->vram_addr = qemu_ram_alloc(0x100000); + s->vram_ptr = qemu_get_ram_ptr(s->vram_addr); cpu_register_physical_memory(base + 0x100000, 0x100000, s->vram_addr); s->scr_width = 480; s->scr_height = 640; Modified: trunk/hw/tc6393xb_template.h =================================================================== --- trunk/hw/tc6393xb_template.h 2009-04-09 22:21:07 UTC (rev 7059) +++ trunk/hw/tc6393xb_template.h 2009-04-10 00:26:15 UTC (rev 7060) @@ -43,7 +43,7 @@ uint16_t *data_buffer; uint8_t *data_display; - data_buffer = (uint16_t*)(phys_ram_base + s->vram_addr); + data_buffer = s->vram_ptr; w_display = s->scr_width * BITS / 8; data_display = ds_get_data(s->ds); for(i = 0; i < s->scr_height; i++) {