aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/dev/v86asm.s
blob: da5bc38377a5e63a6e8d643fc1daf2c24a4b419e (plain) (blame)
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
36
37
38
39
[BITS 32]

[GLOBAL v86_asm_enter_v86]
v86_asm_enter_v86:
	mov eax, [esp + 4]

	xor ebx, ebx
	mov bx, [eax + 20]		; get GS
	push ebx
	mov bx, [eax + 18]		; get FS
	push ebx
	mov bx, [eax + 14]		; get DS
	push ebx
	mov bx, [eax + 16]		; get ES
	push ebx
	mov bx, [eax + 22]		; get SS
	push ebx
	mov bx, [eax + 26]		; get SP
	push ebx
	pushf
	pop ebx
	or ebx, 20200h
	push ebx
	xor ebx, ebx
	mov bx, [eax + 12]		; get CS
	push ebx
	mov bx, [eax + 24]		; get IP
	push ebx

	mov bx, [eax + 2]
	mov cx, [eax + 4]
	mov dx, [eax + 6]
	mov di, [eax + 8]
	mov si, [eax + 10]
	mov ax, [eax]

	iret