Windows Boot Environment, Slides of Architecture

Loads the Windows boot applications. OS loader, Resume loader, memory tester. Display boot menu and handles user to select. Loads the BCD store to ...

Typology: Slides

2022/2023

Uploaded on 02/28/2023

janeka
janeka 🇺🇸

4.1

(15)

260 documents

1 / 36

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Murali Ravirala
Kernel Platform Architecture Team
Microsoft
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24

Partial preview of the text

Download Windows Boot Environment and more Slides Architecture in PDF only on Docsity!

Murali Ravirala

Kernel Platform Architecture Team

Microsoft

Agenda

 High-level description of Windows boot process  Roles of different components involved  Windows UEFI services usage  Firmware Implementation points

Typical Boot flow

UEFI Firmware

UEFI Boot Manager

Windows Boot Manager (bootmgfw.efi)

Windows OS Loader (winload.efi)

Kernel (ntoskrnl.exe)

Performs CPU and Chipset initialization, load drivers etc.

Loads UEFI device drivers (based on NVRAM DriverXxx variable), loads boot application

Loads Windows OS loader selected by user

Loads the Windows OS, calls ExitBootServices()

Boot Flow Screens

Windows Boot Manager

Windows OS Loader OS

Boot Configuration Data (BCD) store

 Stores configuration information required to boot  Replaces legacy boot.ini (BIOS) and efinvr.exe (on Itanium)  BCD is a container for BCD objects  Each boot application is represented by a BCD object  Object are identifed by GUIDs or aliases ({bootmgr}, {default})  BCD object is a container of BCD elements  Elements contain configuration setting for a boot application  Located at (ESP)\EFI\Microsoft\Boot\BCD

Displaying Boot menu

 Boot manager looks under

{bootmgr} BCD object

 Reads “displayorder” and “toolsdisplayorder” elements

Windows OS Loader

 Load all files needed by the kernel to initialize  Setup the execution environment for the kernel  Terminate boot services  Transfer control to the kernel

Loading OS binaries

 What files are loaded?  Kernel + other kernel components required for initialization (ntoskrnl.exe, hal.dll, kdcom, …)  All drivers marked as boot start  The system hive  Boot entry provides the path to the OS files  BCD entry has “osdevice” and “systemroot” elements

Virtual Addresses for Runtime

Services

 OS calls runtime services in virtual mode  OS loader creates virtual address mappings for all runtime regions  Informs the firmware of virtual address mappings  SetVirtualAddressMap service is used  Invoked after calling ExitBootServices()

Execution context: Bootmgr

 Execution context includes:  GDT, IDT, stack and page table mappings  Boot manager executes in firmware context  GDT, IDT and stack initialized by firmware  Page tables created by firmware  Firmware established mapping of physical memory (identity mapping)

Resume loader

 Restores OS context from the hibernation file
 Hibernation file (hiber file)

 Contains state of physical memory and processors  Created by kernel before putting system in S

 All pages that were in use by OS must be restored

 Runtime memory map must not conflict with OS memory map  Otherwise OS or firmware may corrupt each other’s data

S4 Resume requirements

 Firmware must ensure that physical memory is
consistent across S4 sleep transitions

 OS physical memory during boot must be available to OS during resume  Required to restore physical memory across S transition  Runtime firmware memory must be consistent in size and location between boot and resume  Windows will fail to resume from S4 if these conditions are not satisfied

Windows Boot Timeline Detail

Windows Boot Manager

Windows OS Loader

Kernel

Set Video Mode [GOP.SetMode()] Load BCD Store [BLOCK_IO. ReadBlocks()] Display Boot menu [Direct write to frame buffer] Load winload.efi [BLOCK_IO. ReadBlocks()] Setup loader context + Jump to OS loader

Switch to alternate paging context Snapshot FW memory map [for S4 consistency check] Read OS binaries [BLOCK_IO. ReadBlocks()] Prepare for runtime virtualization (snapshot FW runtime memory map, allocate virtual regions) Setup OS environment ExitBootServices() SetVirtualAddressMap() to virtualize runtime services

Draw initial progress bar (write to frame buffer) Read/Write NVRAM entries

BCD store and NVRAM

 BCD abstracts all the information in the NVRAM  Provides consistent interfaces to manipulate boot entries  NVRAM boot entries are cached in the BCD store

 BCD has 1:1 mappings for some UEFI global variables  BootOrder  “displayorder”  Timeout  “timeout”  BootNext  “bootsequence”  All variables encapsulated by {fwbootmgr} object