From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kay2N-0002ra-Qe for qemu-devel@nongnu.org; Wed, 03 Sep 2008 15:29:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kay2L-0002rL-AV for qemu-devel@nongnu.org; Wed, 03 Sep 2008 15:29:06 -0400 Received: from [199.232.76.173] (port=56218 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kay2L-0002rI-58 for qemu-devel@nongnu.org; Wed, 03 Sep 2008 15:29:05 -0400 Received: from mx2.redhat.com ([66.187.237.31]:48968) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kay2K-0004Wy-GR for qemu-devel@nongnu.org; Wed, 03 Sep 2008 15:29:04 -0400 Date: Wed, 3 Sep 2008 16:27:00 -0300 From: Glauber Costa Message-ID: <20080903192700.GA8000@poweredge.glommer> References: <1220303503-19413-1-git-send-email-glommer@redhat.com> <48BCFBB1.4090109@qumranet.com> <5d6222a80809020407l68f7ab87i6d2520c57c7ddeb3@mail.gmail.com> <48BD59D7.7000702@qumranet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <48BD59D7.7000702@qumranet.com> Subject: [Qemu-devel] Re: [PATCH] Fix up pxe boot Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: aliguori@us.ibm.com, kvm@vger.kernel.org, apevec@redhat.com, Glauber Costa , qemu-devel@nongnu.org, chrisw@sous-sol.org, Eduardo Habkost On Tue, Sep 02, 2008 at 06:20:55PM +0300, Avi Kivity wrote: > Glauber Costa wrote: >> On Tue, Sep 2, 2008 at 5:39 AM, Avi Kivity wrote: >> >>> Glauber Costa wrote: >>> >>>> 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));\ >>>> } >>>> >>>> >>> Surly it is better to push this into the underlying virtual->physical >>> translation functions, so it applies everywhere? >>> >>> btw, the cast is wrong for x86-64, so it must be qualified for 32-bit >>> operating modes. >>> >> The tests were all done with x86_64. This is a PUSHL macro, so it's >> 32-bit anyway. >> A x86_64-only PUSHQ seems to do the right thing. >> >> > > Right. > > It's still odd to see this in an op helper rather than in somewhere generic. After a second look, here's what it seems to me: It's not in a generic place, such as ldl, because in general, we may want to grab a 32-bit value from a 64-bit address. This is perfectly valid. It's a specifity that the pop instruction, when not in long mode (manual says that in 64-bit mode no 32-bit operand is valid, but then again, qemu should use the POPQ macro), that ssp:sp may overflow, but we don't want it. It would be possible to do something more generic if we had a segment_to_linear() function, that returned the linear address, but we don't. Does it make more sense to you? > > -- > error compiling committee.c: too many arguments to function >