Chapter 1. The Modern CPU Execution Model
Section 1. Instruction Set Architecture and Machine Code
- Opcode formats and binary encoding structure
- Register files and architectural state
- Addressing modes and operand resolution
- Flags and condition codes
- Instruction decoding and execution flow
- Control registers and system state
Section 2. Execution Modes and Privilege Architecture
- Real mode fundamentals
- Protected mode structure
- Long mode (64-bit) operation
- Ring levels and privilege enforcement
- Transitioning between modes
- Model-specific registers and extended state
Section 3. Microarchitectural Realities
- Pipelines and superscalar execution
- Out-of-order execution mechanics
- Branch prediction and speculation
- Cache hierarchies and coherency protocols
- Translation lookaside buffers (TLBs)
- Performance monitoring counters
Chapter 2. Boot and Control Transfer on Modern Hardware
Section 1. Firmware Foundations
- BIOS legacy boot process
- UEFI boot architecture
- Secure Boot and its implications
- Firmware memory maps
- Power-on reset state
- POST and hardware initialization
Section 2. Bootloader Architecture
- Boot sector structure and constraints
- Stage 1 and Stage 2 loaders
- Loading binaries from storage
- Stack setup and early execution environment
- Enabling A20 and memory access above 1MB
- Transition to protected and long mode
Section 3. Establishing Full Control
- Exiting firmware services
- Identity mapping and early paging
- Setting up GDT and IDT
- Enabling long mode execution
- Control register configuration
- Verifying CPU features and capabilities
Chapter 3. Memory Architecture and Deterministic Control
Section 1. Physical and Virtual Memory Models
- Physical address space layout
- Virtual address translation mechanisms
- Page table hierarchies (PML4 and beyond)
- Page attributes and access control
- Large pages and huge pages
- Memory type range registers (MTRRs)
Section 2. Paging and Execution Management
- Identity mapping strategies
- Higher-half kernel layouts
- Disabling or simplifying paging
- Managing CR3 and TLB behavior
- Cache control and memory ordering
- Executable vs non-executable regions
Section 3. Deterministic Memory Operation
- Eliminating unpredictable interrupts
- Cache behavior and false sharing
- Interrupt masking and NMI considerations
- Precise timing with TSC
- DMA and IOMMU configuration
- Memory barriers and ordering guarantees
Chapter 4. Interrupts, Exceptions, and Hardware Control
Section 1. Interrupt Architecture and Descriptor Tables
- Interrupt Descriptor Table (IDT) structure
- Gate types and privilege transitions
- Interrupt vector layout
- Interrupt stack tables (IST)
- Task State Segment (TSS) configuration
- Loading and activating the IDT
Section 2. Exception Handling and Fault Management
- Processor-defined exception types
- Faults, traps, and aborts
- Error codes and stack frames
- Double faults and triple faults
- Recoverable vs non-recoverable conditions
- Designing stable exception handlers
Section 3. Advanced Interrupt Control
- Legacy PIC vs Local APIC
- I/O APIC routing and configuration
- Inter-Processor Interrupts (IPI)
- Non-Maskable Interrupts (NMI)
- Interrupt prioritization and nesting
- Deterministic interrupt masking strategies
Chapter 5. Direct Hardware Access and Bus-Level Control
Section 1. Memory-Mapped and Port-Mapped I/O
- Memory-mapped I/O fundamentals
- Port I/O instructions and usage
- Access width and alignment constraints
- Volatile semantics and ordering
- Device register interaction models
- Side effects of hardware access
Section 2. PCI and Device Enumeration
- PCI configuration space structure
- Bus, device, and function addressing
- Base Address Registers (BARs)
- Capability lists and extended capabilities
- Enumerating and initializing devices
- Mapping device memory regions
Section 3. Direct Memory Access and IOMMU
- DMA fundamentals and descriptor rings
- Bus mastering configuration
- Cache coherency with DMA
- IOMMU mapping and isolation
- Scatter-gather transfers
- Ensuring deterministic device interaction
Chapter 6. Timing, Scheduling, and Execution Control
Section 1. Hardware Timers and Timekeeping
- Programmable Interval Timer (PIT)
- Local APIC timer
- High Precision Event Timer (HPET)
- Time Stamp Counter (TSC)
- Invariant TSC and frequency scaling
- Clock calibration techniques
Section 2. Scheduling Without an Operating System
- Cooperative scheduling models
- Preemptive scheduling design
- Context switching mechanics
- Saving and restoring CPU state
- Stack management for multiple tasks
- Minimal task control structures
Section 3. Deterministic Execution Guarantees
- Interrupt latency measurement
- Jitter analysis and reduction
- Cache warming strategies
- Lock-free synchronization
- Spinlocks and atomic primitives
- Real-time deadline enforcement
Chapter 7. AI as Machine Code Author
Section 1. Human–AI Architectural Workflow
- Defining hardware-level specifications
- Declaring architectural constraints
- Iterative refinement of execution models
- Prompt structures for deterministic code generation
- Validating AI understanding of CPU state
- Maintaining architectural invariants
Section 2. Machine Code Synthesis
- Translating requirements into opcode sequences
- Register allocation strategies
- Stack discipline enforcement
- Control flow construction at binary level
- Direct encoding of instruction bytes
- Mode-aware instruction generation
Section 3. Validation and Semantic Assurance
- Binary inspection and disassembly verification
- Control flow graph reconstruction
- Detecting undefined behavior
- Ensuring privilege correctness
- Verifying memory safety constraints
- Performance profiling at instruction granularity
Chapter 8. Debugging and Verification Without an OS
Section 1. Hardware-Level Debugging Tools
- Serial console diagnostics
- JTAG and hardware debugging interfaces
- Using QEMU and hardware emulators
- GDB remote debugging
- Breakpoints and watchpoints at machine level
- Single-stepping instruction execution
Section 2. Fault Analysis and Recovery
- Stack frame reconstruction
- Register state inspection
- Handling page faults and general protection faults
- Diagnosing triple faults
- Memory corruption detection
- Structured crash reporting
Section 3. Deterministic Testing and Replay
- Building reproducible test harnesses
- Hardware simulation environments
- Deterministic input injection
- Fault injection testing
- Measuring execution timing precisely
- Regression testing for binary code