brendan: as I wrote, the base addr och the bootloader is 10000h and "all the segments are cleared before running the above code except CS which is 1000h." => DS = 0. The assembler is NASM.
Dex: "o32" tells NASM to use 32-bits operand (in other words adding the instruction prefix 66h), look in the Instruction Set Reference from Intel on the instruction "LGDT/LIDT".
The GDT table looks like this:
Code: Select all
%macro GDT_ENTRY 6
%%LIMIT_15_0 dw %1
%%BASE_15_0 dw %2
%%BASE_23_16 db %3
%%OPT_1 db %4
%%OPT_2_LIMIT_19_16 db %5
%%BASE_31_24 db %6
%endmacro
gdtr
dw gdt_end-gdt-1
dd gdt
gdt
nullseg equ ($-gdt)
GDT_ENTRY 0h, 0h, 0h, 0h, 0h, 0h ;nullseg
code32sel equ ($-gdt)
GDT_ENTRY 0FFFFh, 0h, 0h, 9ah, 0cfh, 0h ;Kernel Code
data32sel equ ($-gdt)
GDT_ENTRY 0FFFFh, 0h, 0h, 92h, 0cfh, 0h ;Kernel
gdt_end
PS! I have removed the "lidt" instruction for now to make debugging easier, it will be added again when the lgdt thing works.
PS #2! BOS seems to be entering Pmode in the bootsector, this is not an option for me because the bootloader probes the BIOS for VESA, APM and Memory information...
One last option is to move back the bootloader to under the 10000h mark, but shouldn't it be possible to get into Pmode when your above 10000h???