SlideShare a Scribd company logo
1
Mixing it up with EFI mixed mode
Matt Fleming, SSG/OTC
2
Debian 8 “Jessie” release
“Support for mixed-mode EFI systems like the Intel Bay
Trail: a 64-bit platform crippled with a 32-bit EFI
firmware.”
3
What is EFI mixed mode?
• Fat 64-bit OS on small 32-bit EFI firmware
• Implemented in the x86 kernel
• Translates x86-64 ABI to i386
• Utilises full capabilities of CPU
• Increases virtual address space
4
How does it work?
2 Phases
5
How does it work?
2 Phases
Boot transition Runtime thunking
6
Boot transition
7
Boot transition – Traditional entry point
64-bit kernel image
efi64_stub_entry
• Boot loaders always enter via native entry point
• Legacy +512 bytes for 64-bit loaders
64-bit boot loader
bootx64.efi
8
Boot transition – Mixed mode entry points
64-bit kernel image
efi64_stub_entry
efi32_stub_entry
• 2 entry points are available
• No changes required to Linux boot loaders
• All magic happens in the kernel
• 1 kernel image for both scenarios
32-bit/64-bit boot loaders
bootia32.efi
512bytes
bootx64.efi
9
Runtime transition
(Thunking)
10
Thunking at runtime
• Dedicated kernel page table
• UEFI regions are mapped with VA == PA
• Physical addresses are passed to UEFI
• Luckily never seen address above 4GB
0xffffffffffffffff
0x0
0xffffffff
Virtual AddressesPhysical Addresses
Kernel text/data
11
Thunking at runtime
0x000000fde3c190
1. Convert pointers to physical address
0xffff8800fde3c190
2. Truncate to 32-bits
12
Thunking at runtime
0xfde3c190
3. Push arguments onto stack (convert ABI)
4. Switch to 32-bit CPU mode and call UEFI
0x000000340fdece
0xfde45080
0x000000fde3c190
Stack
0x340fdece
Registers
13
Development gotchas
• “unsigned long” no longer represents natural pointer size
• Some UEFI runtime services not supported (UpdateCapsule())
• If memory existed above 4GB: kaboom!
14
Supported boot loaders
• Grub2
• Used by Debian, Fedora, Ubuntu
• Efilinux
• Kernel support developed using efilinux
• rEFInd
• Support unconfirmed
• Syslinux
15
A quick word on gummiboot
• Gummiboot is an UEFI application loader not a boot loader
• It has no understanding of the different Linux kernel entry points
• It simply uses the UEFI boot services to load and run applications
• Linux kernel masquerades as PE/COFF application
16
Ingredients for rolling your own solution
• 32-bit boot loader from the supported list
• Drop it in EFI System Partition (ESP) at EFIBOOTBOOTIA32.EFI
• Build your x86 kernel with the following options
• CONFIG_EFI_STUB
• CONFIG_EFI_MIXED
• Profit!
17
Q & A

More Related Content

What's hot

A Science Project: Building a sound card based on the Covox Speech Thing
A Science Project: Building a sound card based on the Covox Speech ThingA Science Project: Building a sound card based on the Covox Speech Thing
A Science Project: Building a sound card based on the Covox Speech Thing
yeokm1
 
Pentium processor
Pentium processorPentium processor
Pentium processor
salmanjilani
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
Siji Sunny
 
Os2
Os2Os2
Description of GRUB 2
Description of GRUB 2Description of GRUB 2
Description of GRUB 2
iamumr
 
Linux booting procedure
Linux booting procedureLinux booting procedure
Linux booting procedureDhaval Kaneria
 
Grub
GrubGrub
Linux booting Process
Linux booting ProcessLinux booting Process
Linux booting Process
Gaurav Sharma
 
bccon-2014 adm04 ibm-domino-64bit-all-you-need-to-know
bccon-2014 adm04 ibm-domino-64bit-all-you-need-to-knowbccon-2014 adm04 ibm-domino-64bit-all-you-need-to-know
bccon-2014 adm04 ibm-domino-64bit-all-you-need-to-know
ICS User Group
 
Linux booting sequence
Linux booting sequenceLinux booting sequence
Linux booting sequence
kuldeep singh shishodia
 
Linux kernel booting
Linux kernel bootingLinux kernel booting
Linux kernel booting
Ramin Farajpour Cami
 
Simple Sheet for resource calculation of openstack compute node
Simple Sheet for resource calculation of openstack compute nodeSimple Sheet for resource calculation of openstack compute node
Simple Sheet for resource calculation of openstack compute node
Asmaa Ibrahim
 
Make own you kernel os
Make own you kernel osMake own you kernel os
Make own you kernel os
Ramin Farajpour Cami
 
