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)
Tue, Sep 24, 5:13 AM
Unknown Object (File)
Tue, Sep 17, 8:54 PM
Unknown Object (File)
Tue, Sep 17, 7:24 AM
Unknown Object (File)
Mon, Sep 16, 11:48 PM
Unknown Object (File)
Mon, Sep 16, 8:14 AM
Unknown Object (File)
Sun, Sep 15, 10:05 PM
Unknown Object (File)
Mon, Sep 9, 2:24 AM
Unknown Object (File)
Wed, Sep 4, 10:22 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.