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)
Thu, Apr 11, 1:52 PM
Unknown Object (File)
Thu, Apr 11, 1:52 PM
Unknown Object (File)
Mar 14 2024, 3:15 PM
Unknown Object (File)
Feb 22 2024, 1:38 PM
Unknown Object (File)
Jan 23 2024, 3:11 PM
Unknown Object (File)
Jan 7 2024, 12:24 AM
Unknown Object (File)
Dec 26 2023, 11:21 AM
Unknown Object (File)
Dec 20 2023, 6:48 AM
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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.