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
|
/*
* Copyright (c) 2026, Apollo Telephone Laboratories.
* Provided under the BSD-3 clause.
*/
.text
.code16
.globl _start
_start:
cli
xor %ax, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %ss
lgdt gdtr
mov %cr0, %eax
or $1, %eax
mov %eax, %cr0
ljmp $0x08,$1f
.code32
1: mov $0x10, %ax
mov %ax, %es
mov %ax, %ss
mov %ax, %fs
mov %ax, %gs
mov %ax, %ds
jmp c_thunk
gdt:
.null:
.quad 0
.code:
.word 0xFFFF
.word 0x0000
.byte 0x00
.byte 0b10011010
.byte 0b11001111
.byte 0x00
.data:
.word 0xFFFF
.word 0x0000
.byte 0x00
.byte 0b10010010
.byte 0b11001111
.byte 0x00
gdtr:
.word . - gdt - 1
.long gdt
/* Fall-through : everything above this */
c_thunk:
nop
|