You are browsing as a guest. Sign up (or log in) to start making projects!

56m 51s logged

Stage 1 Bootloader

I just realized that I have lost in my own project😅. I didn’t know what I was doing or whether it was right.

Today, I finally kinda make a Stage 1 bootloader

0
63

Comments 4

@scrt401

I looked back at my code for transition from the real to protected mode if you still need some guidance.
Basically how it works is by making a gdt table which is made of more tables for both modes (this stuff is for the bios because bios is stupid) then n the code place (where your code wants to switch between the modes) you disable interrupts load the adress of the gdt table then load the number from the turbo special register cr0 to each or whichever register for is more sympatic which holds some important stuff for the cpu but you are interested in the lowest bite which you want to set to 1 then move the modified number back to cr0. An the last thing is to perform a long Jump .
Spoiler alert bellow is my code if you want to study it yourself.
cli
lgdt [gdtp]
mov eax, cr0
or eax, 1
mov cr0, eax
jmp CIDE_SEG:fnl32b
align 4
gdts:
dd 0, 0
gdtc:
dw 0xFFFF
dw 0x0000
db 0x00
db 0x9A
db 0xCF
db 0x00
gdtd:
dw 0xFFFF
dw 0x0000
db 0x00
db 0x92
db 0xCF
db 0x00
gdt67:
dw 0x0000
dw 0x0000
db 0x00
db 0x9A
db 0x20
db 0x00
gdte:
gdtp:
dw gdte - gdts -1
dd gdts
CIDE_SEG equ gdtc -gdts
DATA_SEG equ gdtd - gdts
fnl32b:
[bits 32]
mov ax, DATA_SEG

@scrt401

Hope it helps you

@Ravduct

@scrt401 Sorry for not responding to your comment. I just basically want to work on my project alone for education purpose. Even if you help me with coding, I still want to understand how your code works.

@scrt401

W mindset