|  | @@ -19,6 +19,8 @@ FILE_LICENCE ( GPL2_OR_LATER )
 | 
		
	
		
			
			| 19 | 19 |  #define EB_MAGIC_1 ( 'E' + ( 't' << 8 ) + ( 'h' << 16 ) + ( 'e' << 24 ) )
 | 
		
	
		
			
			| 20 | 20 |  #define EB_MAGIC_2 ( 'r' + ( 'b' << 8 ) + ( 'o' << 16 ) + ( 'o' << 24 ) )
 | 
		
	
		
			
			| 21 | 21 |  
 | 
		
	
		
			
			|  | 22 | +#define PREFIX_STACK_SIZE 2048
 | 
		
	
		
			
			|  | 23 | +
 | 
		
	
		
			
			| 22 | 24 |  /*****************************************************************************
 | 
		
	
		
			
			| 23 | 25 |   * Entry point:	set operating context, print welcome message
 | 
		
	
		
			
			| 24 | 26 |   *****************************************************************************
 | 
		
	
	
		
			
			|  | @@ -46,10 +48,11 @@ _pxe_start:
 | 
		
	
		
			
			| 46 | 48 |  	movw	%ax, %ds
 | 
		
	
		
			
			| 47 | 49 |  	movw	$0x40, %ax		/* BIOS data segment access */
 | 
		
	
		
			
			| 48 | 50 |  	movw	%ax, %fs
 | 
		
	
		
			
			| 49 |  | -	/* Set up stack just below 0x7c00 */
 | 
		
	
		
			
			| 50 |  | -	xorw	%ax, %ax
 | 
		
	
		
			
			|  | 51 | +	/* Set up temporary stack immediately after the iPXE image */
 | 
		
	
		
			
			|  | 52 | +	movw	%cs, %ax
 | 
		
	
		
			
			|  | 53 | +	addw	image_size_pgh, %ax
 | 
		
	
		
			
			| 51 | 54 |  	movw	%ax, %ss
 | 
		
	
		
			
			| 52 |  | -	movl	$0x7c00, %esp
 | 
		
	
		
			
			|  | 55 | +	movl	$PREFIX_STACK_SIZE, %esp
 | 
		
	
		
			
			| 53 | 56 |  	/* Clear direction flag, for the sake of sanity */
 | 
		
	
		
			
			| 54 | 57 |  	cld
 | 
		
	
		
			
			| 55 | 58 |  	/* Print welcome message */
 | 
		
	
	
		
			
			|  | @@ -60,6 +63,18 @@ _pxe_start:
 | 
		
	
		
			
			| 60 | 63 |  10:	.asciz	"PXE->EB:"
 | 
		
	
		
			
			| 61 | 64 |  	.previous
 | 
		
	
		
			
			| 62 | 65 |  
 | 
		
	
		
			
			|  | 66 | +	/* Image size (for stack placement calculation) */
 | 
		
	
		
			
			|  | 67 | +	.section ".prefix.data", "aw", @progbits
 | 
		
	
		
			
			|  | 68 | +image_size_pgh:
 | 
		
	
		
			
			|  | 69 | +	.word	0
 | 
		
	
		
			
			|  | 70 | +	.previous
 | 
		
	
		
			
			|  | 71 | +	.section ".zinfo.fixup", "a", @progbits	/* Compressor fixups */
 | 
		
	
		
			
			|  | 72 | +	.ascii	"ADDW"
 | 
		
	
		
			
			|  | 73 | +	.long	image_size_pgh
 | 
		
	
		
			
			|  | 74 | +	.long	16
 | 
		
	
		
			
			|  | 75 | +	.long	0
 | 
		
	
		
			
			|  | 76 | +	.previous
 | 
		
	
		
			
			|  | 77 | +
 | 
		
	
		
			
			| 63 | 78 |  /*****************************************************************************
 | 
		
	
		
			
			| 64 | 79 |   * Find us a usable !PXE or PXENV+ entry point
 | 
		
	
		
			
			| 65 | 80 |   *****************************************************************************
 |