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.
Hello people. I haven't been here for a while, but in the last fre days I tough I would give osdev a second chance and I really made some progress with my OS.
However I'm stuck at the most stupid problem I have ever had...
I cannot update the tlb. Below you can see my nasm code I call from C after I make some changes in the current paging structures.
I'm becomming paranoid so can you "confirm" if this code is valid?
1. Sorry but it seems to be a bad copy-paste. Why did you add frame-pointer operations when you don't use stack frame?
2. AFAIR, this trick flushes the whole TLB only on 80386. On later CPUs it doesn't flush information about pages with 'global' flag.
3. Complete TLB flush should be avoided as much as possible. It's better to use INVLPG for specific pages.
Yep. Reloading CR3 with the same value does clear the TLB (you are effectively reloading the same address space). As Nabie warns, this doesn't clear global pages, but that's the purpose of global pages: That they don't get invalidated when switching address spaces, because they are, you know, global.
Beware the topic name: On some CPUs you manually 'update' the TLB in software, while on x86 this is entirely automatic. This topic should be called 'Invalidating TLB' or 'Flushing TLB' or something.