summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlastman2013-11-12 19:38:41 +0100
committerlastman2013-11-12 19:38:41 +0100
commit59f1f90c1acb985e8502342dd4edd363842df95d (patch)
tree7b399b0fbadaacc4369c2ef4b693cbf71c064c5b
parent46bd7b3419377566e66dbc3447293c2a57b7f22e (diff)
downloadlastos-gdt.tar.gz
lastos-gdt.zip
GDT Tables validated.gdt
-rw-r--r--boot.asm26
1 files changed, 17 insertions, 9 deletions
diff --git a/boot.asm b/boot.asm
index b31cd04..8564b31 100644
--- a/boot.asm
+++ b/boot.asm
@@ -107,15 +107,24 @@ pic_legacy:
;=== SET UP OUR GDT
lgdt [gdtr] ;Load our preliminary GDT.
+ jmp 08h:reload_segments ;Load our new code-segment.
+reload_segments:
+ mov ax,10h ;Load our new data-segment.
+ mov ds,ax
+ mov es,ax
+ mov fs,ax
+ mov gs,ax
+ mov ss,ax
+
;=== SET UP OUR IDT move to own file?
lidt [idtr]
;=== START CALLING KMAIN
mov esp, stack_top ;set our stack pointer.
- sti ;enable interrupts
+ ;sti ;enable interrupts
extern kmain ;declare kmain() as a callable symbol defined elsewhere
call kmain ;enter our kernel in C
- ;int 32h
+ ;int 32h
hang: ;loop and wait for interrupts after executing kmain.
; hlt
jmp hang
@@ -158,7 +167,7 @@ int32:
push ebx
push eax
xor ebx,ebx
- mov bx,0b800h
+ mov ebx,000b8000h
mov ax,0fdbh
mov word [ebx],0fdbh
pop eax
@@ -171,19 +180,18 @@ irq3_1_buflen: dw COM_BUFLEN ;512bytes long
gdt_t:
dd 0,0 ;NULL DESCRIPTOR
- db 0ffh,0ffh,0,0,0,9ah,0f4h,0 ;cs 08h (base 0 limit 0xfffff)
- db 0ffh,0ffh,0,0,0,92h,0f4h,0 ;ds 10h (Check these)
+ db 0ffh,0ffh,0,0,0,9ah,0cfh,0 ;cs 08h (base 0 limit 0xfffff)
+ db 0ffh,0ffh,0,0,0,92h,0cfh,0 ;ds 10h (Check these)
;tss goes here.
gdt_e:
gdtr: dw (gdt_e - gdt_t - 1)
- dd (gdt_t); - $$) ;provide the argument needed for lgdt [limit16:offset32]
-
+ dd (gdt_t) ;provide the argument needed for lgdt [limit16:offset32]
idt_t: times 800h db 0 ;get space for our IDT.
idtr: dw 100h
- dd (idt_t) ;- $$) ;provide the argument needed for lidt
+ dd (idt_t) ;provide the argument needed for lidt
section .bootstrap_stack nobits alloc noexec write align=4
stack_bottom:
- resb 4000h ;Reserve space for our stack.
+ resb 4000h ;Reserve space for our stack.
stack_top: