HAL and Ntoskrnl: The Kernel Core Components

By Debraj Basak·Jun 18, 2026 · Updated Jun 20, 2026·11 min readWindows Internals

Objective: Understand the architecture and division of labor between hal.dll (the Hardware Abstraction Layer) and ntoskrnl.exe (the NT kernel and Executive), how they are loaded during boot, the structures and routines each exposes, and how defenders inspect, detect tampering against, and harden these Ring 0 core components.


1. HAL and Ntoskrnl Overview

Two binaries sit at the bottom of Windows kernel mode and everything else builds on them. ntoskrnl.exe is the NT kernel plus the Executive — the policy and service layer of the OS. hal.dll is the Hardware Abstraction Layer — a thin platform shim that hides interrupt controllers, bus topology, timers, and DMA behind a uniform interface so the rest of the kernel stays hardware-independent.

BinaryFull nameLoaded byRing
ntoskrnl.exeNT OS Kernel + Executivewinload.efiRing 0
hal.dllHardware Abstraction Layerwinload.efiRing 0

Both reside in %SystemRoot%\System32\. On multiprocessor systems the SMP-aware image ntkrnlmp.exe is selected by the loader and presented as ntoskrnl.exe; modern Windows 10/11 ships only the SMP variant. Verify image identity and signature on a live host with sigcheck, dumpbin /headers, or the WinDbg lm command. The separation exists for portability (HAL absorbs platform differences) and layering (the kernel implements scheduling and policy, not chipset quirks).


2. Boot Handoff: From Bootloader to KiSystemStartup

winload.efi loads ntoskrnl.exe and hal.dll into memory, then transfers control to the kernel entry point KiSystemStartup, passing a pointer to a LOADER_PARAMETER_BLOCK. That structure carries the memory descriptor list, the ARC hardware tree, NLS data, and other boot-time state the kernel needs before it can manage its own memory.

winload.efi
  └─ loads ntoskrnl.exe + hal.dll
       └─ ntoskrnl!KiSystemStartup(PLOADER_PARAMETER_BLOCK)
            ├─ HalInitializeProcessor()    ; HAL brings up per-CPU hardware
            ├─ KiInitializeKernel()        ; KPCR/KPRCB, IDT, GDT
            ├─ Executive phase init:
            │    Mm/Ob/Se/Io/Cm/Ps InitSystem()
            └─ PsInitialSystemProcess()    ; System process (PID 4)
                 └─ Phase 1: smss.exe launched

HAL initializes the processor before the Executive runs a single line of policy code. Secure Boot validates the winload.efi → ntoskrnl.exe / hal.dll chain in firmware, so tampering with either binary on disk breaks the boot chain on a properly configured machine.


Boot sequence flow diagram showing UEFI firmware validating winload.efi which loads hal.dll and ntoskrnl.exe passing a LOADER_PARAMETER_BLOCK before the Executive initializes
Secure Boot validates each link in the chain; winload.efi loads both HAL and the kernel before handing off control to KiSystemStartup.

3. The HAL: Abstracting the Hardware

The HAL translates abstract requests into platform-specific operations: programming the APIC, translating bus-relative addresses, allocating DMA-coherent buffers, and calibrating the stall timer. Drivers and the kernel call HAL routines instead of touching hardware registers directly.

RoutinePurpose
HalGetInterruptVectorTranslate a bus IRQ to a system interrupt vector and required IRQL
HalTranslateBusAddressConvert a bus-relative address to a logical address
HalAllocateCommonBufferAllocate DMA-coherent memory visible to CPU and device
KeStallExecutionProcessorCalibrated busy-wait (HAL-implemented on most platforms)
HalRequestSoftwareInterruptRequest a software interrupt at a given IRQL to trigger DPC delivery

On modern ACPI systems the HAL is far thinner than in the NT 4 era. Many classic Hal* exports such as HalGetInterruptVector are deprecated; the PnP/ACPI stack and IoConnectInterruptEx now handle interrupt wiring. Since Windows 8, HAL Extensions (halextpcat.dll, halextintc.dll, and similar PE images loaded by HAL itself) carry SoC- and OEM-specific code without replacing the whole HAL.


4. IRQL: The Kernel’s Preemption Ladder

Interrupt Request Level (IRQL) is the central arbitration mechanism shared by HAL and the kernel. The HAL programs the interrupt controller to enforce IRQL in hardware; running at an IRQL masks all interrupts at or below that level on the current CPU.

