summaryrefslogtreecommitdiff
path: root/i386/pc/i16/i16_raw_test_a20.S
blob: a934e12f0a101a1cbacb66174ef2de88c7e8b1ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

#include <mach/machine/asm.h>

	.text
	.code16

/*
 * Test the A20 address line; return true if it is enabled.
 */
ENTRY(i16_raw_test_a20)
	xorw	%ax,%ax
	movw	%ax,%fs
	notw	%ax
	movw	%ax,%gs

	/* See if the values in already in the corresponding locations
	   are the same.  */
	movw	%fs:0,%ax
	cmpw	%gs:16,%ax
	jnz	1f

	/* Yes; try changing one and see if they're still the same.  */
	movw	%ax,%dx
	notw	%ax
	movw	%ax,%fs:0
	cmpw	%gs:16,%ax
	movw	%dx,%fs:0
	jnz	1f

	xorl	%eax,%eax
	ret
1:
	movl	$1,%eax
	ret