bits 16 org 0x7c3e kernel_sectors equ 64 kernel_segment equ 0x3000 support_flags equ 0x4000 pci_hw_char equ 0x4001 pci_ver equ 0x4002 last_pci_bus equ 0x4004 pci_support equ 0x80 in al, 0x92 or al, 0x02 out 0x92, al xor ax, ax mov ss, ax mov sp, 0x7ffc mov ah, 0x01 mov ch, 0x3f int 0x10 mov ax, kernel_segment mov es, ax mov ax, 0x0200 + kernel_sectors xor bx, bx mov cx, 0x0002 xor dh, dh int 0x13 mov ax, 0xb101 int 0x1a cmp edx, 0x20494350 jne no_pci test ah, ah jnz no_pci mov byte [support_flags], pci_support mov byte [pci_hw_char], al mov word [pci_ver], bx mov byte [last_pci_bus], cl no_pci: cli lgdt [gdt] mov eax, cr0 or al, 0x01 mov cr0, eax jmp 0x08:pmode bits 32 pmode: mov ax, 0x10 mov ds, ax mov ss, ax mov esp, 0x00040000 xor ebp, ebp call kernel_segment * 16 halt: hlt jmp halt times $$ + 0x018a - $ db 0 ;0x7dc8 gdt: dw .e - .t dd .t .t: dq 0x0000_0000_0000_0000 dq 0x00c0_9a00_0000_0037 dq 0x00c1_9200_0000_ffff dq 0x0000_0000_0000_0000;TODO: task dq 0x0000_0000_0000_0000 dq 0x0000_0000_0000_0000 .e: dw 0xaa55