Determine 64 or 32 bit unix kernel and hw
Determine  64 or 32 bit unix kernel and hwDetermine  64 or 32 bit unix kernel and hw
Determine 64 or 32 bit unix kernel and hw
Muqthiyar Pasha
 
Linux booting process
Linux booting processLinux booting process
Linux booting process
Prashant Hegde
 
QEMU in Cross building
QEMU in Cross buildingQEMU in Cross building
QEMU in Cross building
Tetsuyuki Kobayashi
 
MySQL on ZFS
MySQL on ZFSMySQL on ZFS
MySQL on ZFS
Gordan Bobic
 
OpenIO Summit'17 - ARM, Object Storage and more
OpenIO Summit'17 - ARM, Object Storage and moreOpenIO Summit'17 - ARM, Object Storage and more
OpenIO Summit'17 - ARM, Object Storage and more
OpenIO Object Storage
 
Linux kernel development
Linux kernel developmentLinux kernel development
Linux kernel development
Ramin Farajpour Cami
 
Yum server ( FTP Server )
Yum server ( FTP Server ) Yum server ( FTP Server )
Yum server ( FTP Server )
MOHSIN HASAN
 

What's hot (20)

A Science Project: Building a sound card based on the Covox Speech Thing
A Science Project: Building a sound card based on the Covox Speech ThingA Science Project: Building a sound card based on the Covox Speech Thing
A Science Project: Building a sound card based on the Covox Speech Thing
 
Pentium processor
Pentium processorPentium processor
Pentium processor
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Os2
Os2Os2
Os2
 
Description of GRUB 2
Description of GRUB 2Description of GRUB 2
Description of GRUB 2
 
Linux booting procedure
Linux booting procedureLinux booting procedure
Linux booting procedure
 
Grub
GrubGrub
Grub
 
Linux booting Process
Linux booting ProcessLinux booting Process
Linux booting Process
 
bccon-2014 adm04 ibm-domino-64bit-all-you-need-to-know
bccon-2014 adm04 ibm-domino-64bit-all-you-need-to-knowbccon-2014 adm04 ibm-domino-64bit-all-you-need-to-know
bccon-2014 adm04 ibm-domino-64bit-all-you-need-to-know
 
Linux booting sequence
Linux booting sequenceLinux booting sequence
Linux booting sequence
 
Linux kernel booting
Linux kernel bootingLinux kernel booting
Linux kernel booting
 
Simple Sheet for resource calculation of openstack compute node
Simple Sheet for resource calculation of openstack compute nodeSimple Sheet for resource calculation of openstack compute node
Simple Sheet for resource calculation of openstack compute node
 
Make own you kernel os
Make own you kernel osMake own you kernel os
Make own you kernel os
 
Determine 64 or 32 bit unix kernel and hw
Determine  64 or 32 bit unix kernel and hwDetermine  64 or 32 bit unix kernel and hw
Determine 64 or 32 bit unix kernel and hw
 
Linux booting process
Linux booting processLinux booting process
Linux booting process
 
QEMU in Cross building
QEMU in Cross buildingQEMU in Cross building
QEMU in Cross building
 
MySQL on ZFS
MySQL on ZFSMySQL on ZFS
MySQL on ZFS
 
OpenIO Summit'17 - ARM, Object Storage and more
OpenIO Summit'17 - ARM, Object Storage and moreOpenIO Summit'17 - ARM, Object Storage and more
OpenIO Summit'17 - ARM, Object Storage and more
 
Linux kernel development
Linux kernel developmentLinux kernel development
Linux kernel development
 
Yum server ( FTP Server )
Yum server ( FTP Server ) Yum server ( FTP Server )
Yum server ( FTP Server )
 

Similar to Mixing it up with EFI mixed mode

BlueHat v18 || First strontium uefi rootkit unveiled
BlueHat v18 || First strontium uefi rootkit unveiledBlueHat v18 || First strontium uefi rootkit unveiled
BlueHat v18 || First strontium uefi rootkit unveiled
BlueHat Security Conference
 
Unified Extensible Firmware Interface (UEFI)
Unified Extensible Firmware Interface (UEFI)Unified Extensible Firmware Interface (UEFI)
Unified Extensible Firmware Interface (UEFI)
k33a
 
Raj Amrutiya PPT.pptx
Raj Amrutiya PPT.pptxRaj Amrutiya PPT.pptx
Raj Amrutiya PPT.pptx
RajAmrutiya1
 
Boot process: BIOS vs UEFI
Boot process: BIOS vs UEFIBoot process: BIOS vs UEFI
Boot process: BIOS vs UEFI
Alea Soluciones, S.L.
 
Linux booting process, Dual booting, Components involved
Linux booting process, Dual booting, Components involvedLinux booting process, Dual booting, Components involved
Linux booting process, Dual booting, Components involved
divyammo
 
