| 1 | org 0x7c00 |
| 2 | bits 16 |
| 3 | |
| 4 | start: |
| 5 | cli |
| 6 | cld |
| 7 | jmp 0x0000:.initialise_cs |
| 8 | .initialise_cs: |
| 9 | xor ax, ax |
| 10 | mov ds, ax |
| 11 | mov es, ax |
| 12 | mov ss, ax |
| 13 | mov sp, 0x7c00 |
| 14 | |
| 15 | lgdt [gdt] |
| 16 | |
| 17 | mov eax, cr0 |
| 18 | bts ax, 0 |
| 19 | mov cr0, eax |
| 20 | |
| 21 | jmp 0x08:.mode32 |
| 22 | bits 32 |
| 23 | .mode32: |
| 24 | mov eax, 0x10 |
| 25 | mov ds, ax |
| 26 | mov es, ax |
| 27 | mov fs, ax |
| 28 | mov gs, ax |
| 29 | mov ss, ax |
| 30 | |
| 31 | push 0x1 |
| 32 | and edx, 0xff |
| 33 | push edx |
| 34 | |
| 35 | push stage2.size |
| 36 | push (stage2 - decompressor) + 0x70000 |
| 37 | |
| 38 | mov esi, decompressor |
| 39 | mov edi, 0x70000 |
| 40 | mov ecx, stage2.fullsize |
| 41 | rep movsb |
| 42 | |
| 43 | call 0x70000 |
| 44 | |
| 45 | ; Includes |
| 46 | |
| 47 | %include '../gdt.asm' |
| 48 | |
| 49 | ; ********************* Stage 2 ********************* |
| 50 | |
| 51 | decompressor: |
| 52 | %strcat DECOMPRESSOR_PATH BUILDDIR, '/decompressor-build/decompressor.bin' |
| 53 | incbin DECOMPRESSOR_PATH |
| 54 | |
| 55 | align 16 |
| 56 | stage2: |
| 57 | %strcat STAGE2_PATH BUILDDIR, '/common-bios/stage2.bin.limlz' |
| 58 | incbin STAGE2_PATH |
| 59 | .size: equ $ - stage2 |
| 60 | .fullsize: equ $ - decompressor |