From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LNnQn-0000rM-8f for qemu-devel@nongnu.org; Fri, 16 Jan 2009 07:04:09 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LNnQm-0000q4-Ns for qemu-devel@nongnu.org; Fri, 16 Jan 2009 07:04:08 -0500 Received: from [199.232.76.173] (port=34875 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNnQm-0000pl-70 for qemu-devel@nongnu.org; Fri, 16 Jan 2009 07:04:08 -0500 Received: from smtp.eu.citrix.com ([62.200.22.115]:50799) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LNnQl-00061r-L6 for qemu-devel@nongnu.org; Fri, 16 Jan 2009 07:04:07 -0500 Message-ID: <49707765.3070706@eu.citrix.com> Date: Fri, 16 Jan 2009 12:02:45 +0000 From: Stefano Stabellini MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [6322] add a -vga none cli option (Stefano Stabellini) References: <49705B73.9060103@siemens.com> In-Reply-To: <49705B73.9060103@siemens.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Jan Kiszka wrote: > This hunk now generates: > > qemu/hw/pc.c: In function â¬Üpc_init1â¬": > qemu/hw/pc.c:762: warning: â¬Üvga_bios_offsetâ¬" may be used uninitialized in this function > > For obvious reasons. Can we simply make the related > cpu_register_physical_memory conditional as well? > > Jan > You are right that patch caused variable initialization issues, this patch should fix them. Signed-off-by: Stefano Stabellini diff --git a/hw/pc.c b/hw/pc.c index d64e442..ff0f16d 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -759,7 +759,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size, { char buf[1024]; int ret, linux_boot, i; - ram_addr_t ram_addr, vga_ram_addr, bios_offset, vga_bios_offset; + ram_addr_t ram_addr, vga_ram_addr = 0x00, bios_offset, vga_bios_offset; ram_addr_t below_4g_mem_size, above_4g_mem_size = 0; int bios_size, isa_bios_size, vga_bios_size; PCIBus *pci_bus; @@ -831,10 +831,6 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size, ram_addr); } - - /* allocate VGA RAM */ - vga_ram_addr = qemu_ram_alloc(vga_ram_size); - /* BIOS load */ if (bios_name == NULL) bios_name = BIOS_FILENAME; @@ -853,6 +849,9 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size, } if (cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled) { + /* allocate VGA RAM */ + vga_ram_addr = qemu_ram_alloc(vga_ram_size); + /* VGA BIOS load */ if (cirrus_vga_enabled) { snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_CIRRUS_FILENAME); @@ -870,11 +869,11 @@ vga_bios_error: fprintf(stderr, "qemu: could not load VGA BIOS '%s'\n", buf); exit(1); } - } - /* setup basic memory access */ - cpu_register_physical_memory(0xc0000, 0x10000, - vga_bios_offset | IO_MEM_ROM); + /* setup basic memory access */ + cpu_register_physical_memory(0xc0000, 0x10000, + vga_bios_offset | IO_MEM_ROM); + } /* map the last 128KB of the BIOS in ISA space */ isa_bios_size = bios_size;