linuxboot: fix gdt address calculation
PATCH 1/1 linuxboot: fix gdt address calculation
The gdt address calculation in linuxboot.bin is broken in two ways: first it loads %cs into %eax, but that instruction leaves the high bits of %eax undefined and we did not clear them. Secondly, we completely ignore the incorrect %eax, and use the undefined %ebx instead.
With these issues fixed, linuxboot works again.
--- pc-bios/optionrom/linuxboot.S | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
pc-bios/optionrom/linuxboot.S +3 -2
@@ -86,9 +86,10 @@ copy_kernel: /* Now create the GDT descriptor */ movw $((3 * 8) - 1), -16(%bp) mov %cs, %eax + movzwl %ax, %eax shl $4, %eax - addl $gdt, %ebx - movl %ebx, -14(%bp) + addl $gdt, %eax + movl %eax, -14(%bp) /* And load the GDT */ data32 lgdt -16(%bp)
Signature · 1 line
1.6.5.3
Paolo Bonzini
maintainerQuoted 6 lines · Avi Kivity
The gdt address calculation in linuxboot.bin is broken in two ways: first it loads %cs into %eax, but that instruction leaves the high bits of %eax undefined and we did not clear them. Secondly, we completely ignore the incorrect %eax, and use the undefined %ebx instead.
With these issues fixed, linuxboot works again.
Wow, I wonder how it worked for me...
Paolo
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [Qemu-devel] [PATCH] write option roms in pc-bios/
Quoted 7 lines · Paolo Bonzini
Quoted 7 lines
Quoted 7 lines
The gdt address calculation in linuxboot.bin is broken in two ways: first it loads %cs into %eax, but that instruction leaves the high bits of %eax undefined and we did not clear them. Secondly, we completely ignore the incorrect %eax, and use the undefined %ebx instead.
With these issues fixed, linuxboot works again.
Quoted 8 lines
Quoted 2 lines
Wow, I wonder how it worked for me...
Got it. The option roms are built in pc-bios/optionrom, but QEMU loads the ones in pc-bios. So actually I was always testing Alexander's code even though I had done a "make -B" to feel safer. :-(
Signed-off-by Paolo Bonzini<[email protected]>
This will wreak havoc on the tree since these are built by default and they are replacing files in revision control.
Regards,
Anthony Liguori
Paolo Bonzini
maintainer[Qemu-devel] Re: [PATCH] write option roms in pc-bios/
Quoted 3 lines · Anthony Liguori
This will wreak havoc on the tree since these are built by default and they are replacing files in revision control.
... the next question is why are they (linuxboot.bin and multiboot.bin) in revision control since they do not require any strange tool to be built.
Paolo
Re: [Qemu-devel] Re: [PATCH] write option roms in pc-bios/
Quoted 7 lines · Paolo Bonzini
Quoted 2 lines · Anthony Liguori
This will wreak havoc on the tree since these are built by default and they are replacing files in revision control.
... the next question is why are they (linuxboot.bin and multiboot.bin) in revision control since they do not require any strange tool to be built.
They require an i386 cross compiler, which is not available on all installations.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Paolo Bonzini
maintainerRe: [Qemu-devel] Re: [PATCH] write option roms in pc-bios/
Quoted 10 lines · Aurelien Jarno
Quoted 6 lines · Paolo Bonzini
Quoted 2 lines · Anthony Liguori
This will wreak havoc on the tree since these are built by default and they are replacing files in revision control.
... the next question is why are they (linuxboot.bin and multiboot.bin) in revision control since they do not require any strange tool to be built.
They require an i386 cross compiler, which is not available on all installations.
They are being built always anyway now, since their target pc-bios/optionrom/linuxboot.bin does not exist on a checked out tree or even a release tree. But no one has complained.
Paolo
Re: [Qemu-devel] Re: [PATCH] write option roms in pc-bios/
Quoted 5 lines · Paolo Bonzini
Quoted 4 lines · Aurelien Jarno
Quoted 3 lines · Paolo Bonzini
Quoted 2 lines · Anthony Liguori
This will wreak havoc on the tree since these are built by default and they are replacing files in revision control.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
... the next question is why are they (linuxboot.bin and multiboot.bin) in revision control since they do not require any strange tool to be built.
They require an i386 cross compiler, which is not available on all installations.
They are being built always anyway now, since their target pc-bios/optionrom/linuxboot.bin does not exist on a checked out tree or even a release tree. But no one has complained.
They are only built on i386 and x86_64 hosts, look at the configure script. We should continue providing all the ROM binaries, even the x86 ones. We can't require that every installation has a (cross-)compiler for x86, the same way that we don't require a sparc or powerpc cross compiler for x86 installations.
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
[Qemu-devel] Re: [PATCH] write option roms in pc-bios/
In reply to Paolo BonziniQuoted 6 lines · Paolo Bonzini
Quoted 3 lines · Anthony Liguori
This will wreak havoc on the tree since these are built by default and they are replacing files in revision control.
... the next question is why are they (linuxboot.bin and multiboot.bin) in revision control since they do not require any strange tool to be built.
If you're just thinking about x86 and kvm, sure, but when you consider a default build creates tcg targets for arm, sparc, mips, etc, and that they all need firmware, it's extremely unlikely that any given user has all of the cross compilers available to build all of the roms.
Yes, we could and should be smarter about building roms when we can and making sure we install and use those whenever possible. We still need to ship roms though for the foreseeable future.
Regards,
Anthony Liguori
Quoted 1 line
Paolo
Anthony Liguori
AppliedQuoted 9 lines · Avi Kivity
The gdt address calculation in linuxboot.bin is broken in two ways: first it loads %cs into %eax, but that instruction leaves the high bits of %eax undefined and we did not clear them. Secondly, we completely ignore the incorrect %eax, and use the undefined %ebx instead.
With these issues fixed, linuxboot works again.
Signed-off-by Avi Kivity<[email protected]>
Applied. Thanks.
Regards,
Anthony Liguori
Quoted 22 lines
--- pc-bios/optionrom/linuxboot.S | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)pc-bios/optionrom/linuxboot.S +3
-2@@ -86,9 +86,10 @@ copy_kernel: /* Now create the GDT descriptor */ movw $((3 * 8) - 1), -16(%bp) mov %cs, %eax + movzwl %ax, %eax shl $4, %eax - addl $gdt, %ebx - movl %ebx, -14(%bp) + addl $gdt, %eax + movl %eax, -14(%bp) /* And load the GDT */ data32 lgdt -16(%bp)