Page 1 of 1

Bochs's bug in handling Page Table Entries

Posted: Sat Jun 09, 2007 9:04 am
by XCHG
I allocate some PTEs and, using my Relocate function, I will change the location of the allocated memory to somewhere else in the memory and thus get a new pointer to the memory block. If I have not written something to the first memory that was allocated and then try to relocate the memory, everything will work fine but if I have already written something to the initial memory block and then try to relocate the memory, Bochs will not show me a Page Fault Exception even though the PTE that maps the memory that I am addressing neither has its Present flag nor its Read/Write bits set. Does anybody have any idea why?

I tried my code on VMWare and I got a Page Fault Exception meaning that VMWare noticed that the PTE that I just set as not present is not really present! MS Virtual PC didn't give me a PF, just like Bochs.

Posted: Sat Jun 09, 2007 9:16 am
by jnc100
Did you invalidate the tlb after changing the page table entries? Once you access the memory the first time, it looks up the page tables. After that, the physical address is cached in the tlbs and not updated, even if you change the page table.

Regards,
John.

Posted: Sat Jun 09, 2007 9:23 am
by XCHG
I just figured it out lol. But I did it before you told me :? It is strange though how VMWare generates a Page Fault Exception but Bochs doesn't.

Thank you jnc100 for your help.

Posted: Sat Jun 09, 2007 3:16 pm
by Aali
emulating the TLB probably just makes things slower
it is not neccesary for "normal" operation after all