Page MenuHomeFreeBSD

loader: fix multiboot loading on UEFI
ClosedPublic

Authored by royger on Aug 11 2021, 3:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Dec 9, 1:58 PM
Unknown Object (File)
Wed, Dec 4, 11:31 PM
Unknown Object (File)
Nov 16 2024, 11:04 PM
Unknown Object (File)
Nov 16 2024, 8:20 PM
Unknown Object (File)
Oct 13 2024, 12:02 AM
Unknown Object (File)
Oct 13 2024, 12:02 AM
Unknown Object (File)
Oct 13 2024, 12:01 AM
Unknown Object (File)
Oct 12 2024, 11:38 PM
Subscribers

Details

Summary

The Xen kernel has no symbols tables, so calling lookup_symbol against
it triggers the following Divide by Zero fault:

Loading Xen kernel...
/boot/xen data=0x2809c8+0x149638 |
!! X64 Exception Type - 00(#DE - Divide Error) CPU Apic ID - 00000000 !!

Fix lookup_symbol to prevent the #DE fault from happening if the
symbol table is not loaded and also fix loadfile_raw to mark multiboot
kernels as relocatable, since the only multiboot kernel supported is
Xen and was already unconditionally booted as relocatable.

Fixes: f75caed644a5 ('amd64 UEFI loader: stop copying staging area to 2M physical')

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 40997
Build 37886: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Aug 11 2021, 3:41 PM

Note that 'relocatable' means variyng not VA, but PA. Loader still maps the kernel at KERNBASE.

In D31507#710357, @kib wrote:

Note that 'relocatable' means variyng not VA, but PA. Loader still maps the kernel at KERNBASE.

Right. In the Xen case the kernel is started in protected mode with paging disabled, so it's only relocatable in the PA space, because there's no page table provided at entry point.

Thanks for the reviews.

This revision was automatically updated to reflect the committed changes.