Use the module pointer to find the address we need to map to in the early

arm64 boot sequence. This will be a virtual address in the kernel space
after the kernel and any modules loaded by loader so we can use this to
find the size of the kernel + modules. We can then add on a level 2 page for
the module data and round up the size to be aligned to a level 2 page.

This allows more than 8 MiB of modules to be loaded by loader, e.g. zfs.ko
and opensolaris.ko.

Reported by:	Shawn Webb
MFC after:	1 week
Sponsored by:	DARPA, AFRL
This commit is contained in:
Andrew Turner 2017-12-04 11:25:34 +00:00
parent 5be9377857
commit 78f23de54c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326525

View File

@ -352,13 +352,13 @@ create_pagetables:
/* Find the size of the kernel */
mov x6, #(KERNBASE)
ldr x7, .Lend
/* Find the end - begin */
sub x8, x7, x6
/* Find modulep - begin */
sub x8, x0, x6
/* Add a 2MiB page for the module data and round up */
ldr x7, =(2 * L2_SIZE - 1)
add x8, x8, x7
/* Get the number of l2 pages to allocate, rounded down */
lsr x10, x8, #(L2_SHIFT)
/* Add 8 MiB for any rounding above and the module data */
add x10, x10, #4
/* Create the kernel space L2 table */
mov x6, x26