|  | @@ -165,14 +165,23 @@ test_a20_long:
 | 
		
	
		
			
			| 165 | 165 |  	pushl	%ecx
 | 
		
	
		
			
			| 166 | 166 |  	movl	$TEST_A20_LONG_MAX_RETRIES, %ecx
 | 
		
	
		
			
			| 167 | 167 |  1:	pushw	%ax
 | 
		
	
		
			
			|  | 168 | +	pushw	%ds
 | 
		
	
		
			
			|  | 169 | +	pushw	%es
 | 
		
	
		
			
			| 168 | 170 |  
 | 
		
	
		
			
			| 169 |  | -	/* Flatten real mode so we can access the test pattern's 1MB offset */
 | 
		
	
		
			
			| 170 |  | -	call	flatten_real_mode
 | 
		
	
		
			
			|  | 171 | +	/* Set up segment registers for access across the 1MB boundary */
 | 
		
	
		
			
			|  | 172 | +	xorw	%ax, %ax
 | 
		
	
		
			
			|  | 173 | +	movw	%ax, %ds
 | 
		
	
		
			
			|  | 174 | +	decw	%ax
 | 
		
	
		
			
			|  | 175 | +	movw	%ax, %es
 | 
		
	
		
			
			| 171 | 176 |  
 | 
		
	
		
			
			| 172 | 177 |  2:	/* Modify and check test pattern; succeed if we see a difference */
 | 
		
	
		
			
			| 173 |  | -	incw	%cs:test_a20_data
 | 
		
	
		
			
			| 174 |  | -	addr32 movw %cs:(test_a20_data + 0x100000 ), %ax
 | 
		
	
		
			
			| 175 |  | -	cmpw	%cs:test_a20_data, %ax
 | 
		
	
		
			
			|  | 178 | +	pushfw
 | 
		
	
		
			
			|  | 179 | +	cli
 | 
		
	
		
			
			|  | 180 | +	xchgw	%ds:0, %cx
 | 
		
	
		
			
			|  | 181 | +	movw	%es:0x10, %ax
 | 
		
	
		
			
			|  | 182 | +	xchgw	%ds:0, %cx
 | 
		
	
		
			
			|  | 183 | +	popfw
 | 
		
	
		
			
			|  | 184 | +	cmpw	%ax, %cx
 | 
		
	
		
			
			| 176 | 185 |  	clc
 | 
		
	
		
			
			| 177 | 186 |  	jnz	99f
 | 
		
	
		
			
			| 178 | 187 |  
 | 
		
	
	
		
			
			|  | @@ -182,17 +191,13 @@ test_a20_long:
 | 
		
	
		
			
			| 182 | 191 |  	stc
 | 
		
	
		
			
			| 183 | 192 |  
 | 
		
	
		
			
			| 184 | 193 |  99:	/* Restore registers and return */
 | 
		
	
		
			
			|  | 194 | +	popw	%es
 | 
		
	
		
			
			|  | 195 | +	popw	%ds
 | 
		
	
		
			
			| 185 | 196 |  	popw	%ax
 | 
		
	
		
			
			| 186 | 197 |  	popl	%ecx
 | 
		
	
		
			
			| 187 | 198 |  	ret
 | 
		
	
		
			
			| 188 | 199 |  	.size	test_a20_long, . - test_a20_long
 | 
		
	
		
			
			| 189 | 200 |  
 | 
		
	
		
			
			| 190 |  | -	.section ".text16.early.data", "aw", @progbits
 | 
		
	
		
			
			| 191 |  | -	.align	2
 | 
		
	
		
			
			| 192 |  | -test_a20_data:
 | 
		
	
		
			
			| 193 |  | -	.word	0xdead
 | 
		
	
		
			
			| 194 |  | -	.size	test_a20_data, . - test_a20_data
 | 
		
	
		
			
			| 195 |  | -
 | 
		
	
		
			
			| 196 | 201 |  /****************************************************************************
 | 
		
	
		
			
			| 197 | 202 |   * enable_a20_bios
 | 
		
	
		
			
			| 198 | 203 |   *
 | 
		
	
	
		
			
			|  | @@ -414,6 +419,7 @@ enable_a20_method:
 | 
		
	
		
			
			| 414 | 419 |  access_highmem:
 | 
		
	
		
			
			| 415 | 420 |  	/* Enable A20 line */
 | 
		
	
		
			
			| 416 | 421 |  	call	enable_a20
 | 
		
	
		
			
			| 417 |  | -	/* CPU will be in flat real mode as a result of this call */
 | 
		
	
		
			
			|  | 422 | +	/* Set up 4GB limits */
 | 
		
	
		
			
			|  | 423 | +	call	flatten_real_mode
 | 
		
	
		
			
			| 418 | 424 |  	lret
 | 
		
	
		
			
			| 419 | 425 |  	.size	access_highmem, . - access_highmem
 |