Received: from eggs.gnu.org ([140.186.70.92]:38882) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwV0A-0008PY-SQ for qemu-devel@nongnu.org; Thu, 25 Aug 2011 04:09:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QwV06-0004wZ-4g for qemu-devel@nongnu.org; Thu, 25 Aug 2011 04:09:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwV05-0004wF-PP for qemu-devel@nongnu.org; Thu, 25 Aug 2011 04:09:22 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7P89LXB010669 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 25 Aug 2011 04:09:21 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p7P89K5Q017718 for ; Thu, 25 Aug 2011 04:09:20 -0400 From: Avi Kivity Date: Thu, 25 Aug 2011 11:09:00 +0300 Message-Id: <1314259758-5198-2-git-send-email-avi@redhat.com> In-Reply-To: <1314259758-5198-1-git-send-email-avi@redhat.com> References: <1314259758-5198-1-git-send-email-avi@redhat.com> Subject: [Qemu-devel] [PATCH 01/19] mips_fulong2e: convert to memory API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Avi Kivity --- hw/mips_fulong2e.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/hw/mips_fulong2e.c b/hw/mips_fulong2e.c index ec8c88e..abe3056 100644 --- a/hw/mips_fulong2e.c +++ b/hw/mips_fulong2e.c @@ -38,6 +38,7 @@ #include "vt82c686.h" #include "mc146818rtc.h" #include "blockdev.h" +#include "exec-memory.h" #define DEBUG_FULONG2E_INIT @@ -256,7 +257,9 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device, const char *initrd_filename, const char *cpu_model) { char *filename; - unsigned long ram_offset, bios_offset; + MemoryRegion *address_space_mem = get_system_memory(); + MemoryRegion *ram = g_new(MemoryRegion, 1); + MemoryRegion *bios = g_new(MemoryRegion, 1); long bios_size; int64_t kernel_entry; qemu_irq *i8259; @@ -288,12 +291,12 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device, bios_size = 1024 * 1024; /* allocate RAM */ - ram_offset = qemu_ram_alloc(NULL, "fulong2e.ram", ram_size); - bios_offset = qemu_ram_alloc(NULL, "fulong2e.bios", bios_size); + memory_region_init_ram(ram, NULL, "fulong2e.ram", ram_size); + memory_region_init_ram(bios, NULL, "fulong2e.bios", bios_size); + memory_region_set_readonly(bios, true); - cpu_register_physical_memory(0, ram_size, ram_offset); - cpu_register_physical_memory(0x1fc00000LL, - bios_size, bios_offset | IO_MEM_ROM); + memory_region_add_subregion(address_space_mem, 0, ram); + memory_region_add_subregion(address_space_mem, 0x1fc00000LL, bios); /* We do not support flash operation, just loading pmon.bin as raw BIOS. * Please use -L to set the BIOS path and -bios to set bios name. */ @@ -304,7 +307,7 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device, loaderparams.kernel_cmdline = kernel_cmdline; loaderparams.initrd_filename = initrd_filename; kernel_entry = load_kernel (env); - write_bootloader(env, qemu_get_ram_ptr(bios_offset), kernel_entry); + write_bootloader(env, memory_region_get_ram_ptr(bios), kernel_entry); } else { if (bios_name == NULL) { bios_name = FULONG_BIOSNAME; -- 1.7.5.3