Emulating Game Boy in Java
Emulating Game Boy in JavaEmulating Game Boy in Java
Emulating Game Boy in Java
Tomasz Rękawek
 
XPDS14 - Xen in EFI World - Daniel Kiper, Oracle
XPDS14 - Xen in EFI World - Daniel Kiper, OracleXPDS14 - Xen in EFI World - Daniel Kiper, Oracle
XPDS14 - Xen in EFI World - Daniel Kiper, Oracle
The Linux Foundation
 
1 study of motherboard
1 study of motherboard1 study of motherboard
1 study of motherboard
Ankit Dubey
 
3 hardware
3 hardware3 hardware
Getting started with LinuxBoot Firmware on AArch64 Server
Getting started with LinuxBoot Firmware on AArch64 Server Getting started with LinuxBoot Firmware on AArch64 Server
Getting started with LinuxBoot Firmware on AArch64 Server
Naohiro Tamura
 
DEF CON 27 - JEFF DILEO - evil e bpf in depth
DEF CON 27 - JEFF DILEO - evil e bpf in depthDEF CON 27 - JEFF DILEO - evil e bpf in depth
DEF CON 27 - JEFF DILEO - evil e bpf in depth
Felipe Prado
 
What's going on with SPI
What's going on with SPI What's going on with SPI
What's going on with SPI
Mark Brown
 
LCA2018 Open Hardware MiniConference: LoliBot Software
LCA2018 Open Hardware MiniConference: LoliBot SoftwareLCA2018 Open Hardware MiniConference: LoliBot Software
LCA2018 Open Hardware MiniConference: LoliBot Software
Andy Gelme
 
BIOS__Power-On-Self-Test.pptx
BIOS__Power-On-Self-Test.pptxBIOS__Power-On-Self-Test.pptx
BIOS__Power-On-Self-Test.pptx
SamiWhoo
 
MM-4105, Realtime 4K HDR Decoding with GPU ACES, by Gary Demos
MM-4105, Realtime 4K HDR Decoding with GPU ACES, by Gary DemosMM-4105, Realtime 4K HDR Decoding with GPU ACES, by Gary Demos
MM-4105, Realtime 4K HDR Decoding with GPU ACES, by Gary Demos
AMD Developer Central
 
Pharo 64bits
Pharo 64bitsPharo 64bits
Pharo 64bits
Pharo
 
Signature verification of hibernate snapshot
Signature verification of hibernate snapshotSignature verification of hibernate snapshot
Signature verification of hibernate snapshot
joeylikernel
 
02-OS-review.pptx
02-OS-review.pptx02-OS-review.pptx
02-OS-review.pptx
TrongMinhHoang1
 

Similar to Mixing it up with EFI mixed mode (20)

BlueHat v18 || First strontium uefi rootkit unveiled
BlueHat v18 || First strontium uefi rootkit unveiledBlueHat v18 || First strontium uefi rootkit unveiled
BlueHat v18 || First strontium uefi rootkit unveiled
 
Unified Extensible Firmware Interface (UEFI)
Unified Extensible Firmware Interface (UEFI)Unified Extensible Firmware Interface (UEFI)
Unified Extensible Firmware Interface (UEFI)
 
Raj Amrutiya PPT.pptx
Raj Amrutiya PPT.pptxRaj Amrutiya PPT.pptx
Raj Amrutiya PPT.pptx
 
Boot process: BIOS vs UEFI
Boot process: BIOS vs UEFIBoot process: BIOS vs UEFI
Boot process: BIOS vs UEFI
 
Linux booting process, Dual booting, Components involved
Linux booting process, Dual booting, Components involvedLinux booting process, Dual booting, Components involved
Linux booting process, Dual booting, Components involved
 
Emulating Game Boy in Java
Emulating Game Boy in JavaEmulating Game Boy in Java
Emulating Game Boy in Java
 
XPDS14 - Xen in EFI World - Daniel Kiper, Oracle
XPDS14 - Xen in EFI World - Daniel Kiper, OracleXPDS14 - Xen in EFI World - Daniel Kiper, Oracle
XPDS14 - Xen in EFI World - Daniel Kiper, Oracle
 
1 study of motherboard
1 study of motherboard1 study of motherboard
1 study of motherboard
 
3 hardware
3 hardware3 hardware
3 hardware
 
Getting started with LinuxBoot Firmware on AArch64 Server
Getting started with LinuxBoot Firmware on AArch64 Server Getting started with LinuxBoot Firmware on AArch64 Server
Getting started with LinuxBoot Firmware on AArch64 Server
 
Radius
RadiusRadius
Radius
 
