x86 Architecture Notes

Processor modes

  • Real:
  • x86(-64) boots in this mode
  • Addresses always correspond to real locations in memory and I/O
  • Address space: 20-bit (1MiB) (segmented) memory address space

  • Protected:

  • Entered from real mode
  • Introduces the privileges rings 0-3
  • Allow to use virtual memory and multi tasking

  • Virtual (legacy):

  • No more available on x86-64 (uses VT-X instead)
  • HW virtualization technique to allow running real mode applications in protected mode

  • Long:

  • Access to 64-bit instructions and registers

Rings

  • Ring 0: kernel / supervisor
  • Ring 1,2: (not really used)
  • Ring 3: applications / user

x86-64

  • 4-level paging mode
  • 64-bit virtual address format. But in current implementation:

    • only the low-order 48 bits are used
    • most significant 16 bits of any virtual address, bits 48 through 63, must be copies of bit 47 (Canonical form)
      • 0 - 00007FFF'FFFFFFFF
      • FFFF8000'00000000 - FFFFFFFF'FFFFFFFF
  • 48-bit physical addresses: can address up to 256 TB of RAM

VT-x

  • CPU virtualization technology.
  • Root / non-root mode (orthogonal to Processor modes)
  • Root: hypervisor, Non-root: guest
  • VMX: instructions for VT-x handling (VMXON, VMXOFF, VMXLAUNCH, VMXRESUME).
  • A VMCS mem region (4kB) for each vCPU

QEMU

  • A process per VM
  • A thread per vCPU (VMCS)
  • Emulates I/O