|  | @@ -37,6 +37,7 @@
 | 
		
	
		
			
			| 37 | 37 |  	cld
 | 
		
	
		
			
			| 38 | 38 |  	/* Print welcome message */
 | 
		
	
		
			
			| 39 | 39 |  	movw	$10f, %si
 | 
		
	
		
			
			|  | 40 | +	xorw	%di, %di
 | 
		
	
		
			
			| 40 | 41 |  	call	print_message
 | 
		
	
		
			
			| 41 | 42 |  	.section ".prefix.data"
 | 
		
	
		
			
			| 42 | 43 |  10:	.asciz	"PXE->EB:"
 | 
		
	
	
		
			
			|  | @@ -48,24 +49,23 @@
 | 
		
	
		
			
			| 48 | 49 |   */
 | 
		
	
		
			
			| 49 | 50 |  detect_pxenv:
 | 
		
	
		
			
			| 50 | 51 |  	/* Signature check */
 | 
		
	
		
			
			| 51 |  | -	les	pxenv_segoff, %di
 | 
		
	
		
			
			| 52 |  | -	cmpl	$0x4e455850, %es:(%di)	/* 'PXEN' signature */
 | 
		
	
		
			
			|  | 52 | +	les	pxenv_segoff, %bx
 | 
		
	
		
			
			|  | 53 | +	cmpl	$0x4e455850, %es:(%bx)	/* 'PXEN' signature */
 | 
		
	
		
			
			| 53 | 54 |  	jne	no_pxenv
 | 
		
	
		
			
			| 54 |  | -	cmpw	$0x2b56, %es:4(%di)	/* 'V+' signature */
 | 
		
	
		
			
			|  | 55 | +	cmpw	$0x2b56, %es:4(%bx)	/* 'V+' signature */
 | 
		
	
		
			
			| 55 | 56 |  	jne	no_pxenv
 | 
		
	
		
			
			| 56 | 57 |  	/* Record entry point and UNDI segments */
 | 
		
	
		
			
			| 57 |  | -	pushl	%es:0x0a(%di)		/* Entry point */
 | 
		
	
		
			
			|  | 58 | +	pushl	%es:0x0a(%bx)		/* Entry point */
 | 
		
	
		
			
			| 58 | 59 |  	popl	entry_segoff
 | 
		
	
		
			
			| 59 |  | -	pushw	%es:0x24(%di)		/* UNDI code segment */
 | 
		
	
		
			
			| 60 |  | -	pushw	%es:0x26(%di)		/* UNDI code size */
 | 
		
	
		
			
			|  | 60 | +	pushw	%es:0x24(%bx)		/* UNDI code segment */
 | 
		
	
		
			
			|  | 61 | +	pushw	%es:0x26(%bx)		/* UNDI code size */
 | 
		
	
		
			
			| 61 | 62 |  	popl	undi_code_segoff
 | 
		
	
		
			
			| 62 |  | -	pushw	%es:0x20(%di)		/* UNDI data segment */
 | 
		
	
		
			
			| 63 |  | -	pushw	%es:0x22(%di)		/* UNDI data size */
 | 
		
	
		
			
			|  | 63 | +	pushw	%es:0x20(%bx)		/* UNDI data segment */
 | 
		
	
		
			
			|  | 64 | +	pushw	%es:0x22(%bx)		/* UNDI data size */
 | 
		
	
		
			
			| 64 | 65 |  	popl	undi_data_segoff
 | 
		
	
		
			
			| 65 | 66 |  	/* Print "PXENV+ at <address>" */
 | 
		
	
		
			
			| 66 | 67 |  	movw	$10f, %si
 | 
		
	
		
			
			| 67 | 68 |  	call	print_message
 | 
		
	
		
			
			| 68 |  | -	movw	%bx, %di
 | 
		
	
		
			
			| 69 | 69 |  	call	print_segoff
 | 
		
	
		
			
			| 70 | 70 |  	movb	$',', %al
 | 
		
	
		
			
			| 71 | 71 |  	call	print_character
 | 
		
	
	
		
			
			|  | @@ -86,20 +86,20 @@ no_pxenv:
 | 
		
	
		
			
			| 86 | 86 |   */
 | 
		
	
		
			
			| 87 | 87 |  detect_ppxe:
 | 
		
	
		
			
			| 88 | 88 |  	/* Signature check */
 | 
		
	
		
			
			| 89 |  | -	les	ppxe_segoff, %di
 | 
		
	
		
			
			| 90 |  | -	cmpl	$0x45585021, %es:(%di)	/* '!PXE' signature */
 | 
		
	
		
			
			|  | 89 | +	les	ppxe_segoff, %bx
 | 
		
	
		
			
			|  | 90 | +	cmpl	$0x45585021, %es:(%bx)	/* '!PXE' signature */
 | 
		
	
		
			
			| 91 | 91 |  	jne	no_ppxe
 | 
		
	
		
			
			| 92 | 92 |  	/* Record structure address, entry point, and UNDI segments */
 | 
		
	
		
			
			| 93 | 93 |  	pushw	%es
 | 
		
	
		
			
			| 94 | 94 |  	popw	ppxe_segment
 | 
		
	
		
			
			| 95 |  | -	movw	%di, ppxe_offset
 | 
		
	
		
			
			| 96 |  | -	pushl	%es:0x10(%di)		/* Entry point */
 | 
		
	
		
			
			|  | 95 | +	movw	%bx, ppxe_offset
 | 
		
	
		
			
			|  | 96 | +	pushl	%es:0x10(%bx)		/* Entry point */
 | 
		
	
		
			
			| 97 | 97 |  	popl	entry_segoff
 | 
		
	
		
			
			| 98 |  | -	pushw	%es:0x30(%di)		/* UNDI code segment */
 | 
		
	
		
			
			| 99 |  | -	pushw	%es:0x36(%di)		/* UNDI code size */
 | 
		
	
		
			
			|  | 98 | +	pushw	%es:0x30(%bx)		/* UNDI code segment */
 | 
		
	
		
			
			|  | 99 | +	pushw	%es:0x36(%bx)		/* UNDI code size */
 | 
		
	
		
			
			| 100 | 100 |  	popl	undi_code_segoff
 | 
		
	
		
			
			| 101 |  | -	pushw	%es:0x28(%di)		/* UNDI data segment */
 | 
		
	
		
			
			| 102 |  | -	pushw	%es:0x2e(%di)		/* UNDI data size */
 | 
		
	
		
			
			|  | 101 | +	pushw	%es:0x28(%bx)		/* UNDI data segment */
 | 
		
	
		
			
			|  | 102 | +	pushw	%es:0x2e(%bx)		/* UNDI data size */
 | 
		
	
		
			
			| 103 | 103 |  	popl	undi_data_segoff
 | 
		
	
		
			
			| 104 | 104 |  	/* Print "!PXE at <address>" */
 | 
		
	
		
			
			| 105 | 105 |  	movw	$10f, %si
 | 
		
	
	
		
			
			|  | @@ -167,7 +167,7 @@ print_structure_information:
 | 
		
	
		
			
			| 167 | 167 |  	/* Print entry point */
 | 
		
	
		
			
			| 168 | 168 |  	movw	$10f, %si
 | 
		
	
		
			
			| 169 | 169 |  	call	print_message
 | 
		
	
		
			
			| 170 |  | -	les	entry_segoff, %di
 | 
		
	
		
			
			|  | 170 | +	les	entry_segoff, %bx
 | 
		
	
		
			
			| 171 | 171 |  	call	print_segoff
 | 
		
	
		
			
			| 172 | 172 |  	.section ".prefix.data"
 | 
		
	
		
			
			| 173 | 173 |  10:	.asciz	" entry point at "
 | 
		
	
	
		
			
			|  | @@ -175,7 +175,7 @@ print_structure_information:
 | 
		
	
		
			
			| 175 | 175 |  	/* Print UNDI code segment */
 | 
		
	
		
			
			| 176 | 176 |  	movw	$10f, %si
 | 
		
	
		
			
			| 177 | 177 |  	call	print_message
 | 
		
	
		
			
			| 178 |  | -	les	undi_code_segoff, %di
 | 
		
	
		
			
			|  | 178 | +	les	undi_code_segoff, %bx
 | 
		
	
		
			
			| 179 | 179 |  	call	print_segoff
 | 
		
	
		
			
			| 180 | 180 |  	.section ".prefix.data"
 | 
		
	
		
			
			| 181 | 181 |  10:	.asciz	"\n         UNDI code segment "
 | 
		
	
	
		
			
			|  | @@ -183,7 +183,7 @@ print_structure_information:
 | 
		
	
		
			
			| 183 | 183 |  	/* Print UNDI data segment */
 | 
		
	
		
			
			| 184 | 184 |  	movw	$10f, %si
 | 
		
	
		
			
			| 185 | 185 |  	call	print_message
 | 
		
	
		
			
			| 186 |  | -	les	undi_data_segoff, %di
 | 
		
	
		
			
			|  | 186 | +	les	undi_data_segoff, %bx
 | 
		
	
		
			
			| 187 | 187 |  	call	print_segoff
 | 
		
	
		
			
			| 188 | 188 |  	.section ".prefix.data"
 | 
		
	
		
			
			| 189 | 189 |  10:	.asciz	", data segment "
 | 
		
	
	
		
			
			|  | @@ -271,8 +271,8 @@ unload_base_code:
 | 
		
	
		
			
			| 271 | 271 |  	call	print_pxe_error
 | 
		
	
		
			
			| 272 | 272 |  	jmp	99f
 | 
		
	
		
			
			| 273 | 273 |  1:	/* Free base memory used by PXE base code */
 | 
		
	
		
			
			| 274 |  | -	movw	%fs:(0x13), %si
 | 
		
	
		
			
			| 275 |  | -	movw	undi_fbms_start, %di
 | 
		
	
		
			
			|  | 274 | +	movw	undi_fbms_start, %ax
 | 
		
	
		
			
			|  | 275 | +	movw	%fs:(0x13), %bx
 | 
		
	
		
			
			| 276 | 276 |  	call	free_basemem
 | 
		
	
		
			
			| 277 | 277 |  99:
 | 
		
	
		
			
			| 278 | 278 |  
 | 
		
	
	
		
			
			|  | @@ -289,8 +289,8 @@ unload_undi:
 | 
		
	
		
			
			| 289 | 289 |  	call	print_pxe_error
 | 
		
	
		
			
			| 290 | 290 |  	jmp	99f
 | 
		
	
		
			
			| 291 | 291 |  1:	/* Free base memory used by UNDI */
 | 
		
	
		
			
			| 292 |  | -	movw	undi_fbms_start, %si
 | 
		
	
		
			
			| 293 |  | -	movw	undi_fbms_end, %di
 | 
		
	
		
			
			|  | 292 | +	movw	undi_fbms_end, %ax
 | 
		
	
		
			
			|  | 293 | +	movw	undi_fbms_start, %bx
 | 
		
	
		
			
			| 294 | 294 |  	call	free_basemem
 | 
		
	
		
			
			| 295 | 295 |  	/* Clear UNDI_FL_STARTED */
 | 
		
	
		
			
			| 296 | 296 |  	andw	$~UNDI_FL_STARTED, flags
 | 
		
	
	
		
			
			|  | @@ -324,9 +324,10 @@ finished:
 | 
		
	
		
			
			| 324 | 324 |   * Subroutine: print segment:offset address
 | 
		
	
		
			
			| 325 | 325 |   *
 | 
		
	
		
			
			| 326 | 326 |   * Parameters:
 | 
		
	
		
			
			| 327 |  | - *   %es:%di : segment:offset address to print
 | 
		
	
		
			
			|  | 327 | + *   %es:%bx : segment:offset address to print
 | 
		
	
		
			
			|  | 328 | + *   %ds:di : output buffer (or %di=0 to print to console)
 | 
		
	
		
			
			| 328 | 329 |   * Returns:
 | 
		
	
		
			
			| 329 |  | - *   Nothing
 | 
		
	
		
			
			|  | 330 | + *   %ds:di : next character in output buffer (if applicable)
 | 
		
	
		
			
			| 330 | 331 |   *****************************************************************************
 | 
		
	
		
			
			| 331 | 332 |   */
 | 
		
	
		
			
			| 332 | 333 |  print_segoff:
 | 
		
	
	
		
			
			|  | @@ -337,7 +338,7 @@ print_segoff:
 | 
		
	
		
			
			| 337 | 338 |  	call	print_hex_word
 | 
		
	
		
			
			| 338 | 339 |  	movb	$':', %al
 | 
		
	
		
			
			| 339 | 340 |  	call	print_character
 | 
		
	
		
			
			| 340 |  | -	movw	%di, %ax
 | 
		
	
		
			
			|  | 341 | +	movw	%bx, %ax
 | 
		
	
		
			
			| 341 | 342 |  	call	print_hex_word
 | 
		
	
		
			
			| 342 | 343 |  	/* Restore registers and return */
 | 
		
	
		
			
			| 343 | 344 |  	popw	%ax
 | 
		
	
	
		
			
			|  | @@ -348,8 +349,9 @@ print_segoff:
 | 
		
	
		
			
			| 348 | 349 |   *
 | 
		
	
		
			
			| 349 | 350 |   * Parameters:
 | 
		
	
		
			
			| 350 | 351 |   *   %ax : word to print
 | 
		
	
		
			
			|  | 352 | + *   %ds:di : output buffer (or %di=0 to print to console)
 | 
		
	
		
			
			| 351 | 353 |   * Returns:
 | 
		
	
		
			
			| 352 |  | - *   Nothing
 | 
		
	
		
			
			|  | 354 | + *   %ds:di : next character in output buffer (if applicable)
 | 
		
	
		
			
			| 353 | 355 |   *****************************************************************************
 | 
		
	
		
			
			| 354 | 356 |   */
 | 
		
	
		
			
			| 355 | 357 |  print_word:
 | 
		
	
	
		
			
			|  | @@ -378,44 +380,11 @@ print_word:
 | 
		
	
		
			
			| 378 | 380 |  	popw	%ax
 | 
		
	
		
			
			| 379 | 381 |  	ret
 | 
		
	
		
			
			| 380 | 382 |  	
 | 
		
	
		
			
			| 381 |  | -/*****************************************************************************
 | 
		
	
		
			
			| 382 |  | - * Subroutine: print PCI bus:dev.fn
 | 
		
	
		
			
			| 383 |  | - *
 | 
		
	
		
			
			| 384 |  | - * Parameters:
 | 
		
	
		
			
			| 385 |  | - *   %ax : PCI bus:dev.fn to print
 | 
		
	
		
			
			| 386 |  | - * Returns:
 | 
		
	
		
			
			| 387 |  | - *   Nothing
 | 
		
	
		
			
			| 388 |  | - *****************************************************************************
 | 
		
	
		
			
			| 389 |  | - */
 | 
		
	
		
			
			| 390 |  | -print_pci_busdevfn:
 | 
		
	
		
			
			| 391 |  | -	/* Preserve registers */
 | 
		
	
		
			
			| 392 |  | -	pushw	%ax
 | 
		
	
		
			
			| 393 |  | -	/* Print bus */
 | 
		
	
		
			
			| 394 |  | -	xchgb	%al, %ah
 | 
		
	
		
			
			| 395 |  | -	call	print_hex_byte
 | 
		
	
		
			
			| 396 |  | -	/* Print ":" */
 | 
		
	
		
			
			| 397 |  | -	movb	$':', %al
 | 
		
	
		
			
			| 398 |  | -	call	print_character
 | 
		
	
		
			
			| 399 |  | -	/* Print device */
 | 
		
	
		
			
			| 400 |  | -	movb	%ah, %al
 | 
		
	
		
			
			| 401 |  | -	shrb	$3, %al
 | 
		
	
		
			
			| 402 |  | -	call	print_hex_byte
 | 
		
	
		
			
			| 403 |  | -	/* Print "." */
 | 
		
	
		
			
			| 404 |  | -	movb	$'.', %al
 | 
		
	
		
			
			| 405 |  | -	call	print_character
 | 
		
	
		
			
			| 406 |  | -	/* Print function */
 | 
		
	
		
			
			| 407 |  | -	movb	%ah, %al
 | 
		
	
		
			
			| 408 |  | -	andb	$0x07, %al
 | 
		
	
		
			
			| 409 |  | -	call	print_hex_nibble
 | 
		
	
		
			
			| 410 |  | -	/* Restore registers and return */
 | 
		
	
		
			
			| 411 |  | -	popw	%ax
 | 
		
	
		
			
			| 412 |  | -	ret	
 | 
		
	
		
			
			| 413 |  | -
 | 
		
	
		
			
			| 414 | 383 |  /*****************************************************************************
 | 
		
	
		
			
			| 415 | 384 |   * Subroutine: zero 1kB block of base memory
 | 
		
	
		
			
			| 416 | 385 |   *
 | 
		
	
		
			
			| 417 | 386 |   * Parameters:
 | 
		
	
		
			
			| 418 |  | - *   %si : block to zero (in kB)
 | 
		
	
		
			
			|  | 387 | + *   %bx : block to zero (in kB)
 | 
		
	
		
			
			| 419 | 388 |   * Returns:
 | 
		
	
		
			
			| 420 | 389 |   *   Nothing
 | 
		
	
		
			
			| 421 | 390 |   *****************************************************************************
 | 
		
	
	
		
			
			|  | @@ -427,7 +396,7 @@ zero_kb:
 | 
		
	
		
			
			| 427 | 396 |  	pushw	%di
 | 
		
	
		
			
			| 428 | 397 |  	pushw	%es
 | 
		
	
		
			
			| 429 | 398 |  	/* Zero block */
 | 
		
	
		
			
			| 430 |  | -	movw	%si, %ax
 | 
		
	
		
			
			|  | 399 | +	movw	%bx, %ax
 | 
		
	
		
			
			| 431 | 400 |  	shlw	$6, %ax
 | 
		
	
		
			
			| 432 | 401 |  	movw	%ax, %es
 | 
		
	
		
			
			| 433 | 402 |  	movw	$0x400, %cx
 | 
		
	
	
		
			
			|  | @@ -445,33 +414,31 @@ zero_kb:
 | 
		
	
		
			
			| 445 | 414 |   * Subroutine: free and zero base memory
 | 
		
	
		
			
			| 446 | 415 |   *
 | 
		
	
		
			
			| 447 | 416 |   * Parameters:
 | 
		
	
		
			
			| 448 |  | - *   %si : Expected current free base memory counter (in kB)
 | 
		
	
		
			
			| 449 |  | - *   %di : Desired new free base memory counter (in kB)
 | 
		
	
		
			
			|  | 417 | + *   %ax : Desired new free base memory counter (in kB)
 | 
		
	
		
			
			|  | 418 | + *   %bx : Expected current free base memory counter (in kB)
 | 
		
	
		
			
			| 450 | 419 |   *   %fs : BIOS data segment (0x40)
 | 
		
	
		
			
			| 451 | 420 |   * Returns:
 | 
		
	
		
			
			| 452 |  | - *   %ax : Actual new free base memory counter (in kB)
 | 
		
	
		
			
			|  | 421 | + *   None
 | 
		
	
		
			
			| 453 | 422 |   *
 | 
		
	
		
			
			| 454 |  | - * The base memory from %si kB to %di kB is unconditionally zeroed.
 | 
		
	
		
			
			|  | 423 | + * The base memory from %bx kB to %ax kB is unconditionally zeroed.
 | 
		
	
		
			
			| 455 | 424 |   * It will be freed if and only if the expected current free base
 | 
		
	
		
			
			| 456 |  | - * memory counter (%si) matches the actual current free base memory
 | 
		
	
		
			
			|  | 425 | + * memory counter (%bx) matches the actual current free base memory
 | 
		
	
		
			
			| 457 | 426 |   * counter in 0x40:0x13; if this does not match then the memory will
 | 
		
	
		
			
			| 458 | 427 |   * be leaked.
 | 
		
	
		
			
			| 459 | 428 |   *****************************************************************************
 | 
		
	
		
			
			| 460 | 429 |   */
 | 
		
	
		
			
			| 461 | 430 |  free_basemem:
 | 
		
	
		
			
			| 462 | 431 |  	/* Zero base memory */
 | 
		
	
		
			
			| 463 |  | -	pushw	%si
 | 
		
	
		
			
			| 464 |  | -1:	cmpw	%si, %di
 | 
		
	
		
			
			|  | 432 | +	pushw	%bx
 | 
		
	
		
			
			|  | 433 | +1:	cmpw	%bx, %ax
 | 
		
	
		
			
			| 465 | 434 |  	je	2f
 | 
		
	
		
			
			| 466 | 435 |  	call	zero_kb
 | 
		
	
		
			
			| 467 |  | -	incw	%si
 | 
		
	
		
			
			|  | 436 | +	incw	%bx
 | 
		
	
		
			
			| 468 | 437 |  	jmp	1b
 | 
		
	
		
			
			| 469 |  | -2:	popw	%si
 | 
		
	
		
			
			|  | 438 | +2:	popw	%bx
 | 
		
	
		
			
			| 470 | 439 |  	/* Free base memory */
 | 
		
	
		
			
			| 471 |  | -	movw	%fs:(0x13), %ax		/* Current FBMS to %ax */
 | 
		
	
		
			
			| 472 |  | -	cmpw	%ax, %si		/* Update FBMS only if "old" value  */
 | 
		
	
		
			
			|  | 440 | +	cmpw	%fs:(0x13), %bx		/* Update FBMS only if "old" value  */
 | 
		
	
		
			
			| 473 | 441 |  	jne	1f			/* is correct			    */
 | 
		
	
		
			
			| 474 |  | -	movw	%di, %ax
 | 
		
	
		
			
			| 475 | 442 |  1:	movw	%ax, %fs:(0x13)
 | 
		
	
		
			
			| 476 | 443 |  	ret
 | 
		
	
		
			
			| 477 | 444 |  
 |