IRQL (x64)Symbolic nameUsed for
0PASSIVE_LEVELNormal thread execution
1APC_LEVELAPC delivery; paging allowed
2DISPATCH_LEVELScheduler, spin locks; no paging, no blocking
3–12Device IRQLsHardware ISRs
13CLOCK_LEVELClock interrupt
14PROFILE_LEVELProfiling interrupt
15HIGH_LEVELNMI, machine check

The cardinal rule: at DISPATCH_LEVEL or above you may not touch pageable memory or block, because the scheduler and page fault handler cannot run. A driver that dereferences paged-out memory at elevated IRQL produces the classic IRQL_NOT_LESS_OR_EQUAL bug check. Query the current level with KeGetCurrentIrql(). IRQL numeric values are architecture-specific; the table above is the canonical x64 mapping.


Hierarchy diagram of Windows x64 IRQL levels from PASSIVE at 0 up through APC, DISPATCH, CLOCK, IPI, POWER to HIGH at 31 showing preemption priority
Running at DISPATCH_LEVEL or above masks the scheduler and page-fault handler — any pageable memory access at this level triggers an IRQL_NOT_LESS_OR_EQUAL bug check.

5. The Kernel Layer (Ke): Scheduling and Synchronization

The Ke layer sits directly above HAL and implements thread scheduling, interrupt and exception dispatch, and the low-level synchronization primitives the rest of the system depends on.

RoutineWhat it does
KeInitializeSpinLockInitialize a spin-lock object
KeAcquireSpinLockRaise IRQL to DISPATCH_LEVEL and acquire the lock
KeReleaseSpinLockRelease the lock and restore the saved IRQL
KeInsertQueueDpcQueue a Deferred Procedure Call
KeWaitForSingleObjectWait on a dispatcher object (event, mutex, timer, thread)
KeSetEventSet a kernel event to the signaled state

Dispatcher objects — events, mutexes, semaphores, timers, threads — share a common DISPATCHER_HEADER carrying Type, SignalState, and WaitListHead. The wait machinery keys off that header. The synchronization pattern below runs at PASSIVE_LEVEL, where blocking is legal:

KEVENT readyEvent;
KeInitializeEvent(&readyEvent, NotificationEvent, FALSE);

// ... another thread eventually calls KeSetEvent(&readyEvent, IO_NO_INCREMENT, FALSE);

NTSTATUS status = KeWaitForSingleObject(
    &readyEvent,        // dispatcher object
    Executive,          // wait reason
    KernelMode,         // processor mode
    FALSE,              // non-alertable
    NULL);              // no timeout

Per-CPU scheduler state lives in the KPCR (Kernel Processor Control Region), reachable via gs:[0] on x64, with an embedded KPRCB holding CurrentThread, NextThread, IdleThread, and the DPC queue.


6. The Executive Layer (Ex and Friends)

The Executive comprises the higher-level managers, each identified by a two-letter prefix. They build on Ke primitives and HAL services.

ManagerPrefixResponsibilities
Object ManagerObObject lifecycle, handles, reference counting
Process/Thread ManagerPsEPROCESS/ETHREAD creation and teardown
Memory ManagerMmVAD trees, PTEs, page faults, pool
I/O ManagerIoIRP lifecycle, driver loading
Security Reference MonitorSeAccess checks, tokens, privileges
Configuration ManagerCmRegistry hive management
Executive SupportExPool allocation, lookaside lists, callbacks

Correct pool usage on modern Windows uses ExAllocatePool2 (the successor to ExAllocatePoolWithTag, deprecated starting Windows 10 build 19041) paired with ExFreePoolWithTag:

// Allocate non-paged pool with a 4-byte tag (read in WinDbg as 'XgAT').
PVOID buffer = ExAllocatePool2(POOL_FLAG_NON_PAGED, 0x1000, 'TAgX');
if (buffer != NULL) {
    // ... use buffer at IRQL <= DISPATCH_LEVEL ...
    ExFreePoolWithTag(buffer, 'TAgX');
}

The Object Manager exposes ObReferenceObjectByHandle to convert a handle into a referenced kernel object pointer — the gateway every component crosses when validating access.


7. Key Kernel Structures

A handful of structures are the backbone of process, thread, and CPU state. Defenders and rootkit authors alike walk these every day.

