title: Writing the translation lookaside buffer
body: <p>Applications work with virtual memory. That's a nice concept, we can treat it like a contiguous block and needn't care about whether it's contiguous in physical RAM or not or if it's even on hard disk.</p>
  
  <p>As far as I understand the mapping between virtual addresses and physical addresses is done directly by the CPU (or at least in hardware) using the translation lookaside buffer.</p>
  
  <p>I assume that the kernel somehow maintains the contents of the TLB, but here's where I'm a little bit stuck, so I have 3 questions:</p>
  
  <p><strong>What are the specific assembler instructions for querying, reading and writing the contents of the TLB?</strong> I was not very lucky googling for opcodes related to this topic. I just found INVLPG and TLBWI. Because I'm new to that level of depth, maybe I just use the wrong search terms. If you find it immediately, which search terms do you use?</p>
  
  <p><strong>Do all those assembler instructions need privileged CPU mode?</strong></p>
  
  <p><strong>What is the initial content of the TLB?</strong> If the TLB is empty at the beginning, does that mean the very first assembler instructions of an operating system will be mapped directly to physical memory (so that virtual address == physical address)?</p>