Re: [ipxe-devel] compile fails with gcc 4.8.0
Christian Hessel...@eworm.de on Tue, 2013/04/02 10:35: with gcc 4.8.0 compilation fails: [BUILD] bin/pxe_call.o arch/i386/interface/pxe/pxe_call.c: In function ‘pxe_start_nbp’: arch/i386/interface/pxe/pxe_call.c:284:1: error: bp cannot be used in asm here The icky workaround for this is now pushed: http://git.ipxe.org/ipxe.git/commitdiff/238050d Michael ___ ipxe-devel mailing list ipxe-devel@lists.ipxe.org https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel
Re: [ipxe-devel] compile fails with gcc 4.8.0
On Fri, Jun 07, 2013 at 02:05:54PM +0100, Michael Brown wrote: Christian Hessel...@eworm.de on Tue, 2013/04/02 10:35: with gcc 4.8.0 compilation fails: [BUILD] bin/pxe_call.o arch/i386/interface/pxe/pxe_call.c: In function ‘pxe_start_nbp’: arch/i386/interface/pxe/pxe_call.c:284:1: error: bp cannot be used in asm here The icky workaround for this is now pushed: http://git.ipxe.org/ipxe.git/commitdiff/238050d This doesn't look right: - addw $4, %%sp\n\t ) + popl %%ebp\n\t /* discard */ + popl %%ebp\n\t /* gcc bug */ ) In the original patch it was - addw $4, %%sp\n\t ) + addw $4, %%sp\n\t + popl %%ebp\n\t ) You've accidentally transposed the 'addw' into a second 'popl'. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| ___ ipxe-devel mailing list ipxe-devel@lists.ipxe.org https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel
Re: [ipxe-devel] compile fails with gcc 4.8.0
On 07/06/13 14:22, Daniel P. Berrange wrote: This doesn't look right: - addw $4, %%sp\n\t ) + popl %%ebp\n\t /* discard */ + popl %%ebp\n\t /* gcc bug */ ) In the original patch it was - addw $4, %%sp\n\t ) + addw $4, %%sp\n\t + popl %%ebp\n\t ) You've accidentally transposed the 'addw' into a second 'popl'. That's deliberate: since %ebp is about to get overwritten anyway, we can use it as a discard register for the popl, which increments %sp by 4 using only two bytes of code rather than three. You can see several other instances of this pattern within the codebase: git grep pop.*discard Michael ___ ipxe-devel mailing list ipxe-devel@lists.ipxe.org https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel
Re: [ipxe-devel] compile fails with gcc 4.8.0
On Fri, Jun 07, 2013 at 02:30:10PM +0100, Michael Brown wrote: On 07/06/13 14:22, Daniel P. Berrange wrote: This doesn't look right: - addw $4, %%sp\n\t ) + popl %%ebp\n\t /* discard */ + popl %%ebp\n\t /* gcc bug */ ) In the original patch it was - addw $4, %%sp\n\t ) + addw $4, %%sp\n\t + popl %%ebp\n\t ) You've accidentally transposed the 'addw' into a second 'popl'. That's deliberate: since %ebp is about to get overwritten anyway, we can use it as a discard register for the popl, which increments %sp by 4 using only two bytes of code rather than three. You can see several other instances of this pattern within the codebase: git grep pop.*discard Ok, I'll assume you're right since my assembler knowledge is tiny :-) Just wanted to make sure it wasn't an accidental typo. Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| ___ ipxe-devel mailing list ipxe-devel@lists.ipxe.org https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel
Re: [ipxe-devel] compile fails with gcc 4.8.0
Michael Brown mbr...@fensystems.co.uk on Thu, 2013/04/04 22:42: On 03/04/13 09:37, Christian Hesse wrote: Christian Hessel...@eworm.de on Tue, 2013/04/02 10:35: Hello everybody, with gcc 4.8.0 compilation fails: With [BUILD] bin/pxe_call.o arch/i386/interface/pxe/pxe_call.c: In function ‘pxe_start_nbp’: arch/i386/interface/pxe/pxe_call.c:284:1: error: bp cannot be used in asm here } ^ No idea how to fix this, though. Oh, this has been reported before... Sorry. But I have a patch. Compiles and works for me [tm], hope it is correct. Thanks. The patch works, but it would be awesome to find a proper generic solution to this issue. The problem with adding a manual pushl/popl %ebp pair is twofold: - it may add unnecessary code (if there's nothing useful currently in %ebp anyway) - it generates incorrect code if any of the asm constraints end up generating memory references to local variables. (Not applicable in this case, but it's a nasty thing to have to remember for future maintenance.) I did get access to the gcc compile farm, but none of the test machines therein seem to have gcc 4.8 installed! If anyone has the time to investigate a proper solution for this, I'd be very grateful. Just an update for anybody how needs to build this with gcc 4.8... -- main(a){char*c=/*Schoene Gruesse */B?IJj;MEH CX:;,b;for(a/*Chris get my mail address:*/=0;b=c[a++];) putchar(b-1/(/* gcc -o sig sig.c ./sig*/b/42*2-3)*42);} diff --git a/src/arch/i386/interface/pxe/pxe_call.c b/src/arch/i386/interface/pxe/pxe_call.c index 7fce75a..2ad3e77 100644 --- a/src/arch/i386/interface/pxe/pxe_call.c +++ b/src/arch/i386/interface/pxe/pxe_call.c @@ -271,12 +271,14 @@ int pxe_start_nbp ( void ) { DBG ( Restarting NBP (%x)\n, jmp ); /* Far call to PXE NBP */ - __asm__ __volatile__ ( REAL_CODE ( movw %%cx, %%es\n\t + __asm__ __volatile__ ( REAL_CODE ( pushl %%ebp\n\t + movw %%cx, %%es\n\t pushw %%es\n\t pushw %%di\n\t sti\n\t lcall $0, $0x7c00\n\t - addw $4, %%sp\n\t ) + addw $4, %%sp\n\t + popl %%ebp\n\t) : =a ( status ), =b ( discard_b ), =c ( discard_c ), =d ( discard_d ), =D ( discard_D ) @@ -284,7 +286,7 @@ int pxe_start_nbp ( void ) { c ( rm_cs ), d ( virt_to_phys ( pxenv ) ), D ( __from_text16 ( ppxe ) ) - : esi, ebp, memory ); + : esi, memory ); if ( status ) return -EPXENBP ( status ); signature.asc Description: PGP signature ___ ipxe-devel mailing list ipxe-devel@lists.ipxe.org https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel
Re: [ipxe-devel] compile fails with gcc 4.8.0
Christian Hesse l...@eworm.de on Tue, 2013/04/02 10:35: Hello everybody, with gcc 4.8.0 compilation fails: With [BUILD] bin/pxe_call.o arch/i386/interface/pxe/pxe_call.c: In function ‘pxe_start_nbp’: arch/i386/interface/pxe/pxe_call.c:284:1: error: bp cannot be used in asm here } ^ No idea how to fix this, though. Oh, this has been reported before... Sorry. But I have a patch. Compiles and works for me [tm], hope it is correct. -- main(a){char*c=/*Schoene Gruesse */B?IJj;MEH CX:;,b;for(a/*Chris get my mail address:*/=0;b=c[a++];) putchar(b-1/(/* gcc -o sig sig.c ./sig*/b/42*2-3)*42);} diff --git a/src/arch/i386/interface/pxe/pxe_call.c b/src/arch/i386/interface/pxe/pxe_call.c index b8e73a0..5f8ed07 100644 --- a/src/arch/i386/interface/pxe/pxe_call.c +++ b/src/arch/i386/interface/pxe/pxe_call.c @@ -265,12 +265,14 @@ int pxe_start_nbp ( void ) { DBG ( Restarting NBP (%x)\n, jmp ); /* Far call to PXE NBP */ - __asm__ __volatile__ ( REAL_CODE ( movw %%cx, %%es\n\t + __asm__ __volatile__ ( REAL_CODE ( pushl %%ebp\n\t + movw %%cx, %%es\n\t pushw %%es\n\t pushw %%di\n\t sti\n\t lcall $0, $0x7c00\n\t - addw $4, %%sp\n\t ) + addw $4, %%sp\n\t + popl %%ebp\n\t ) : =a ( rc ), =b ( discard_b ), =c ( discard_c ), =d ( discard_d ), =D ( discard_D ) @@ -278,7 +280,7 @@ int pxe_start_nbp ( void ) { c ( rm_cs ), d ( virt_to_phys ( pxenv ) ), D ( __from_text16 ( ppxe ) ) - : esi, ebp, memory ); + : esi, memory ); return rc; } signature.asc Description: PGP signature ___ ipxe-devel mailing list ipxe-devel@lists.ipxe.org https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel