Memory Management Unit

Pasted image 20231209130929.png

Software Managed

MIPS MMU

  • Hardware has 64-entry TLB
  • TLB Entries: 64-bit
    • PID: Process ID
      • Allows multiple processes to use TLB
    • N: No Cache
    • D: Writeable
    • V: Valid
    • G: Global
      • Pages shared across all address spaces

Pasted image 20231209151314.png

MIPS TLB Instructions

Exceptions

UTLB Miss

UTLB handler is separate from general exception handler

  • UTLBs are very frequent and require a hand optimized path

Hardware lookup algorithm

  1. If the most significant bit is 1 and in user mode → address error exception
    • virtual address ≥ 0x8000 0000 (kernel memory)
  2. If no VPN match → TLB/UTLB miss exception
  3. If PID mismatch and global bit not set → TLB/UTLB miss
  4. If valid bit not set → TLB/UTLB miss
  5. Write to read-only page → TLB mod exception
  6. If N b it is set → directly access device memory

Hardware Managed

x86

TLB managed by Hardware and Microcode

  • Two levels of TLBs each acting as a cache
  • TLB automatically reloaded from page table by processor
    OS builds Radix tree describing memory layout
    Contains much of the same information as MIPS
  • Global page
    • all processes can access it
  • Accessed
    • whether the page has been accessed recently
  • Cache disabled
    • do not store in cache
  • Write-through
    • enable write-through
  • User/Supervisor
    • privilege needed to access page
  • Read/Write
    • is the page writeable
  • Present
    • in RAM rather than is swap space on the SSD
      Directories ignore the global page bit
      Specifies page size instead of Page Table Attribute

x86 Paging

Normally 4KB pages