Software Archive
Read-only legacy content
17061 Discussions

How to find first free entry in PTE

interruptrequestpack
823 Views
Hi all, I'm not really sure if this is a valid question in this forum but how can I find the first free entry in the PTE?
I was looking the volume 3A of intel manuals for some flag, but nothing. Can you help me?

Regards,
irp
0 Kudos
5 Replies
Quoc-Thai_L_Intel
823 Views

Hi, I don't have a direct answer for your questions yet. After searching around, I found a couple of threads that could provide some hints for your questions. Here are the two existing threads in this forum:

EPT: Strange VM-Exits

EPT write back memory type and Machine Check exception

-Thai

0 Kudos
interruptrequestpack
823 Views
I found out how to do that, thanks anyway!
irp
0 Kudos
Quoc-Thai_L_Intel
823 Views
Great,is this something that you can share for other to learn from your finding?
Thanks,
-Thai
0 Kudos
interruptrequestpack
823 Views
Yes sure. I will try, because I don't really know this method is correct.
First I check for the pte entry looking for the descriptor entry with PS=0
*pdeB = __CR3_READ(pdeBase);
oldPdeB = *pdeB;
for (*pdeB; *pdeB < MAX_PTE_SIZE; *pdeB++) {
if (pdeB[7] == 0) break;
continue;
}
*pdeB = __CR3_READ(pdeBase); oldPdeB = *pdeB; for (*pdeB; *pdeB < MAX_PTE_SIZE; *pdeB++) { if (pdeB[7] == 0) break; continue; }
Then I just check for the first table entry with preset flag set (it must be one to map a 4kb page)
*pteBase = __SET_PDE(*pdeB);
oldPteBase = *pteBase;
for (*pteBase; *pteBase < MAX_PTE_SIZE; *pteBase++) {
if (pteBase[0] == 1) break;
continue;
}
Maybe I'm missing something, so it that case, help me.
Thanks,
irp
0 Kudos
Quoc-Thai_L_Intel
823 Views
Thanks for sharing! You can also check on http://www.xen.org/products/xen_source.htmlfor more ideas.
-Thai
0 Kudos
Reply