qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix up pxe boot
@ 2008-09-01 21:11 Glauber Costa
  2008-09-02  8:39 ` [Qemu-devel] " Avi Kivity
  0 siblings, 1 reply; 10+ messages in thread
From: Glauber Costa @ 2008-09-01 21:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori, kvm, apevec, Glauber Costa, chrisw, Eduardo Habkost

As discussed in
http://lists.gnu.org/archive/html/qemu-devel/2008-08/msg00667.html,
current pxe boot is broken for some use cases. The problem
goes away if we reduce the number of allowed bits in the address space
to 32 (which has the side effect of reducing guest max mem size to 4Gb).

After digging for a while, it turns out that it happens because pxelinux
tries to access address 0x10009e9a6, which does not fit a 32-bit address.
A closer look, however, reveals this access is totally valid: It's just
0x9e9a6 with an add carry.

To avoid this, this patch casts the address passed to the POPL macro to
a 32-bit value. This is also done, although just theorectically, for
PUSHL too.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Reported-by: Chris Lalancette <clalance@redhat.com>
CC: Eduardo Habkost <ehabkost@redhat.com>
---
 target-i386/op_helper.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target-i386/op_helper.c b/target-i386/op_helper.c
index 0b5fdc0..433aa3f 100644
--- a/target-i386/op_helper.c
+++ b/target-i386/op_helper.c
@@ -600,7 +600,7 @@ do {\
 #define PUSHL(ssp, sp, sp_mask, val)\
 {\
     sp -= 4;\
-    stl_kernel((ssp) + (sp & (sp_mask)), (val));\
+    stl_kernel((uint32_t)((ssp) + (sp & (sp_mask))), (uint32_t)(val));\
 }
 
 #define POPW(ssp, sp, sp_mask, val)\
@@ -611,7 +611,7 @@ do {\
 
 #define POPL(ssp, sp, sp_mask, val)\
 {\
-    val = (uint32_t)ldl_kernel((ssp) + (sp & (sp_mask)));\
+    val = (uint32_t)ldl_kernel((uint32_t)((ssp) + (sp & (sp_mask))));\
     sp += 4;\
 }
 
-- 
1.5.5.1

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

end of thread, other threads:[~2008-09-09 14:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-01 21:11 [Qemu-devel] [PATCH] Fix up pxe boot Glauber Costa
2008-09-02  8:39 ` [Qemu-devel] " Avi Kivity
2008-09-02 11:07   ` Glauber Costa
2008-09-02 15:20     ` Avi Kivity
2008-09-02 15:22       ` Glauber Costa
2008-09-03 19:27       ` Glauber Costa
2008-09-07  6:42         ` Avi Kivity
2008-09-08 15:38           ` Glauber Costa
2008-09-09 14:17             ` Avi Kivity
2008-09-09 14:48             ` 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).