kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH master, stable-0.12] linuxboot: fix gdt address calculation
@ 2009-12-24 13:38 Avi Kivity
  2009-12-24 13:56 ` Paolo Bonzini
  2010-01-08 16:41 ` [Qemu-devel] " Anthony Liguori
  0 siblings, 2 replies; 3+ messages in thread
From: Avi Kivity @ 2009-12-24 13:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: kvm, Marcelo Tosatti

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 <avi@redhat.com>
---
 pc-bios/optionrom/linuxboot.S |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/pc-bios/optionrom/linuxboot.S b/pc-bios/optionrom/linuxboot.S
index c4c9109..8aebe51 100644
--- a/pc-bios/optionrom/linuxboot.S
+++ b/pc-bios/optionrom/linuxboot.S
@@ -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)
-- 
1.6.5.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH master, stable-0.12] linuxboot: fix gdt address calculation
  2009-12-24 13:38 [PATCH master, stable-0.12] linuxboot: fix gdt address calculation Avi Kivity
@ 2009-12-24 13:56 ` Paolo Bonzini
  2010-01-08 16:41 ` [Qemu-devel] " Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2009-12-24 13:56 UTC (permalink / raw)
  To: Avi Kivity; +Cc: qemu-devel, kvm, Marcelo Tosatti

On 12/24/2009 02:38 PM, Avi Kivity wrote:
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH master, stable-0.12] linuxboot: fix gdt address calculation
  2009-12-24 13:38 [PATCH master, stable-0.12] linuxboot: fix gdt address calculation Avi Kivity
  2009-12-24 13:56 ` Paolo Bonzini
@ 2010-01-08 16:41 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2010-01-08 16:41 UTC (permalink / raw)
  To: Avi Kivity; +Cc: qemu-devel, Marcelo Tosatti, kvm

On 12/24/2009 07:38 AM, Avi Kivity wrote:
> 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<avi@redhat.com>
>    

Applied.  Thanks.

Regards,

Anthony Liguori
> ---
>   pc-bios/optionrom/linuxboot.S |    5 +++--
>   1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/pc-bios/optionrom/linuxboot.S b/pc-bios/optionrom/linuxboot.S
> index c4c9109..8aebe51 100644
> --- a/pc-bios/optionrom/linuxboot.S
> +++ b/pc-bios/optionrom/linuxboot.S
> @@ -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)
>    


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-01-08 16:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-24 13:38 [PATCH master, stable-0.12] linuxboot: fix gdt address calculation Avi Kivity
2009-12-24 13:56 ` Paolo Bonzini
2010-01-08 16:41 ` [Qemu-devel] " 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).