Help with magic number for segment offset after loading gdt
Posted: Sat May 28, 2011 10:16 am
I've managed to decode the magic numbers for several of the kernel boot things.
For example.
Making a global descriptor now looks like this,
Instead of something like this
In Bran's kernel development tutorial after the global descriptor table is loaded he changes the data in the segment registers.
He loads 0x08 into the code segment register and 0x10 into the data segment register.
Please explain these magic numbers.
For example.
Making a global descriptor now looks like this,
Code: Select all
gdt[2]=makeGlobalDescriptor(
0,
0xFFFFFFFF,
memoryPresent
|ringZero
|dataSegment
|writableData
,mode32Bits|fourKiloByteBlocks
);
Code: Select all
gdt[2]=makeGlobalDescriptor(
0,
0xFFFFFFFF,
memoryPresent
0x92 // Noobs don't bother learning anything, just say the magic words
,0x9F
);
He loads 0x08 into the code segment register and 0x10 into the data segment register.
Please explain these magic numbers.