INVLPG instruction

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
FlashBurn

INVLPG instruction

Post by FlashBurn »

I don?t get this instruction working (only tested under Bochs). I?m writing my dealloc functions for the vmm. So I can invalid just 1 page or I can flush the whole tlb. But I don?t get the point how this instruction is working.

When I have the virtual addr in eax, must I use "invlpg [eax]" or need the addr where the page?s physical address stands (in a pt)?

Also when I map a page to a address space, must I than also invalide the the tlb entry for that address?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:INVLPG instruction

Post by Pype.Clicker »

the argument of invlpg is the offset (within DS or some other segment) of the logical address that you want to invalidate.

So if you just (for some insane reason) modified the mapping for offset 0xb8000 in a zero-based data segment you'd need to

Code: Select all

invlpg [0xb8000]
And if your data-segment was 0xC0000000-based, you'd have

Code: Select all

invlpg [0x400b8000]
Afaik, it's not necessary to invalidate pages that you make present and that had no previous line in the TLB on intel processors (though i've seen other founders that were also caching non-present pages in the TLB and thus which require a flush after a page has been defined, can't remember which ones).
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:INVLPG instruction

Post by Candy »

Pype.Clicker wrote: Afaik, it's not necessary to invalidate pages that you make present and that had no previous line in the TLB on intel processors (though i've seen other founders that were also caching non-present pages in the TLB and thus which require a flush after a page has been defined, can't remember which ones).
AFAIK, Cyrixes. Not Via Cyrix chips, Cyrix M2 like chips
FlashBurn

Re:INVLPG instruction

Post by FlashBurn »

OK, or I put e.g. 0xb8000 in eax and then I have to use "invlpg [eax]", right? Because I tried this in Bochs and it didn?t work.

Edit::

OK, it is working, was my fault - I should give the function the right address -.
Post Reply