Commit 0d43780f authored by Mathieu Maret's avatar Mathieu Maret

Add more comment in mbr

parent 35c0fb8f
......@@ -94,26 +94,26 @@ main:
mov bx, copy_target;target pointer
int 0x13
cli ; clear interruption flag
cli ; disable interruption when setting GDT
; switch in 32 bits
lgdt [gdt_pointer] ; switch in 32bits here
mov eax, cr0
or eax,0x1; set the protected mode bit on special CPU reg cr0
mov cr0, eax
jmp CODE_SEG:boot2
jmp CODE_SEG:boot2 ; In protected mode we need to add the segment selector
; GDT table desciption could be found
; here we define the 3 64bits segment needed: null segment, code segment and data segment
gdt_start: ;null segment
dq 0x0
gdt_code: ;code segment
dw 0xFFFF
dw 0x0
db 0x0
db 10011010b
db 11001111b
db 0x0
dw 0xFFFF ; limit [0:15]
dw 0x0 ; base [0:15]
db 0x0 ; base [16:23]
db 10011010b ; access byte: Present(1)| Priv(2) 0 ->kernel 3->userspace | 1 | Executable(1) | Direction/Conformity (1) | RW(1) | Accessed(1)
db 11001111b ; Granularity(1) | Size (1) 0-> 16bit mode 1->32protected mode | 0 | 0 | Limit [16:19]
db 0x0 ; base [24:31]
dw 0xFFFF
dw 0x0
......@@ -135,12 +135,12 @@ dw 0xaa55
bits 32
mov ax, DATA_SEG
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov ax, DATA_SEG ; set all segments to point to DATA_SEG
mov ds, ax ; Data segment
mov es, ax ; Extra Segment (for string operation)
mov fs, ax ; No Specific use
mov gs, ax ; No Specific use
mov ss, ax ; stack segment
mov esi,hello32
mov ebx,0xb8000 ; Cannot use BIOS anymore, use VGA Text buffer instead
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment