Avi Kivity wrote: > Zhang, Xiantao wrote: >> From aaf97331da3d6cd34522441218c8c9ab3c1067f6 Mon Sep 17 00:00:00 >> 2001 >> From: Xiantao Zhang <xiantao.zhang@xxxxxxxxx> >> Date: Tue, 28 Apr 2009 16:55:47 +0800 >> Subject: [PATCH] qemu-kvm: Remove the dependency for phys_ram_base >> for ipf.c >> >> Upstream has dropped phys_ram_base, so ia64 also remove >> the dependency for that. >> >> +++ b/hw/ipf.c >> @@ -54,7 +54,8 @@ static fdctrl_t *floppy_controller; static >> RTCState *rtc_state; static PCIDevice *i440fx_state; >> >> -uint8_t *g_fw_start; >> +ram_addr_t gfw_start; >> + >> static uint32_t ipf_to_legacy_io(target_phys_addr_t addr) { >> return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3)); >> @@ -454,15 +455,15 @@ static void ipf_init1(ram_addr_t ram_size, int >> vga_ram_size, if (kvm_enabled()) { unsigned long >> image_size; char *image = NULL; >> - uint8_t *fw_image_start; >> + ram_addr_t fw_image_start; >> unsigned long nvram_addr = 0; >> unsigned long nvram_fd = 0; >> unsigned long type = READ_FROM_NVRAM; >> unsigned long i = 0; >> - ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE); >> - uint8_t *fw_start = phys_ram_base + fw_offset; >> >> - g_fw_start = fw_start; >> + ram_addr = qemu_ram_alloc(GFW_SIZE); >> + gfw_start = (ram_addr_t)qemu_get_ram_ptr(ram_addr); >> > > qemu_get_ram_ptr() returns a pointer. Don't cast it to a ram_addr_t, > leave it a pointer. > > But why not use cpu_physical_memory_write() (or > cpu_physical_memory_write_rom())? It's much simpler and cleaner. Good suggestion! I just followed the original logic. Updated the patch. Xiantao
Attachment:
0003-qemu-kvm-Remove-the-dependency-for-phys_ram_base-fo.patch
Description: 0003-qemu-kvm-Remove-the-dependency-for-phys_ram_base-fo.patch