SimpleVisor icon indicating copy to clipboard operation
SimpleVisor copied to clipboard

Question about "UINT64 PageFrameNumber : 36"

Open wbenny opened this issue 7 years ago • 3 comments

Hi, In VMX_EPTP, VMX_EPML4E, VMX_PDPTE, MTRR_VARIABLE_BASE & MTRR_VARIABLE_MASK structures, there is a member defined as: UINT64 PageFrameNumber : 36

Intel manual says size of this field should be MAXPHYADDR, which is obtained by CPUID.80000008H:EAX[7:0] (39 on my machine).

Intel also says:

the width is generally 36 if CPUID.01H:EDX.PAE [bit 6] = 1 and 32 otherwise.) ... MAXPHYADDR is at most 52

My question is: couldn't this cause problems (assuming the available RAM is really, really big) & wouldn't it be better to simply define this field as: UINT64 PageFrameNumber : 52 ?

I assume "unused" bits are set to 0 anyway.

wbenny avatar May 13 '18 16:05 wbenny

Yep that’s probably not a bad idea.

On Sun, May 13, 2018 at 9:16 AM Parallel Xenoexcite < [email protected]> wrote:

Hi, In VMX_EPTP, VMX_EPML4E, VMX_PDPTE, MTRR_VARIABLE_BASE & MTRR_VARIABLE_MASK structures, there is a member defined as: UINT64 PageFrameNumber : 36

Intel manual says size of this field should be MAXPHYADDR, which is obtained by CPUID.80000008H:EAX[7:0] (39 on my machine).

Intel also says:

the width is generally 36 if CPUID.01H:EDX.PAE [bit 6] = 1 and 32 otherwise.) ... MAXPHYADDR is at most 52

My question is: couldn't this cause problems & wouldn't it be better to simply define this field as: UINT64 PageFrameNumber : 52 ?

I assume "unused" bits are set to 0 anyway.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ionescu007/SimpleVisor/issues/30, or mute the thread https://github.com/notifications/unsubscribe-auth/AFxIeLFWyG3PJmTeLY0m-lsbbk6ce8wWks5tyFxngaJpZM4T83Gr .

-- Best regards, Alex Ionescu

ionescu007 avatar May 13 '18 17:05 ionescu007

Hey, I had the same question in mind a while ago, why did you decide against this in your hypervisor? https://github.com/wbenny/hvpp/blob/master/src/hvpp/hvpp/ia32/paging.h#L78 here you hardcode 36 bits, is this because of something you discovered or does it just not really matter?

hypervisor avatar Oct 28 '19 08:10 hypervisor

Hi @dxgkrnl, I generated the structs automatically using my other project - https://github.com/wbenny/ia32-doc. In my case, the 36 ended up there because I hardcoded MAXPHYADDR = 48 before generation. Explanation is in the comments https://github.com/wbenny/ia32-doc/blob/3acb567dae0325e889881105d528795f1aa8b237/ia32doc/doc.py#L31

Hope it helps.

wbenny avatar Oct 28 '19 10:10 wbenny