GDT reboot

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
slacker

GDT reboot

Post by slacker »

my PC Reboots with this GDT..any ideas why?

GDTpointer:
GDTbase DD GDT
GDTlim DW ENDGDT-GDT

GDT:
NULLsel EQU $-GDT ;required
DD 0x00
DD 0x00

CODEsel EQU $-GDT
DW 0xFFFF
DW 0x00
DB 0x00
DB 0x9A
DB 0xCF
DB 0x00

DATAsel EQU $-GDT
DW 0xFFFF
DW 0x00
DB 0x00
DB 0x92
DB 0xCF
ENDGDT:
DB 0x00
Ozguxxx

Re:GDT reboot

Post by Ozguxxx »

Well, I am very sure but you must set PHYSICAL address in GDTbase, are you exactly doing this by:

Code: Select all

GDTpointer:
GDTbase DD GDT            
GDTlim DW ENDGDT-GDT
?
Ozguxxx

Re:GDT reboot

Post by Ozguxxx »

Hey I made a mistake I had miswritten I must have said "...I am NOT very sure..." instead of "I am very sure", sorry... ;D
slacker

Re:GDT reboot

Post by slacker »

actually the lmit comes before the base..that was my problem..thanks anyways
slacker

Re:GDT reboot

Post by slacker »

ok i got the GDT workin now but im having trouble trying to relocate it to 0x50:0x00:
any ideas why my PC reboots?

;--------------------------constants--------------------------
GDTpointer:
GDTlim DW ENDGDT-GDT
GDTbase DD 0x500

Selectors: ;used as offset from start of GDT
NULLsel EQU 0x0
CODEsel EQU 0x0008
DATAsel EQU 0x0010



;--------------------------gdt-------------------------------
GDT: ;flat memory model
;NULLsel ;required
DD 0x00
DD 0x00

;CODEsel
DW 0xFFFF
DW 0x00
DB 0x00
DB 0x9A
DB 0xCF
DB 0x00

;DATAsel
DW 0xFFFF
DW 0x00
DB 0x00
DB 0x92
DB 0xCF
ENDGDT:
DB 0x00


;------------------relocate gdt--------------------
mov AX, 0x50
mov ES, ax
mov DI, 0x00
mov SI, GDT
mov CX, 24

moveit:
movsb
INC DI
INC SI
loop moveit

lgdt [GDTpointer]
Curufir

Re:GDT reboot

Post by Curufir »

Because you haven't bothered relocating the base of your gdt register?
slacker

Re:GDT reboot

Post by slacker »

movsb already increments DI and SI...i didnt know..that was my problem
Post Reply