qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [6322] add a -vga none cli option (Stefano Stabelli


From: Stefano Stabellini
Subject: Re: [Qemu-devel] Re: [6322] add a -vga none cli option (Stefano Stabellini)
Date: Fri, 16 Jan 2009 12:02:45 +0000
User-agent: Thunderbird 2.0.0.14 (X11/20080505)

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 <address@hidden>

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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]