|  | @@ -37,7 +37,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
 | 
		
	
		
			
			| 37 | 37 |   * "non absolute segment" error.  This is most probably a bug in gas.
 | 
		
	
		
			
			| 38 | 38 |   ****************************************************************************
 | 
		
	
		
			
			| 39 | 39 |   */
 | 
		
	
		
			
			| 40 |  | -	.section ".data16", "aw", @progbits
 | 
		
	
		
			
			|  | 40 | +	.section ".data16.gdt", "aw", @progbits
 | 
		
	
		
			
			| 41 | 41 |  	.align 16
 | 
		
	
		
			
			| 42 | 42 |  gdt:
 | 
		
	
		
			
			| 43 | 43 |  gdtr:		/* The first GDT entry is unused, the GDTR can fit here. */
 | 
		
	
	
		
			
			|  | @@ -89,7 +89,7 @@ gdt_end:
 | 
		
	
		
			
			| 89 | 89 |   *   %edi : Physical base of protected-mode code (virt_offset)
 | 
		
	
		
			
			| 90 | 90 |   ****************************************************************************
 | 
		
	
		
			
			| 91 | 91 |   */
 | 
		
	
		
			
			| 92 |  | -	.section ".text16", "ax", @progbits
 | 
		
	
		
			
			|  | 92 | +	.section ".text16.init_librm", "ax", @progbits
 | 
		
	
		
			
			| 93 | 93 |  	.code16
 | 
		
	
		
			
			| 94 | 94 |  	.globl init_librm
 | 
		
	
		
			
			| 95 | 95 |  init_librm:
 | 
		
	
	
		
			
			|  | @@ -141,7 +141,7 @@ init_librm:
 | 
		
	
		
			
			| 141 | 141 |  	popl	%eax
 | 
		
	
		
			
			| 142 | 142 |  	lret
 | 
		
	
		
			
			| 143 | 143 |  
 | 
		
	
		
			
			| 144 |  | -	.section ".text16", "ax", @progbits
 | 
		
	
		
			
			|  | 144 | +	.section ".text16.set_seg_base", "ax", @progbits
 | 
		
	
		
			
			| 145 | 145 |  	.code16
 | 
		
	
		
			
			| 146 | 146 |  set_seg_base:
 | 
		
	
		
			
			| 147 | 147 |  1:	movw	%ax, 2(%bx)
 | 
		
	
	
		
			
			|  | @@ -167,7 +167,7 @@ set_seg_base:
 | 
		
	
		
			
			| 167 | 167 |   *
 | 
		
	
		
			
			| 168 | 168 |   ****************************************************************************
 | 
		
	
		
			
			| 169 | 169 |   */
 | 
		
	
		
			
			| 170 |  | -	.section ".text16", "ax", @progbits
 | 
		
	
		
			
			|  | 170 | +	.section ".text16.real_to_prot", "ax", @progbits
 | 
		
	
		
			
			| 171 | 171 |  	.code16
 | 
		
	
		
			
			| 172 | 172 |  real_to_prot:
 | 
		
	
		
			
			| 173 | 173 |  	/* Enable A20 line */
 | 
		
	
	
		
			
			|  | @@ -219,7 +219,7 @@ real_to_prot:
 | 
		
	
		
			
			| 219 | 219 |  	orb	$CR0_PE, %al
 | 
		
	
		
			
			| 220 | 220 |  	movl	%eax, %cr0
 | 
		
	
		
			
			| 221 | 221 |  	data32 ljmp	$VIRTUAL_CS, $r2p_pmode
 | 
		
	
		
			
			| 222 |  | -	.section ".text", "ax", @progbits
 | 
		
	
		
			
			|  | 222 | +	.section ".text.real_to_prot", "ax", @progbits
 | 
		
	
		
			
			| 223 | 223 |  	.code32
 | 
		
	
		
			
			| 224 | 224 |  r2p_pmode:
 | 
		
	
		
			
			| 225 | 225 |  	/* Set up protected-mode data segments and stack pointer */
 | 
		
	
	
		
			
			|  | @@ -272,7 +272,7 @@ r2p_pmode:
 | 
		
	
		
			
			| 272 | 272 |   *
 | 
		
	
		
			
			| 273 | 273 |   ****************************************************************************
 | 
		
	
		
			
			| 274 | 274 |   */
 | 
		
	
		
			
			| 275 |  | -	.section ".text", "ax", @progbits
 | 
		
	
		
			
			|  | 275 | +	.section ".text.prot_to_real", "ax", @progbits
 | 
		
	
		
			
			| 276 | 276 |  	.code32
 | 
		
	
		
			
			| 277 | 277 |  prot_to_real:
 | 
		
	
		
			
			| 278 | 278 |  	/* Copy real-mode global descriptor table register to RM code segment */
 | 
		
	
	
		
			
			|  | @@ -311,7 +311,7 @@ prot_to_real:
 | 
		
	
		
			
			| 311 | 311 |  	movw	%ax, %gs
 | 
		
	
		
			
			| 312 | 312 |  	movw	%ax, %ss
 | 
		
	
		
			
			| 313 | 313 |  	ljmp	$REAL_CS, $p2r_rmode
 | 
		
	
		
			
			| 314 |  | -	.section ".text16", "ax", @progbits
 | 
		
	
		
			
			|  | 314 | +	.section ".text16.prot_to_real", "ax", @progbits
 | 
		
	
		
			
			| 315 | 315 |  	.code16
 | 
		
	
		
			
			| 316 | 316 |  p2r_rmode:
 | 
		
	
		
			
			| 317 | 317 |  	/* Load real-mode GDT */
 | 
		
	
	
		
			
			|  | @@ -347,12 +347,12 @@ p2r_ljmp_rm_cs:
 | 
		
	
		
			
			| 347 | 347 |  	.globl rm_cs
 | 
		
	
		
			
			| 348 | 348 |  	.equ	rm_cs, ( p2r_ljmp_rm_cs + 3 )
 | 
		
	
		
			
			| 349 | 349 |  
 | 
		
	
		
			
			| 350 |  | -	.section ".text16.data", "aw", @progbits
 | 
		
	
		
			
			|  | 350 | +	.section ".text16.data.rm_ds", "aw", @progbits
 | 
		
	
		
			
			| 351 | 351 |  	.globl rm_ds
 | 
		
	
		
			
			| 352 | 352 |  rm_ds:	.word 0
 | 
		
	
		
			
			| 353 | 353 |  
 | 
		
	
		
			
			| 354 | 354 |  	/* Real-mode global and interrupt descriptor table registers */
 | 
		
	
		
			
			| 355 |  | -	.section ".text16.data", "aw", @progbits
 | 
		
	
		
			
			|  | 355 | +	.section ".text16.data.rm_gdtr", "aw", @progbits
 | 
		
	
		
			
			| 356 | 356 |  rm_gdtr:
 | 
		
	
		
			
			| 357 | 357 |  	.word 0 /* Limit */
 | 
		
	
		
			
			| 358 | 358 |  	.long 0 /* Base */
 | 
		
	
	
		
			
			|  | @@ -398,7 +398,7 @@ rm_gdtr:
 | 
		
	
		
			
			| 398 | 398 |  #define PC_OFFSET_FUNCTION ( PC_OFFSET_RETADDR + 4 )
 | 
		
	
		
			
			| 399 | 399 |  #define PC_OFFSET_END ( PC_OFFSET_FUNCTION + 4 )
 | 
		
	
		
			
			| 400 | 400 |  
 | 
		
	
		
			
			| 401 |  | -	.section ".text16", "ax", @progbits
 | 
		
	
		
			
			|  | 401 | +	.section ".text16.prot_call", "ax", @progbits
 | 
		
	
		
			
			| 402 | 402 |  	.code16
 | 
		
	
		
			
			| 403 | 403 |  	.globl prot_call
 | 
		
	
		
			
			| 404 | 404 |  prot_call:
 | 
		
	
	
		
			
			|  | @@ -423,7 +423,7 @@ prot_call:
 | 
		
	
		
			
			| 423 | 423 |  	movl	$PC_OFFSET_END, %ecx
 | 
		
	
		
			
			| 424 | 424 |  	pushl	$pc_pmode
 | 
		
	
		
			
			| 425 | 425 |  	jmp	real_to_prot
 | 
		
	
		
			
			| 426 |  | -	.section ".text", "ax", @progbits
 | 
		
	
		
			
			|  | 426 | +	.section ".text.prot_call", "ax", @progbits
 | 
		
	
		
			
			| 427 | 427 |  	.code32
 | 
		
	
		
			
			| 428 | 428 |  pc_pmode:
 | 
		
	
		
			
			| 429 | 429 |  	/* Call function */
 | 
		
	
	
		
			
			|  | @@ -437,7 +437,7 @@ pc_pmode:
 | 
		
	
		
			
			| 437 | 437 |  	movl	%esp, %esi
 | 
		
	
		
			
			| 438 | 438 |  	pushl	$pc_rmode
 | 
		
	
		
			
			| 439 | 439 |  	jmp	prot_to_real
 | 
		
	
		
			
			| 440 |  | -	.section ".text16", "ax", @progbits
 | 
		
	
		
			
			|  | 440 | +	.section ".text16.prot_call", "ax", @progbits
 | 
		
	
		
			
			| 441 | 441 |  	.code16
 | 
		
	
		
			
			| 442 | 442 |  pc_rmode:
 | 
		
	
		
			
			| 443 | 443 |  	/* Restore registers and flags and return */
 | 
		
	
	
		
			
			|  | @@ -484,7 +484,7 @@ pc_rmode:
 | 
		
	
		
			
			| 484 | 484 |  #define RC_OFFSET_FUNCTION ( RC_OFFSET_RETADDR + 4 )
 | 
		
	
		
			
			| 485 | 485 |  #define RC_OFFSET_END ( RC_OFFSET_FUNCTION + 4 )
 | 
		
	
		
			
			| 486 | 486 |  
 | 
		
	
		
			
			| 487 |  | -	.section ".text", "ax", @progbits
 | 
		
	
		
			
			|  | 487 | +	.section ".text.real_call", "ax", @progbits
 | 
		
	
		
			
			| 488 | 488 |  	.code32
 | 
		
	
		
			
			| 489 | 489 |  	.globl real_call
 | 
		
	
		
			
			| 490 | 490 |  real_call:
 | 
		
	
	
		
			
			|  | @@ -497,7 +497,7 @@ real_call:
 | 
		
	
		
			
			| 497 | 497 |  	pushl	$rc_rmode
 | 
		
	
		
			
			| 498 | 498 |  	movl	$rm_default_gdtr_idtr, %esi
 | 
		
	
		
			
			| 499 | 499 |  	jmp	prot_to_real
 | 
		
	
		
			
			| 500 |  | -	.section ".text16", "ax", @progbits
 | 
		
	
		
			
			|  | 500 | +	.section ".text16.real_call", "ax", @progbits
 | 
		
	
		
			
			| 501 | 501 |  	.code16
 | 
		
	
		
			
			| 502 | 502 |  rc_rmode:
 | 
		
	
		
			
			| 503 | 503 |  	/* Call real-mode function */
 | 
		
	
	
		
			
			|  | @@ -513,7 +513,7 @@ rc_rmode:
 | 
		
	
		
			
			| 513 | 513 |  	movl	$RC_OFFSET_RETADDR, %ecx
 | 
		
	
		
			
			| 514 | 514 |  	pushl	$rc_pmode
 | 
		
	
		
			
			| 515 | 515 |  	jmp	real_to_prot
 | 
		
	
		
			
			| 516 |  | -	.section ".text", "ax", @progbits
 | 
		
	
		
			
			|  | 516 | +	.section ".text.real_call", "ax", @progbits
 | 
		
	
		
			
			| 517 | 517 |  	.code32
 | 
		
	
		
			
			| 518 | 518 |  rc_pmode:
 | 
		
	
		
			
			| 519 | 519 |  	/* Restore registers and return */
 | 
		
	
	
		
			
			|  | @@ -524,11 +524,11 @@ rc_pmode:
 | 
		
	
		
			
			| 524 | 524 |  	/* Function vector, used because "call xx(%sp)" is not a valid
 | 
		
	
		
			
			| 525 | 525 |  	 * 16-bit expression.
 | 
		
	
		
			
			| 526 | 526 |  	 */
 | 
		
	
		
			
			| 527 |  | -	.section ".data16", "aw", @progbits
 | 
		
	
		
			
			|  | 527 | +	.section ".bss16.rc_function", "aw", @nobits
 | 
		
	
		
			
			| 528 | 528 |  rc_function:	.word 0, 0
 | 
		
	
		
			
			| 529 | 529 |  
 | 
		
	
		
			
			| 530 | 530 |  	/* Default real-mode global and interrupt descriptor table registers */
 | 
		
	
		
			
			| 531 |  | -	.section ".data", "aw", @progbits
 | 
		
	
		
			
			|  | 531 | +	.section ".data.rm_default_gdtr_idtr", "aw", @progbits
 | 
		
	
		
			
			| 532 | 532 |  rm_default_gdtr_idtr:
 | 
		
	
		
			
			| 533 | 533 |  	.word 0		/* Global descriptor table limit */
 | 
		
	
		
			
			| 534 | 534 |  	.long 0		/* Global descriptor table base */
 | 
		
	
	
		
			
			|  | @@ -542,7 +542,7 @@ rm_default_gdtr_idtr:
 | 
		
	
		
			
			| 542 | 542 |   *
 | 
		
	
		
			
			| 543 | 543 |   ****************************************************************************
 | 
		
	
		
			
			| 544 | 544 |   */
 | 
		
	
		
			
			| 545 |  | -	.section ".text16", "ax", @progbits
 | 
		
	
		
			
			|  | 545 | +	.section ".text16.flatten_real_mode", "ax", @progbits
 | 
		
	
		
			
			| 546 | 546 |  	.code16
 | 
		
	
		
			
			| 547 | 547 |  	.globl flatten_real_mode
 | 
		
	
		
			
			| 548 | 548 |  flatten_real_mode:
 | 
		
	
	
		
			
			|  | @@ -559,7 +559,7 @@ flatten_real_mode:
 | 
		
	
		
			
			| 559 | 559 |  	/* Return */
 | 
		
	
		
			
			| 560 | 560 |  	ret
 | 
		
	
		
			
			| 561 | 561 |  
 | 
		
	
		
			
			| 562 |  | -	.section ".text", "ax", @progbits
 | 
		
	
		
			
			|  | 562 | +	.section ".text.flatten_dummy", "ax", @progbits
 | 
		
	
		
			
			| 563 | 563 |  	.code32
 | 
		
	
		
			
			| 564 | 564 |  flatten_dummy:
 | 
		
	
		
			
			| 565 | 565 |  	ret
 | 
		
	
	
		
			
			|  | @@ -638,11 +638,15 @@ interrupt_wrapper:
 | 
		
	
		
			
			| 638 | 638 |   * to us.
 | 
		
	
		
			
			| 639 | 639 |   ****************************************************************************
 | 
		
	
		
			
			| 640 | 640 |   */
 | 
		
	
		
			
			| 641 |  | -	.section ".data", "aw", @progbits
 | 
		
	
		
			
			|  | 641 | +	.section ".bss.rm_sp", "aw", @nobits
 | 
		
	
		
			
			| 642 | 642 |  	.globl rm_sp
 | 
		
	
		
			
			| 643 | 643 |  rm_sp:	.word 0
 | 
		
	
		
			
			|  | 644 | +
 | 
		
	
		
			
			|  | 645 | +	.section ".bss.rm_ss", "aw", @nobits
 | 
		
	
		
			
			| 644 | 646 |  	.globl rm_ss
 | 
		
	
		
			
			| 645 | 647 |  rm_ss:	.word 0
 | 
		
	
		
			
			|  | 648 | +
 | 
		
	
		
			
			|  | 649 | +	.section ".data.pm_esp", "aw", @progbits
 | 
		
	
		
			
			| 646 | 650 |  pm_esp:	.long _estack
 | 
		
	
		
			
			| 647 | 651 |  
 | 
		
	
		
			
			| 648 | 652 |  /****************************************************************************
 | 
		
	
	
		
			
			|  | @@ -654,13 +658,13 @@ pm_esp:	.long _estack
 | 
		
	
		
			
			| 654 | 658 |   ****************************************************************************
 | 
		
	
		
			
			| 655 | 659 |   */
 | 
		
	
		
			
			| 656 | 660 |  	/* Internal copies, created by init_librm (which runs in real mode) */
 | 
		
	
		
			
			| 657 |  | -	.section ".data16", "aw", @progbits
 | 
		
	
		
			
			|  | 661 | +	.section ".bss16.rm_virt_offset", "aw", @nobits
 | 
		
	
		
			
			| 658 | 662 |  rm_virt_offset:	.long 0
 | 
		
	
		
			
			| 659 | 663 |  rm_text16:	.long 0
 | 
		
	
		
			
			| 660 | 664 |  rm_data16:	.long 0
 | 
		
	
		
			
			| 661 | 665 |  
 | 
		
	
		
			
			| 662 | 666 |  	/* Externally-visible copies, created by real_to_prot */
 | 
		
	
		
			
			| 663 |  | -	.section ".data", "aw", @progbits
 | 
		
	
		
			
			|  | 667 | +	.section ".bss.virt_offset", "aw", @nobits
 | 
		
	
		
			
			| 664 | 668 |  	.globl virt_offset
 | 
		
	
		
			
			| 665 | 669 |  virt_offset:	.long 0	
 | 
		
	
		
			
			| 666 | 670 |  	.globl text16
 |