Yes, I just try. The same result. Returns the same address.Combuster wrote:Have you tried running SGDT and SIDT (after doing LGDT and LIDT) in VirtualPC and printed the result? Did that surprise you?
Edit: This is what I have tried:
Code: Select all
inline void sgdt(uint32_t* location)
{
asm("sgdt %0" : : "m"(*location) : "memory");
}
inline void sidt(uint32_t* location)
{
asm("sidt %0" : : "m"(*location) : "memory");
}
...
TablaGDTDescStruc TablaGDTD_copy;
sgdt((uint32_t*)&TablaGDTD_copy);
SCR::Write("GDTD: %#08X\n", &TablaGDTD);
SCR::Write("GDTD base: %#08X\n", TablaGDTD.base);
SCR::Write("GDTD size: %#08X\n", TablaGDTD.size);
SCR::Write("GDTD_copy: %#08X\n", &TablaGDTD_copy);
SCR::Write("GDTD_copy base: %#08X\n", TablaGDTD_copy.base);
SCR::Write("GDTD_copy size: %#08X\n\n", TablaGDTD_copy.size);
TablaIDTDescStruc TablaIDTD_copy;
sidt((uint32_t*)&TablaIDTD_copy);
SCR::Write("IDTD: %#08X\n", &TablaIDTD);
SCR::Write("IDTD base: %#08X\n", TablaIDTD.base);
SCR::Writer("IDTD base size: %#08X\n", TablaIDTD.size);
SCR::Write("IDTD_copy: %#08X\n", &TablaIDTD_copy);
SCR::Write("IDTD_copy base: %#08X\n", TablaIDTD_copy.base);
SCR::Write("IDTD_copy size: %#08X\n", TablaIDTD_copy.size);
EDIT 2:
Haha PAE paging works correctly with 4KB pages. But how detect 2MB pages
EDIT 3:
From Intel Manual: Volume 3B System Programming Guide, Part 2
My OS detects a Pentium 2 or later. I think that Virtual PC is buggyThe Pentium processor extended the memory management/paging facilities of the IA-32 to allow large (4 MBytes)
pages sizes (see Section 4.3, “32-Bit Paging”). The first P6 family processor (the Pentium Pro processor) added a 2
MByte page size to the IA-32 in conjunction with the physical address extension (PAE) feature (see Section 4.4,
“PAE Paging”).
The availability of large pages with 32-bit paging on any IA-32 processor can be determined via feature bit 3 (PSE)
of register EDX after the CPUID instruction has been execution with an argument of 1. (Large pages are always
available with PAE paging and IA-32e paging.)
I expected to have support for PAE 2MB pages but I have no way to detect it. Virtual PC indicates that PSE and PAE are available but it is not true.
I think there is no solution. I have 2 options, either I enable support for 3 types of paging (legacy paging, PAE 4KB and PAE 2MB having a detection method) or just omit the Virtual PC staying with the first 2 methods.