-
-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aarch64: move kernel to 63rd GB of virtual memory
This patch modifies the aarch64 port to move the kernel from the 2nd to 63rd GB or virtual memory. It also adjusts the early preboot and boot assembly to dynamically adjust the early phys/virt mapping tables to make it work regardless where in physical memory the kernel and DTB is loaded. This allows us to use the same kernel binary on QEMU and Firecracker without having to adjust relevant variables in the makefile and rebuild it to accomodate the fact that each hypervisor would load loader.img in different area of physical memory. Prior to this patch the kernel would be mapped 1:1 in the first 4 GB of phys/virt memory. In essence, this patch enhances the preboot.S to dynamically identify location of start_elf to jump to. Then it modifies boot.S to dynamically calculate the offset between where kernel is located in virtual memory and where it is loaded in physical memory and then adjust the 63rd GB of early boot mapping tables accordingly. Finally it also adjust the virt/phys and phys/virt translation functions in core/mmu.cc and other aspects in elf.cc and makefile. After the patch the virtual memory layout would look like this in QEMU: vaddr paddr size perm memattr name 8000000 8000000 10000 rwxp dev gic_dist 8010000 8010000 10000 rwxp dev gic_cpu 9000000 9000000 1000 rwxp dev pl011 9010000 9010000 1000 rwxp dev pl031 10000000 10000000 2eff0000 rwxp dev pci_mem 3eff0000 3eff0000 10000 rwxp dev pci_io fc0000000 40000000 84e000 rwxp normal kernel 4010000000 4010000000 10000000 rwxp dev pci_cfg ffff80000a000000 a000000 200 rwxp normal virtio_mmio_cfg ffff80000a000200 a000200 200 rwxp normal virtio_mmio_cfg ffff80000a000400 a000400 200 rwxp normal virtio_mmio_cfg ffff80000a000600 a000600 200 rwxp normal virtio_mmio_cfg ffff80000a000800 a000800 200 rwxp normal virtio_mmio_cfg ffff80000a000a00 a000a00 200 rwxp normal virtio_mmio_cfg ffff80000a000c00 a000c00 200 rwxp normal virtio_mmio_cfg ffff80000a000e00 a000e00 200 rwxp normal virtio_mmio_cfg ffff80004084e000 4084e000 7f7b2000 rwxp normal main ffff90004084e000 4084e000 7f7b2000 rwxp normal page ffffa0004084e000 4084e000 7f7b2000 rwxp normal mempool Fixes #1087 Changes since V1: removed some code from loader.cc that got acidentally added as part of the initial version of the patch. Signed-off-by: Waldemar Kozaczuk <[email protected]>
- Loading branch information
Showing
11 changed files
with
213 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.