-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbios.S
More file actions
81 lines (56 loc) · 692 Bytes
/
Copy pathbios.S
File metadata and controls
81 lines (56 loc) · 692 Bytes
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
.global idtr
/*
* eax, ebx, ecx, edx = int args
* ebp = int number (dropped)
*/
.global bios_int
bios_int:
xchg %ebp, %ebx
mov %bl, interrupt_nr
push %ebp
mov $0x20, %bl
call bl_to_segm
ljmp $0x18, $1f
1:
.code16
sti
mov %cr0, %ebx
dec %ebx
mov %ebx, %cr0
ljmp $0x0, $1f
1:
xor %bx, %bx
call bl_to_segm
pop %ebx
// self modifying int
.byte 0xcd
interrupt_nr:
.byte 0x0
call go_pm
.code32
cli
mov $0x10, %bl
.global bl_to_segm
bl_to_segm:
push %bx
xor %bh, %bh
mov %bx, %ds
mov %bx, %es
mov %bx, %fs
mov %bx, %gs
mov %bx, %ss
pop %bx
ret
.code16
.global go_pm
/* Drop bp */
go_pm:
lgdt gdtr
smsw %bp
or $1, %bp
lmsw %bp
.code32
popl %ebp
pushl $0x8
pushl %ebp
lret