DEF CON 27 - JEFF DILEO - evil e bpf in depth
DEF CON 27 - JEFF DILEO - evil e bpf in depthDEF CON 27 - JEFF DILEO - evil e bpf in depth
DEF CON 27 - JEFF DILEO - evil e bpf in depth
 
What's going on with SPI
What's going on with SPI What's going on with SPI
What's going on with SPI
 
LCA2018 Open Hardware MiniConference: LoliBot Software
LCA2018 Open Hardware MiniConference: LoliBot SoftwareLCA2018 Open Hardware MiniConference: LoliBot Software
LCA2018 Open Hardware MiniConference: LoliBot Software
 
Chapter5ccna
Chapter5ccnaChapter5ccna
Chapter5ccna
 
BIOS__Power-On-Self-Test.pptx
BIOS__Power-On-Self-Test.pptxBIOS__Power-On-Self-Test.pptx
BIOS__Power-On-Self-Test.pptx
 
MM-4105, Realtime 4K HDR Decoding with GPU ACES, by Gary Demos
MM-4105, Realtime 4K HDR Decoding with GPU ACES, by Gary DemosMM-4105, Realtime 4K HDR Decoding with GPU ACES, by Gary Demos
MM-4105, Realtime 4K HDR Decoding with GPU ACES, by Gary Demos
 
Pharo 64bits
Pharo 64bitsPharo 64bits
Pharo 64bits
 
Signature verification of hibernate snapshot
Signature verification of hibernate snapshotSignature verification of hibernate snapshot
Signature verification of hibernate snapshot
 
02-OS-review.pptx
02-OS-review.pptx02-OS-review.pptx
02-OS-review.pptx
 

Recently uploaded

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Yara Milbes
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 

Recently uploaded (20)

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi ArabiaTop 7 Unique WhatsApp API Benefits | Saudi Arabia
Top 7 Unique WhatsApp API Benefits | Saudi Arabia
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 

Mixing it up with EFI mixed mode

  • 1. 1 Mixing it up with EFI mixed mode Matt Fleming, SSG/OTC
  • 2. 2 Debian 8 “Jessie” release “Support for mixed-mode EFI systems like the Intel Bay Trail: a 64-bit platform crippled with a 32-bit EFI firmware.”
  • 3. 3 What is EFI mixed mode? • Fat 64-bit OS on small 32-bit EFI firmware • Implemented in the x86 kernel • Translates x86-64 ABI to i386 • Utilises full capabilities of CPU • Increases virtual address space
  • 4. 4 How does it work? 2 Phases
  • 5. 5 How does it work? 2 Phases Boot transition Runtime thunking
  • 7. 7 Boot transition – Traditional entry point 64-bit kernel image efi64_stub_entry • Boot loaders always enter via native entry point • Legacy +512 bytes for 64-bit loaders 64-bit boot loader bootx64.efi
  • 8. 8 Boot transition – Mixed mode entry points 64-bit kernel image efi64_stub_entry efi32_stub_entry • 2 entry points are available • No changes required to Linux boot loaders • All magic happens in the kernel • 1 kernel image for both scenarios 32-bit/64-bit boot loaders bootia32.efi 512bytes bootx64.efi
  • 10. 10 Thunking at runtime • Dedicated kernel page table • UEFI regions are mapped with VA == PA • Physical addresses are passed to UEFI • Luckily never seen address above 4GB 0xffffffffffffffff 0x0 0xffffffff Virtual AddressesPhysical Addresses Kernel text/data
  • 11. 11 Thunking at runtime 0x000000fde3c190 1. Convert pointers to physical address 0xffff8800fde3c190 2. Truncate to 32-bits
  • 12. 12 Thunking at runtime 0xfde3c190 3. Push arguments onto stack (convert ABI) 4. Switch to 32-bit CPU mode and call UEFI 0x000000340fdece 0xfde45080 0x000000fde3c190 Stack 0x340fdece Registers
  • 13. 13 Development gotchas • “unsigned long” no longer represents natural pointer size • Some UEFI runtime services not supported (UpdateCapsule()) • If memory existed above 4GB: kaboom!
  • 14. 14 Supported boot loaders • Grub2 • Used by Debian, Fedora, Ubuntu • Efilinux • Kernel support developed using efilinux • rEFInd • Support unconfirmed • Syslinux
  • 15. 15 A quick word on gummiboot • Gummiboot is an UEFI application loader not a boot loader • It has no understanding of the different Linux kernel entry points • It simply uses the UEFI boot services to load and run applications • Linux kernel masquerades as PE/COFF application
  • 16. 16 Ingredients for rolling your own solution • 32-bit boot loader from the supported list • Drop it in EFI System Partition (ESP) at EFIBOOTBOOTIA32.EFI • Build your x86 kernel with the following options • CONFIG_EFI_STUB • CONFIG_EFI_MIXED • Profit!