I read about how to switch from default real mode to protected mode and I wonder where the switch in my code happens. Theres one part that I copied and dont fully understand, which is this:
global loader
global stack_ptr
extern main
MODULEALIGN equ 1<<0
MEMINFO equ 1<<1
FLAGS equ MODULEALIGN | MEMINFO
MAGIC equ 0x1BADB002
CHECKSUM equ -(MAGIC + FLAGS)
section .mbheader
align 4
MultiBootHeader:
dd MAGIC
dd FLAGS
dd CHECKSUM
section .text
STACKSIZE equ 0x4000
loader:
mov esp, stack+STACKSIZE
push eax
push ebx
call main
cli ;clear interrupt flag
hang:
hlt
jmp hang
section .bss
align 4
stack:
resb STACKSIZE
stack_ptr:
Since I can use the 32bit registers normally and using interupts fails I guess I am in protected mode, but I dont understand where the switch happened. And I read when using protected mode you have to set up memory paging, however is this just recommended or mandatory?