Control and Status Registers

Relevant source files

This document covers the non-LVT (Local Vector Table) control and status registers in the virtual Local APIC implementation. These registers handle APIC identification, interrupt state management, inter-processor communication, and various control functions. For information about Local Vector Table registers, see LVT System.

The control and status registers are defined as fields in the LocalAPICRegs struct and accessed through the VirtualApicRegs virtualization layer. These registers implement the core APIC functionality beyond interrupt vector configuration.

Register Categories Overview

The control and status registers can be organized into several functional categories based on their roles in the APIC system:

Register Categories and Memory Layout


Sources: src/regs/mod.rs(L13 - L104) 

Spurious Interrupt Vector Register

The SVR register is the most complex control register, implemented with detailed bitfield definitions. It controls APIC software enable/disable, spurious vector configuration, and various interrupt handling behaviors.

SVR Register Bitfield Structure

flowchart TD
subgraph subGraph0["SPURIOUS_INTERRUPT_VECTOR Bitfields"]
    RESERVED2["Reserved1Bits 13-3119 bits"]
    EOI_SUPPRESS["EOIBroadcastSuppressionBit 121 bit0: Disabled, 1: Enabled"]
    RESERVED1["Reserved0Bits 10-112 bits"]
    FOCUS_CHECK["FocusProcessorCheckingBit 91 bit0: Enabled, 1: Disabled"]
    APIC_ENABLE["APICSoftwareEnableDisableBit 81 bit0: Disabled, 1: Enabled"]
    SPURIOUS_VEC["SPURIOUS_VECTORBits 0-78 bitsVector number"]
end

APIC_ENABLE --> SPURIOUS_VEC
EOI_SUPPRESS --> RESERVED1
FOCUS_CHECK --> APIC_ENABLE
RESERVED1 --> FOCUS_CHECK
RESERVED2 --> EOI_SUPPRESS

The register provides two type aliases for different access patterns:

  • SpuriousInterruptVectorRegisterMmio: Direct MMIO access via ReadWrite<u32, SPURIOUS_INTERRUPT_VECTOR::Register>
  • SpuriousInterruptVectorRegisterLocal: Cached local copy via LocalRegisterCopy<u32, SPURIOUS_INTERRUPT_VECTOR::Register>

Sources: src/regs/svr.rs(L1 - L71)  src/regs/mod.rs(L44 - L45) 

Control and Identification Registers

These registers provide basic APIC identification and priority control functionality:

RegisterOffsetTypePurpose
ID0x20ReadWriteLocal APIC ID for processor identification
VERSION0x30ReadOnlyAPIC version information and capabilities
TPR0x80ReadWriteTask Priority Register - current task priority level
APR0x90ReadOnlyArbitration Priority Register - for bus arbitration
PPR0xA0ReadOnlyProcessor Priority Register - combined priority level

Priority Register Relationships


Sources: src/regs/mod.rs(L17 - L30) 

Interrupt State Registers

The interrupt state is maintained in three 256-bit register arrays, each consisting of 8 × 128-bit entries covering the full 256 interrupt vector space:

Register ArrayOffset RangeTypePurpose
ISR0x100-0x170[ReadOnly; 8]In-Service Register - currently serviced interrupts
TMR0x180-0x1F0[ReadOnly; 8]Trigger Mode Register - level vs edge triggered
IRR0x200-0x270[ReadOnly; 8]Interrupt Request Register - pending interrupts

Interrupt State Array Layout


The IRR uses a specific bit mapping where bit x is located at bit position (x & 1FH) at offset (200H | ((x & E0H) >> 1)), and only the low 4 bytes of each 16-byte field are used by the processor.

Sources: src/regs/mod.rs(L47 - L60) 

Communication Registers

These registers handle inter-processor communication and interrupt acknowledgment:

RegisterOffsetTypePurpose
EOI0xB0WriteOnlyEnd of Interrupt - signal interrupt completion
RRD0xC0ReadOnlyRemote Read Register - remote APIC access
LDR0xD0ReadWriteLogical Destination Register - logical addressing
DFR0xE0ReadWriteDestination Format Register - addressing mode
ICR_LO0x300ReadWriteInterrupt Command Register Low - IPI control
ICR_HI0x310ReadWriteInterrupt Command Register High - destination
SELF_IPI0x3F0WriteOnlySelf IPI Register - self-directed interrupts

Inter-Processor Communication Flow

sequenceDiagram
    participant ProcessorA as "Processor A"
    participant ICR_LO0x300 as "ICR_LO (0x300)"
    participant ICR_HI0x310 as "ICR_HI (0x310)"
    participant ProcessorB as "Processor B"
    participant EOI0xB0 as "EOI (0xB0)"
    participant SELF_IPI as SELF_IPI

    Note over ProcessorA,ProcessorB: Inter-Processor Interrupt Sequence
    ProcessorA ->> ICR_HI0x310: Write destination processor ID
    ProcessorA ->> ICR_LO0x300: Write vector + delivery mode + trigger
    ICR_LO0x300 ->> ProcessorB: Send IPI
    ProcessorB ->> ProcessorB: Handle interrupt
    ProcessorB ->> EOI0xB0: Write to signal completion
    Note over ProcessorA,EOI0xB0: Self-IPI Alternative
    ProcessorA ->> SELF_IPI: Write vector for self-interrupt

Sources: src/regs/mod.rs(L32 - L42)  src/regs/mod.rs(L67 - L70)  src/regs/mod.rs(L99 - L100) 

Timer Control Registers

The timer subsystem uses dedicated control registers separate from the LVT Timer register:

RegisterOffsetTypePurpose
ICR_TIMER0x380ReadWriteInitial Count Register - timer start value
CCR_TIMER0x390ReadOnlyCurrent Count Register - current timer value
DCR_TIMER0x3E0ReadWriteDivide Configuration Register - timer frequency

Timer Control Register Interaction


Sources: src/regs/mod.rs(L90 - L97) 

Error Status Register

The Error Status Register tracks various APIC error conditions:

RegisterOffsetTypePurpose
ESR0x280ReadWriteError Status Register - APIC error flags

This register works in conjunction with the LVT Error register to handle and report APIC internal errors.

Sources: src/regs/mod.rs(L61 - L62) 

Register Access Patterns

All control and status registers are accessed through the same virtualization infrastructure as LVT registers, supporting both xAPIC MMIO and x2APIC MSR access modes:

Register Access Flow


Sources: src/regs/mod.rs(L13 - L104)