2020-11-05 03:37:45 +03:00
|
|
|
org 0x7c00
|
|
|
|
bits 16
|
|
|
|
|
|
|
|
start:
|
2021-09-21 15:39:43 +03:00
|
|
|
cli
|
|
|
|
cld
|
2020-11-05 03:37:45 +03:00
|
|
|
jmp 0x0000:.initialise_cs
|
|
|
|
.initialise_cs:
|
|
|
|
xor ax, ax
|
|
|
|
mov ds, ax
|
|
|
|
mov es, ax
|
|
|
|
mov ss, ax
|
|
|
|
mov sp, 0x7c00
|
|
|
|
|
2021-09-21 15:39:43 +03:00
|
|
|
lgdt [gdt]
|
2020-11-05 03:37:45 +03:00
|
|
|
|
|
|
|
mov eax, cr0
|
|
|
|
bts ax, 0
|
|
|
|
mov cr0, eax
|
|
|
|
|
2020-12-06 18:43:38 +03:00
|
|
|
jmp 0x08:.mode32
|
2020-11-05 03:37:45 +03:00
|
|
|
bits 32
|
|
|
|
.mode32:
|
2021-09-21 15:39:43 +03:00
|
|
|
mov eax, 0x10
|
2020-11-05 03:37:45 +03:00
|
|
|
mov ds, ax
|
|
|
|
mov es, ax
|
|
|
|
mov fs, ax
|
|
|
|
mov gs, ax
|
|
|
|
mov ss, ax
|
|
|
|
|
|
|
|
push 0x1
|
|
|
|
and edx, 0xff
|
|
|
|
push edx
|
|
|
|
|
|
|
|
push stage2.size
|
|
|
|
push (stage2 - decompressor) + 0x70000
|
|
|
|
|
|
|
|
mov esi, decompressor
|
|
|
|
mov edi, 0x70000
|
|
|
|
mov ecx, stage2.fullsize
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
call 0x70000
|
|
|
|
|
|
|
|
; Includes
|
|
|
|
|
2021-02-25 03:24:54 +03:00
|
|
|
%include '../gdt.asm'
|
2020-11-05 03:37:45 +03:00
|
|
|
|
|
|
|
; ********************* Stage 2 *********************
|
|
|
|
|
|
|
|
decompressor:
|
2022-01-16 08:09:36 +03:00
|
|
|
%strcat DECOMPRESSOR_PATH BUILDDIR, '/decompressor-build/decompressor.bin'
|
2021-11-20 10:32:06 +03:00
|
|
|
incbin DECOMPRESSOR_PATH
|
2020-11-05 03:37:45 +03:00
|
|
|
|
|
|
|
align 16
|
|
|
|
stage2:
|
2022-02-03 12:38:43 +03:00
|
|
|
%strcat STAGE2_PATH BUILDDIR, '/common-bios/stage2.bin.gz'
|
2021-11-20 10:32:06 +03:00
|
|
|
incbin STAGE2_PATH
|
2020-11-05 03:37:45 +03:00
|
|
|
.size: equ $ - stage2
|
|
|
|
.fullsize: equ $ - decompressor
|