Another Test-Things-Then-Get-To-PM-code that doesn't work...
Posted: Mon Nov 25, 2002 8:54 pm
[attachment deleted by admin]
The Place to Start for Operating System Developers
http://f.osdev.org/
Code: Select all
;;;;; Global Descriptor Table (GDT) ;;;;;
GlobalDescriptorTableRegister
dw GlobalDescriptorTableEnding -GlobalDescriptorTableBeginning
dd GlobalDescriptorTableBeginning
Code: Select all
gdt:
dw gdt_end - gdt - 1
db gdt
Code: Select all
GDT0 DW 0x0000,0x0000,0x0000,0x0000
GDT1 DW 0xFFFF,0x0000,0x9A00,0x00CF
GDT2 DW 0xFFFF,0x0000,0x9200,0x00CF
GDTR DW GDTR-GDT0-1,GDT0,0x0000
IDT:
DW IH0,0x0008,0xEE00,0x0000
DW IH1,0x0008,0xEE00,0x0000
DW IH2,0x0008,0x8E00,0x0000
DW IH3,0x0008,0xEE00,0x0000
DW IH4,0x0008,0xEE00,0x0000
DW IH5,0x0008,0xEE00,0x0000
DW IH6,0x0008,0xEE00,0x0000
DW IH7,0x0008,0xEE00,0x0000
DW IH8,0x0008,0xEE00,0x0000
DW IH9,0x0008,0xEE00,0x0000
DW IHA,0x0008,0xEE00,0x0000
DW IHB,0x0008,0xEE00,0x0000
DW IHC,0x0008,0xEE00,0x0000
DW IHD,0x0008,0xEE00,0x0000
DW IHE,0x0008,0xEE00,0x0000
DW IHF,0x0008,0x0E00,0x0000
DW IH10,0x0008,0xEE00,0x0000
DW IH11,0x0008,0xEE00,0x0000
DW IH12,0x0008,0xEE00,0x0000
DW IH13,0x0008,0xEE00,0x0000
DW IH14,0x0008,0x0E00,0x0000
DW IH15,0x0008,0x0E00,0x0000
DW IH16,0x0008,0x0E00,0x0000
DW IH17,0x0008,0x0E00,0x0000
DW IH18,0x0008,0x0E00,0x0000
DW IH19,0x0008,0x0E00,0x0000
DW IH1A,0x0008,0x0E00,0x0000
DW IH1B,0x0008,0x0E00,0x0000
DW IH1C,0x0008,0x0E00,0x0000
DW IH1D,0x0008,0x0E00,0x0000
DW IH1E,0x0008,0x0E00,0x0000
DW IH1F,0x0008,0x0E00,0x0000
IDTR DW IDTR-IDT-1,IDT,0x0001
Okay... I think I understand... However, the code still doesn't work right... And I still think it is something wrong with the jmp to PM... But then again, it works perfectly to call a sub routine so the addressing may not be the problem... Oh God... ???DynatOS wrote: It is -1 because that is the last byte. For example, an 8-byte descriptor starting at 0x00001000 doesn't end at 0x00001008, it ends at 0x00010007... 0-7 = 8 bytes.
Nope, I don't use any emulators.DynatOS wrote: Are you using bochs?
Code: Select all
;;;;; Enter Protected Mode ;;;;;
mov eax,cr0
inc ax ; This instead of Or Al,1 saves 1 byte
mov cr0,eax
jmp CLEAR ;Clear instruction prefetch cache
CLEAR:
DB 0x66
DB 0xEA
DD EnterProtectedMode
DW SystemCodeSelector
I can try it... but I don't really get it... Is that opcodes for a far jmp or?DynatOS wrote: Try this...
Code: Select all
;;;;; Enter Protected Mode ;;;;; mov eax,cr0 inc ax??????; This instead of Or Al,1 saves 1 byte mov cr0,eax jmp CLEAR ;Clear instruction prefetch cache CLEAR: DB 0x66 DB 0xEA DD EnterProtectedMode DW SystemCodeSelector