/* Call loader */
undi_loader_entry = undirom->loader_entry;
- __asm__ __volatile__ ( REAL_CODE ( "pushw %%ds\n\t"
+ __asm__ __volatile__ ( REAL_CODE ( "pushl %%ebp\n\t" /* gcc bug */
+ "pushw %%ds\n\t"
"pushw %%ax\n\t"
"lcall *undi_loader_entry\n\t"
- "addw $4, %%sp\n\t" )
+ "popl %%ebp\n\t" /* discard */
+ "popl %%ebp\n\t" /* gcc bug */ )
: "=a" ( exit )
: "a" ( __from_data16 ( &undi_loader ) )
- : "ebx", "ecx", "edx", "esi", "edi", "ebp" );
+ : "ebx", "ecx", "edx", "esi", "edi" );
if ( exit != PXENV_EXIT_SUCCESS ) {
/* Clear entry point */
return;
/* Print character with attribute */
- __asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
+ __asm__ __volatile__ ( REAL_CODE ( "pushl %%ebp\n\t" /* gcc bug */
+ "sti\n\t"
/* Skip non-printable characters */
"cmpb $0x20, %%al\n\t"
"jb 1f\n\t"
"xorw %%bx, %%bx\n\t"
"movb $0x0e, %%ah\n\t"
"int $0x10\n\t"
- "cli\n\t" )
+ "cli\n\t"
+ "popl %%ebp\n\t" /* gcc bug */ )
: "=a" ( discard_a ), "=b" ( discard_b ),
"=c" ( discard_c )
- : "a" ( character ), "b" ( bios_attr )
- : "ebp" );
+ : "a" ( character ), "b" ( bios_attr ) );
}
/**
"movw %%ss, %%ax\n\t"
"movw %%ax, %%cs:saved_ss\n\t"
"movw %%sp, %%cs:saved_sp\n\t"
+ /* Save frame pointer (gcc bug) */
+ "movl %%ebp, %%cs:saved_ebp\n\t"
/* Prepare jump to boot sector */
"pushw %%bx\n\t"
"pushw %%di\n\t"
"sti\n\t"
"lret\n\t"
/* Preserved variables */
+ "\nsaved_ebp: .long 0\n\t"
"\nsaved_ss: .word 0\n\t"
"\nsaved_sp: .word 0\n\t"
"\nsaved_retaddr: .word 0\n\t"
/* Boot failure return point */
"\nbootsector_exec_fail:\n\t"
+ /* Restore frame pointer (gcc bug) */
+ "movl %%cs:saved_ebp, %%ebp\n\t"
/* Restore stack pointer */
"movw %%cs:saved_ss, %%ax\n\t"
"movw %%ax, %%ss\n\t"
"=d" ( discard_d )
: "b" ( segment ), "D" ( offset ),
"d" ( drive )
- : "eax", "ecx", "esi", "ebp" );
+ : "eax", "ecx", "esi" );
DBG ( "Booted disk returned via INT 18 or 19\n" );
/* Jump to OS with flat physical addressing */
DBGC ( image, "ELF %p starting execution at %lx\n", image, entry );
- __asm__ __volatile__ ( PHYS_CODE ( "call *%%edi\n\t" )
+ __asm__ __volatile__ ( PHYS_CODE ( "pushl %%ebp\n\t" /* gcc bug */
+ "call *%%edi\n\t"
+ "popl %%ebp\n\t" /* gcc bug */ )
: : "D" ( entry )
- : "eax", "ebx", "ecx", "edx", "esi", "ebp",
- "memory" );
+ : "eax", "ebx", "ecx", "edx", "esi", "memory" );
DBGC ( image, "ELF %p returned\n", image );
imgheader->execaddr.segoff.offset );
__asm__ __volatile__ (
- REAL_CODE ( "pushw %%ds\n\t" /* far pointer to bootp data */
+ REAL_CODE ( "pushl %%ebp\n\t" /* gcc bug */
+ "pushw %%ds\n\t" /* far pointer to bootp data */
"pushw %%bx\n\t"
"pushl %%esi\n\t" /* location */
"pushw %%cs\n\t" /* lcall execaddr */
"pushl %%edi\n\t"
"lret\n\t"
"\n2:\n\t"
- "addw $8,%%sp\n\t" /* clean up stack */ )
+ "addw $8,%%sp\n\t" /* clean up stack */
+ "popl %%ebp\n\t" /* gcc bug */ )
: "=a" ( rc ), "=D" ( discard_D ), "=S" ( discard_S ),
"=b" ( discard_b )
: "D" ( imgheader->execaddr.segoff ),
"S" ( imgheader->location ),
"b" ( __from_data16 ( basemem_packet ) )
- : "ecx", "edx", "ebp" );
+ : "ecx", "edx" );
return rc;
}
/* Jump to OS with flat physical addressing */
__asm__ __volatile__ (
- PHYS_CODE ( "pushl %%ebx\n\t" /* bootp data */
+ PHYS_CODE ( "pushl %%ebp\n\t" /* gcc bug */
+ "pushl %%ebx\n\t" /* bootp data */
"pushl %%esi\n\t" /* imgheader */
"pushl %%eax\n\t" /* loaderinfo */
"call *%%edi\n\t"
- "addl $12, %%esp\n\t" /* clean up stack */ )
+ "addl $12, %%esp\n\t" /* clean up stack */
+ "popl %%ebp\n\t" /* gcc bug */ )
: "=a" ( rc ), "=D" ( discard_D ), "=S" ( discard_S ),
"=b" ( discard_b )
: "D" ( imgheader->execaddr.linear ),
imgheader->location.offset ),
"b" ( virt_to_phys ( basemem_packet ) ),
"a" ( virt_to_phys ( &loaderinfo ) )
- : "ecx", "edx", "ebp", "memory" );
+ : "ecx", "edx", "memory" );
return rc;
}
/* Call real-mode entry point. This calling convention will
* work with both the !PXE and the PXENV+ entry points.
*/
- __asm__ __volatile__ ( REAL_CODE ( "pushw %%es\n\t"
+ __asm__ __volatile__ ( REAL_CODE ( "pushl %%ebp\n\t" /* gcc bug */
+ "pushw %%es\n\t"
"pushw %%di\n\t"
"pushw %%bx\n\t"
"lcall *pxeparent_entry_point\n\t"
- "addw $6, %%sp\n\t" )
+ "addw $6, %%sp\n\t"
+ "popl %%ebp\n\t" /* gcc bug */ )
: "=a" ( exit ), "=b" ( discard_b ),
"=D" ( discard_D )
: "b" ( function ),
"D" ( __from_data16 ( &pxeparent_params ) )
- : "ecx", "edx", "esi", "ebp" );
+ : "ecx", "edx", "esi" );
/* Determine return status code based on PXENV_EXIT and
* PXENV_STATUS