StructureKey fields
EPROCESSUniqueProcessId, ActiveProcessLinks, Token, VadRoot, Peb, ImageFileName[15], ThreadListHead
ETHREADCid (CLIENT_ID), ThreadListEntry, Win32StartAddress, embedded KTHREAD
KTHREADHeader (DISPATCHER_HEADER), KernelStack, State, WaitIrql, Teb
KPCRPer-CPU; IRQL, IDT/GDT pointers, pointer to KPRCB
KPRCBCurrentThread, NextThread, IdleThread, DPC queue
KDPCDeferredRoutine, DeferredContext, DpcListEntry

ActiveProcessLinks is a doubly linked LIST_ENTRY chaining every EPROCESS. The Task Manager view of “all processes” is, at bottom, a walk of this list. That makes it a prime DKOM target: unlinking an EPROCESS hides the process from list-based enumeration while it continues to run and be scheduled — covered in Section 10.


8. The SSDT and System Call Dispatch

A user-mode SYSCALL instruction transfers Ring 3 → Ring 0 and lands in ntoskrnl!KiSystemCall64. The dispatcher indexes the System Service Dispatch Table via KeServiceDescriptorTable, which points at KiServiceTable (an array of service routine offsets) and KiArgumentTable (argument byte counts). GUI calls into win32k.sys route through the shadow table KeServiceDescriptorTableShadow.

Patching KiServiceTable so a service index points at attacker code is the classic SSDT hook, historically used by rootkits to intercept NtQuerySystemInformation, NtOpenProcess, and similar. On x64 this is exactly the kind of structure modification PatchGuard validates, so SSDT hooking is loud and largely obsolete on modern systems — but understanding the dispatch path is essential for reading both live disassembly and integrity-check telemetry.


Flow diagram of the Windows system call dispatch path from user-mode SYSCALL instruction through KiSystemCall64 and KeServiceDescriptorTable to the target Nt service routine
The SYSCALL instruction transfers execution to KiSystemCall64, which uses the service index to look up the target routine in KiServiceTable — the structure SSDT hooks manipulate and PatchGuard protects.

9. Live Analysis with WinDbg and Volatility

Load Microsoft symbols and the entire layout becomes navigable. List the core modules and dump structures directly:

0: kd> lm m nt              ; ntoskrnl base, range, symbols
0: kd> lm m hal             ; hal.dll base and range
0: kd> dt nt!_EPROCESS      ; full EPROCESS field layout
0: kd> !process 0 0         ; enumerate processes via ActiveProcessLinks
0: kd> !pcr 0               ; KPCR for CPU 0
0: kd> !prcb 0              ; KPRCB: CurrentThread / IdleThread
0: kd> dps nt!KeServiceDescriptorTable   ; SSDT pointer + service count
0: kd> !idt                 ; IDT vectors (HAL-programmed interrupt routing)

For dead-box memory forensics, Volatility 3 reconstructs the same view from a dump and is the natural cross-check against a possibly compromised live host:

# Enumerate processes and loaded kernel modules from a memory image.
vol -f memory.dmp windows.pslist
vol -f memory.dmp windows.modules

# psscan walks pool tags instead of ActiveProcessLinks; a process that
# appears in psscan but NOT in pslist is a candidate DKOM-unlinked process.
vol -f memory.dmp windows.psscan

A delta between windows.pslist (list-based) and windows.psscan (pool-scan-based) is a high-fidelity indicator of ActiveProcessLinks tampering.


10. Common Attacker Techniques

Kernel-core abuse turns on either modifying ntoskrnl structures from a loaded driver or exploiting a vulnerability to reach Ring 0 in the first place.

TechniqueDescription
SSDT hookingPatch KiServiceTable entries to intercept syscalls
DKOM unlinkingSplice an EPROCESS out of ActiveProcessLinks to hide a process
Kernel callback removalStrip PsSetCreateProcessNotifyRoutine entries to blind EDR
BYOVDLoad a vulnerable signed driver to gain a Ring 0 primitive
Kernel exploitationAbuse an ntoskrnl/HAL bug to escalate Ring 3 → Ring 0
In-memory image patchPatch ntoskrnl.exe code pages at runtime

A malicious driver is still loaded through the documented path — a Services registry key of Type = 1 followed by a load — which is exactly where detection begins. Bring-Your-Own-Vulnerable-Driver remains popular precisely because it sidesteps the need to find a fresh kernel bug.


