Runtime phase là gì?

Giải thích giai đoạn runtime sau ExitBootServices và vì sao UEFI Runtime Services vẫn còn quan trọng khi OS đã chạy.

2 phút đọc
Firmware Flow cover

Runtime phase bắt đầu sau khi OS loader gọi ExitBootServices() thành công và kernel bắt đầu kiểm soát hệ thống. Từ góc nhìn firmware, đây là lúc phần lớn boot-time driver đã kết thúc nhiệm vụ. Nhưng một số service vẫn phải sống tiếp để OS gọi được: variable, time, reset và capsule/update tùy platform.

Điểm dễ nhầm: runtime không có nghĩa firmware vẫn điều khiển máy như trước. OS đã nắm quyền. Firmware chỉ để lại một số entry point được map đúng cách.

01 EBS

ExitBootServices

Boot Services biến mất.

02 MAP

Runtime mapping

OS map runtime region theo virtual address.

03 CALL

OS gọi Runtime Services

GetVariable/SetVariable/GetTime/ResetSystem.

04 LOCK

Security policy

Nhiều biến/region đã bị lock sau EndOfDxe/SmmReadyToLock.

Runtime khác boot-time ở đâu?

Mục Giá trị Ghi chú
Boot Services Chỉ trước ExitBootServices AllocatePool, LocateProtocol, LoadImage, ConnectController...
Runtime Services Còn sau ExitBootServices GetVariable, SetVariable, GetTime, ResetSystem...
Memory Cần runtime attribute OS phải biết region nào cần giữ và map.
Security Bị policy kiểm soát mạnh Secure Boot, authenticated variable, SMM variable driver.

Ví dụ thực tế: OS đổi boot order

Trên Linux, efibootmgr có thể gọi UEFI Runtime Variable Services để đọc/sửa BootOrder. Nếu SetVariable() fail, nguyên nhân không chỉ là tool lỗi. Có thể variable store đầy, authenticated variable policy chặn, hoặc SMM variable driver/SPI write protection không cho ghi.

OS tool

Runtime SetVariable()

Firmware runtime thunk / SMM variable service

Variable Store trong SPI Flash

Khi runtime variable fail

Bài liên quan

Thấy nội dung này hữu ích?

Lưu lại hoặc chia sẻ cho người cũng đang học firmware, BIOS/UEFI và embedded systems.

Nội dung liên quan

Một số bài viết, ghi chú hoặc project có liên quan đến nội dung bạn vừa đọc.

Biến note thành bài viết hoàn chỉnh

Notes là nơi ghi nhanh khái niệm.