hello, first, thanks for the great tutorials, i have one question while checking the source code, inside class GlobalDescriptorTable:
uint16_t CodeSegmentSelector();
the returned value type is "uint16_t" for CodeSegmentSelector, however, it turns out we want to get the address difference:
uint16_t GlobalDescriptorTable::DataSegmentSelector() {
return (uint8_t *) &dataSegmentSelector - (uint8_t *)this;
}
Question 1:
if we are targeting at 32bits cpu architecture, the value of the difference for the address shouldn't be 32bits? saying instead of uint16_t, shouldn't we use uint32_t?
is it because we restrict the size of codeSegment and dataSegment to 2^16?
like this part:
codeSegmentSelector(0, 64 * 1024 * 1024, 0x9A),
dataSegmentSelector(0, 64 * 1024 * 1024, 0x92)
if yes, question 2
instead of put the limit to (64 * 1024 * 1024 == 64MB), shouldn't we put 64*1024 which is equal to 2^16 == 64KB?
thanks!