Patchwork [4/4] use rom loader for pc bios.

login
register
mail settings
Submitter Gerd Hoffmann
Date Oct. 13, 2009, 11:06 a.m.
Message ID <1255431978-4992-5-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/35841/
State New
Headers show

Comments

Gerd Hoffmann - Oct. 13, 2009, 11:06 a.m.
The pc bios shows up in 'info roms' now.

Note that the BIOS is mapped to two places: The complete rom at the top
of the memory, and the first 128k at 0xe0000.  Only the first place is
listed in 'info roms'.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/pc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Carl-Daniel Hailfinger - Oct. 13, 2009, 7:47 p.m.
On 13.10.2009 13:06, Gerd Hoffmann wrote:
> The pc bios shows up in 'info roms' now.
>
> Note that the BIOS is mapped to two places: The complete rom at the top
> of the memory, and the first 128k at 0xe0000.  Only the first place is
> listed in 'info roms'.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/pc.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/pc.c b/hw/pc.c
> index c4fa3f7..06e9143 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -1108,8 +1108,8 @@ static void pc_init1(ram_addr_t ram_size,
>          goto bios_error;
>      }
>      bios_offset = qemu_ram_alloc(bios_size);
> -    ret = load_image(filename, qemu_get_ram_ptr(bios_offset));
> -    if (ret != bios_size) {
> +    ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size));
>   

Memory leak? AFAICS the qemu_ram_alloc above should be removed and maybe
bios_offset needs to be killed completely.

> +    if (ret != 0) {
>      bios_error:
>          fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name);
>          exit(1);
>   

Regards,
Carl-Daniel
Gerd Hoffmann - Oct. 14, 2009, 7:31 a.m.
>>       bios_offset = qemu_ram_alloc(bios_size);
>> -    ret = load_image(filename, qemu_get_ram_ptr(bios_offset));
>> -    if (ret != bios_size) {
>> +    ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size));
>>
>
> Memory leak?

I don't think so.

> AFAICS the qemu_ram_alloc above should be removed and maybe
> bios_offset needs to be killed completely.

Why?  You still need the memory for the bios rom, even if the way it 
gets loaded changes.

cheers,
   Gerd

Patch

diff --git a/hw/pc.c b/hw/pc.c
index c4fa3f7..06e9143 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1108,8 +1108,8 @@  static void pc_init1(ram_addr_t ram_size,
         goto bios_error;
     }
     bios_offset = qemu_ram_alloc(bios_size);
-    ret = load_image(filename, qemu_get_ram_ptr(bios_offset));
-    if (ret != bios_size) {
+    ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size));
+    if (ret != 0) {
     bios_error:
         fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name);
         exit(1);