* [Qemu-devel] [PATCH] multiboot: Fix module loading and setting of mmap
@ 2009-11-18 14:02 Adam Lackorzynski
2009-11-18 14:33 ` Alexander Graf
2009-11-18 14:35 ` Anthony Liguori
0 siblings, 2 replies; 5+ messages in thread
From: Adam Lackorzynski @ 2009-11-18 14:02 UTC (permalink / raw)
To: qemu-devel
Hi,
I need to following to fix multiboot booting for me.
Should linuxboot.bin and multiboot.bin end up in pc-bios instead of
pc-bios/optionrom?
Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
---
hw/pc.c | 4 ++--
pc-bios/optionrom/multiboot.S | 5 ++++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 7c791c4..1c8f95c 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -661,7 +661,7 @@ static int load_multiboot(void *fw_cfg,
/* append module data at the end of last module */
mb_kernel_data = qemu_realloc(mb_kernel_data,
- mh_load_addr - mb_mod_end);
+ mb_mod_end - mh_load_addr);
load_image(initrd_filename,
mb_kernel_data + mb_mod_start - mh_load_addr);
@@ -720,7 +720,7 @@ static int load_multiboot(void *fw_cfg,
fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, mb_bootinfo_data,
sizeof(bootinfo));
- option_rom[nb_option_roms] = "multiboot.bin";
+ option_rom[nb_option_roms] = "optionrom/multiboot.bin";
nb_option_roms++;
return 1; /* yes, we are multiboot */
diff --git a/pc-bios/optionrom/multiboot.S b/pc-bios/optionrom/multiboot.S
index be5c9fc..9131837 100644
--- a/pc-bios/optionrom/multiboot.S
+++ b/pc-bios/optionrom/multiboot.S
@@ -62,6 +62,9 @@ run_multiboot:
add %eax, %ebx
movl %ebx, %gs:GS_GDT_DESC + 2
+ xor %eax, %eax
+ mov %eax, %es
+
/* Read the bootinfo struct into RAM */
read_fw_blob(FW_CFG_INITRD)
@@ -71,7 +74,7 @@ run_multiboot:
mov %ax, %fs
/* ES = mmap_addr */
- mov %eax, %fs:0x48
+ mov %fs:48, %eax
shr $4, %eax
mov %ax, %es
--
1.6.5.2
Adam
--
Adam adam@os.inf.tu-dresden.de
Lackorzynski http://os.inf.tu-dresden.de/~adam/
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] multiboot: Fix module loading and setting of mmap
2009-11-18 14:02 [Qemu-devel] [PATCH] multiboot: Fix module loading and setting of mmap Adam Lackorzynski
@ 2009-11-18 14:33 ` Alexander Graf
2009-11-18 14:53 ` Adam Lackorzynski
2009-11-18 14:35 ` Anthony Liguori
1 sibling, 1 reply; 5+ messages in thread
From: Alexander Graf @ 2009-11-18 14:33 UTC (permalink / raw)
To: Adam Lackorzynski; +Cc: Anthony Liguori, qemu-devel
Adam Lackorzynski wrote:
> Hi,
>
> I need to following to fix multiboot booting for me.
>
> Should linuxboot.bin and multiboot.bin end up in pc-bios instead of
> pc-bios/optionrom?
>
>
> Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
> ---
> hw/pc.c | 4 ++--
> pc-bios/optionrom/multiboot.S | 5 ++++-
> 2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/hw/pc.c b/hw/pc.c
> index 7c791c4..1c8f95c 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -661,7 +661,7 @@ static int load_multiboot(void *fw_cfg,
>
> /* append module data at the end of last module */
> mb_kernel_data = qemu_realloc(mb_kernel_data,
> - mh_load_addr - mb_mod_end);
> + mb_mod_end - mh_load_addr);
>
Right. I wonder why it worked for me before?
> load_image(initrd_filename,
> mb_kernel_data + mb_mod_start - mh_load_addr);
>
> @@ -720,7 +720,7 @@ static int load_multiboot(void *fw_cfg,
> fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, mb_bootinfo_data,
> sizeof(bootinfo));
>
> - option_rom[nb_option_roms] = "multiboot.bin";
> + option_rom[nb_option_roms] = "optionrom/multiboot.bin";
>
This is wrong. The .bin file should be in pc-bios. It just doesn't get
copied over as part of the build process, but instead relies on the
committer to make sure the binary is updated on every source change.
> nb_option_roms++;
>
> return 1; /* yes, we are multiboot */
> diff --git a/pc-bios/optionrom/multiboot.S b/pc-bios/optionrom/multiboot.S
> index be5c9fc..9131837 100644
> --- a/pc-bios/optionrom/multiboot.S
> +++ b/pc-bios/optionrom/multiboot.S
> @@ -62,6 +62,9 @@ run_multiboot:
> add %eax, %ebx
> movl %ebx, %gs:GS_GDT_DESC + 2
>
> + xor %eax, %eax
> + mov %eax, %es
> +
>
Ack. %es could be in any state here.
> /* Read the bootinfo struct into RAM */
> read_fw_blob(FW_CFG_INITRD)
>
> @@ -71,7 +74,7 @@ run_multiboot:
> mov %ax, %fs
>
> /* ES = mmap_addr */
> - mov %eax, %fs:0x48
> + mov %fs:48, %eax
>
Right...
Thanks for catching those!
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] multiboot: Fix module loading and setting of mmap
2009-11-18 14:33 ` Alexander Graf
@ 2009-11-18 14:53 ` Adam Lackorzynski
2009-11-18 15:12 ` Alexander Graf
0 siblings, 1 reply; 5+ messages in thread
From: Adam Lackorzynski @ 2009-11-18 14:53 UTC (permalink / raw)
To: Alexander Graf; +Cc: Anthony Liguori, qemu-devel
On Wed Nov 18, 2009 at 15:33:10 +0100, Alexander Graf wrote:
> Adam Lackorzynski wrote:
> > I need to following to fix multiboot booting for me.
> >
> > Should linuxboot.bin and multiboot.bin end up in pc-bios instead of
> > pc-bios/optionrom?
>
> > load_image(initrd_filename,
> > mb_kernel_data + mb_mod_start - mh_load_addr);
> >
> > @@ -720,7 +720,7 @@ static int load_multiboot(void *fw_cfg,
> > fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, mb_bootinfo_data,
> > sizeof(bootinfo));
> >
> > - option_rom[nb_option_roms] = "multiboot.bin";
> > + option_rom[nb_option_roms] = "optionrom/multiboot.bin";
> >
>
> This is wrong. The .bin file should be in pc-bios. It just doesn't get
> copied over as part of the build process, but instead relies on the
> committer to make sure the binary is updated on every source change.
Ok, didn't know. Thank you both for clarifying! New patch attached.
Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
---
hw/pc.c | 2 +-
pc-bios/multiboot.bin | Bin 512 -> 1024 bytes
pc-bios/optionrom/multiboot.S | 5 ++++-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 7c791c4..6bcfe1b 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -661,7 +661,7 @@ static int load_multiboot(void *fw_cfg,
/* append module data at the end of last module */
mb_kernel_data = qemu_realloc(mb_kernel_data,
- mh_load_addr - mb_mod_end);
+ mb_mod_end - mh_load_addr);
load_image(initrd_filename,
mb_kernel_data + mb_mod_start - mh_load_addr);
diff --git a/pc-bios/multiboot.bin b/pc-bios/multiboot.bin
index 59737c3c6798f83c1b35534d7865c79ba9ca3bc8..d7da6e04ad6d71d26f577d9d6a019719bcce8766 100644
GIT binary patch
delta 261
zcmXZVu}Z^G6vpv$F1I0cu#I9V4%gzY#MMa$cNeJ-(0mTo!A)Em=wfIHT=E32KEb6f
z2@WZAa%&f<xELrj&`k=OK!*b#{NR6l>Dz<rSAi>annbhA>QS4*9nc|err{)-{caFW
zkS-*`52Rlb!8dr0Vcx-T=_1W#lw+iR82s)bP(*Jwd4ZBNQf*NVi%LEaTeb=1pTyK@
z+^ns}PHl-)KRP1F^qtxdQnO1ag{ZR4?YeL3`o3c=dU$b3KcBZeG`LkZ4HHr0DDm)j
sLZm;BWd>vGLhU(Kng}aYiFF^Qsf$Z-!SNZpqTu*}quA%c_PYG^4_6gol>h($
delta 120
zcmZqRXkd{DUB#FdAZK`>??&3f6b8Mt#U_l$*-{u3C-RF+cFSckrZFB)>jcr=au!gI
z1>?lS%1k@BCmvOp_`zCCFO8p3EQ2v^2O|Rm1HaM%y|n*&7L1b}8FeS`W7J{=3f^Ow
R{EE?l$$@dQBGY6>MgYdxBLx5e
diff --git a/pc-bios/optionrom/multiboot.S b/pc-bios/optionrom/multiboot.S
index be5c9fc..9131837 100644
--- a/pc-bios/optionrom/multiboot.S
+++ b/pc-bios/optionrom/multiboot.S
@@ -62,6 +62,9 @@ run_multiboot:
add %eax, %ebx
movl %ebx, %gs:GS_GDT_DESC + 2
+ xor %eax, %eax
+ mov %eax, %es
+
/* Read the bootinfo struct into RAM */
read_fw_blob(FW_CFG_INITRD)
@@ -71,7 +74,7 @@ run_multiboot:
mov %ax, %fs
/* ES = mmap_addr */
- mov %eax, %fs:0x48
+ mov %fs:48, %eax
shr $4, %eax
mov %ax, %es
--
1.6.5.2
Adam
--
Adam adam@os.inf.tu-dresden.de
Lackorzynski http://os.inf.tu-dresden.de/~adam/
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] multiboot: Fix module loading and setting of mmap
2009-11-18 14:53 ` Adam Lackorzynski
@ 2009-11-18 15:12 ` Alexander Graf
0 siblings, 0 replies; 5+ messages in thread
From: Alexander Graf @ 2009-11-18 15:12 UTC (permalink / raw)
To: Adam Lackorzynski; +Cc: Anthony Liguori, qemu-devel
Adam Lackorzynski wrote:
> On Wed Nov 18, 2009 at 15:33:10 +0100, Alexander Graf wrote:
>
>> Adam Lackorzynski wrote:
>>
>>> I need to following to fix multiboot booting for me.
>>>
>>> Should linuxboot.bin and multiboot.bin end up in pc-bios instead of
>>> pc-bios/optionrom?
>>>
>>> load_image(initrd_filename,
>>> mb_kernel_data + mb_mod_start - mh_load_addr);
>>>
>>> @@ -720,7 +720,7 @@ static int load_multiboot(void *fw_cfg,
>>> fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, mb_bootinfo_data,
>>> sizeof(bootinfo));
>>>
>>> - option_rom[nb_option_roms] = "multiboot.bin";
>>> + option_rom[nb_option_roms] = "optionrom/multiboot.bin";
>>>
>>>
>> This is wrong. The .bin file should be in pc-bios. It just doesn't get
>> copied over as part of the build process, but instead relies on the
>> committer to make sure the binary is updated on every source change.
>>
>
> Ok, didn't know. Thank you both for clarifying! New patch attached.
>
>
> Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
>
Acked-by: Alexander Graf <agraf@suse.de>
Alex
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] multiboot: Fix module loading and setting of mmap
2009-11-18 14:02 [Qemu-devel] [PATCH] multiboot: Fix module loading and setting of mmap Adam Lackorzynski
2009-11-18 14:33 ` Alexander Graf
@ 2009-11-18 14:35 ` Anthony Liguori
1 sibling, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2009-11-18 14:35 UTC (permalink / raw)
To: Adam Lackorzynski; +Cc: qemu-devel, Alexander Graf
Adam Lackorzynski wrote:
> Hi,
>
> I need to following to fix multiboot booting for me.
>
> Should linuxboot.bin and multiboot.bin end up in pc-bios instead of
> pc-bios/optionrom?
>
>
> Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
> ---
> hw/pc.c | 4 ++--
> pc-bios/optionrom/multiboot.S | 5 ++++-
> 2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/hw/pc.c b/hw/pc.c
> index 7c791c4..1c8f95c 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -661,7 +661,7 @@ static int load_multiboot(void *fw_cfg,
>
> /* append module data at the end of last module */
> mb_kernel_data = qemu_realloc(mb_kernel_data,
> - mh_load_addr - mb_mod_end);
> + mb_mod_end - mh_load_addr);
>
That bit looks right.
> load_image(initrd_filename,
> mb_kernel_data + mb_mod_start - mh_load_addr);
>
> @@ -720,7 +720,7 @@ static int load_multiboot(void *fw_cfg,
> fw_cfg_add_bytes(fw_cfg, FW_CFG_INITRD_DATA, mb_bootinfo_data,
> sizeof(bootinfo));
>
> - option_rom[nb_option_roms] = "multiboot.bin";
> + option_rom[nb_option_roms] = "optionrom/multiboot.bin";
> nb_option_roms++;
This bit doesn't. multiboot.bin gets installed in ${prefix}/share/.
There is a blob shipped in pc-bios/ so if you do -L $srcdir/pc-bios it
should work. However, if you did -L $objdir/pc-bios where $objdir !=
$srcdir, it would not work without your patch. The same is true for
seabios and the other roms.
Your patch would break the first two though. I'm not sure we have a
great solution.
>
> return 1; /* yes, we are multiboot */
> diff --git a/pc-bios/optionrom/multiboot.S b/pc-bios/optionrom/multiboot.S
> index be5c9fc..9131837 100644
> --- a/pc-bios/optionrom/multiboot.S
> +++ b/pc-bios/optionrom/multiboot.S
> @@ -62,6 +62,9 @@ run_multiboot:
> add %eax, %ebx
> movl %ebx, %gs:GS_GDT_DESC + 2
>
> + xor %eax, %eax
> + mov %eax, %es
> +
> /* Read the bootinfo struct into RAM */
> read_fw_blob(FW_CFG_INITRD)
>
> @@ -71,7 +74,7 @@ run_multiboot:
> mov %ax, %fs
>
> /* ES = mmap_addr */
> - mov %eax, %fs:0x48
> + mov %fs:48, %eax
> shr $4, %eax
> mov %ax, %es
>
This bit needs to be reviewed/acked by Alex.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-11-18 15:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-18 14:02 [Qemu-devel] [PATCH] multiboot: Fix module loading and setting of mmap Adam Lackorzynski
2009-11-18 14:33 ` Alexander Graf
2009-11-18 14:53 ` Adam Lackorzynski
2009-11-18 15:12 ` Alexander Graf
2009-11-18 14:35 ` Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).