Graph diagram showing attacker path from BYOVD through Ring 0 code execution branching into DKOM process unlinking, SSDT hooking, and callback removal all leading to hidden process or driver impact
BYOVD is the most common Ring 0 entry point; once there, attackers choose between DKOM, SSDT hooks, or callback removal to achieve persistence and evasion.

11. Defensive Strategies & Detection

Detection centers on driver loads, integrity events, and kernel structure cross-checks.

Sysmon Event IDNameRelevance
6Driver LoadedKernel driver load with Signed, Hashes, Signature fields
7Image LoadedModule loads in unusual contexts
13Registry Value SetNew Services driver entries

Pair Sysmon with Windows event sources: System Event ID 7045 (new kernel-mode service installed), Security Event ID 5038 (image hash invalid — DSE failure), and Event ID 6281 (page hash mismatch). The Microsoft-Windows-Kernel-Memory ETW provider surfaces pool allocations useful for hunting pool-based implants.

title: Suspicious Unsigned Kernel Driver Load
logsource:
  product: windows
  service: sysmon
detection:
  selection:
    EventID: 6
    Signed: 'false'
  filter_legit:
    ImageLoaded|startswith:
      - 'C:\Windows\System32\drivers\'
      - 'C:\Windows\System32\DriverStore\'
  condition: selection and not filter_legit
level: high
MechanismDescription
PatchGuard (KPP)Validates SSDT, IDT, GDT, KPCR, and kernel code; bug check 0x109 on tampering
Driver Signature Enforcementci.dll requires Authenticode-signed drivers
HVCIVTL1 enforces signed Ring 0 code; blunts BYOVD and runtime patching
Secure BootValidates the winload → ntoskrnl/hal chain in firmware

Operational hardening: enable HVCI (Core Isolation → Memory Integrity), confirm Secure Boot in msinfo32, audit SeLoadDriverPrivilege use, deploy the Microsoft Vulnerable Driver Blocklist (DriverSiPolicy.p7b), monitor HKLM\SYSTEM\CurrentControlSet\Services\ for new Type = 1 entries, and baseline loaded-module hashes against periodic WinPmem/Volatility snapshots.


12. MITRE ATT&CK Mapping

TechniqueMITRE IDDetection
RootkitT1014Volatility pslist/psscan delta; PatchGuard bug check 0x109
Kernel Modules and ExtensionsT1547.006Sysmon EID 6; Event ID 7045; Services key writes
Exploitation for Privilege EscalationT1068Crash telemetry, anomalous Ring 0 transitions
Impair DefensesT1562.001Missing kernel callbacks; EDR self-protection alerts
Process InjectionT1055Kernel KeStackAttachProcess/MmCopyVirtualMemory use
Modify System ImageT1601.001Code integrity Event ID 5038/6281; PatchGuard

13. Tools for Kernel Analysis

ToolDescriptionLink
WinDbgLive and dump kernel debugging, structure walksmicrosoft.com
Volatility 3Memory forensics, pslist/psscan/modulesvolatilityfoundation.org
WinPmemLive memory acquisitiongithub.com
Process HackerDriver and handle inspectionprocesshacker.sourceforge.io
SysmonDriver-load and registry telemetrysysinternals.com
sigcheckImage signature and hash verificationsysinternals.com
GhidraStatic analysis of drivers and ntoskrnlghidra-sre.org

14. Summary

  • HAL and ntoskrnl are the two Ring 0 binaries every other Windows component is built on — HAL abstracts hardware, ntoskrnl implements the kernel and Executive policy layers.
  • The kernel layer (Ke) supplies scheduling and synchronization; the Executive (Ob, Ps, Mm, Io, Se, Cm, Ex) builds managers on top, all arbitrated by IRQL that the HAL enforces in hardware.
  • Core structures — EPROCESS, ETHREAD, KPCR, the SSDT — are the backbone of process and CPU state and the prime targets for SSDT hooks, DKOM unlinking, and callback removal.
  • Detect kernel tampering via Sysmon Event ID 6, Event IDs 7045/5038/6281, and Volatility pslist-vs-psscan deltas; prevent it with HVCI, DSE, Secure Boot, and the vulnerable-driver blocklist.

Related Tutorials

References

Get new drops in your inbox

Windows internals, exploit dev, and red-team write-ups — no spam, unsubscribe anytime.