CRoemheld wrote:
If the entry point is a 64-bit one, for example in Linux with its 0xffffffff80100000 GVA, it would mean I also would need to setup the guests PML4 pagetable in the host. I was trying to avoid that by letting the guest setup its own PML4 pagetable, meaning the guest would need to follow its own startup routine, which means starting in real-mode, going into protected mode and setting up the 64-bit GDT and PML4 pagetable and then jump into the 64-bit kernel.
The Linux startup routine does not include those parts. It expects to start in 64-bit mode, with identity mapping for Linux itself, the boot parameters, the command line, and enough memory for Linux to set up its own page tables.
CRoemheld wrote:
And since the Linux kernel cannot work without making all the prerequisites such as a PML4 table, the 64-bit GDT and so on, jumping directly into the 64-bit kernel would not make any sense, because the host, or in this sense, me, would need to setup everything, which somewhat defies the understanding of what I have about Virtualization.
Linux expects a bootloader. Since you're trying to directly execute the Linux kernel in your VM, you must do the same things a bootloader would do.
CRoemheld wrote:
I was originally trying to pass an ISO into memory and read it, just as if I were about to run Ubuntu from an ISO in qemu. If qemu gets an ISO passed to, it would also let the Ubuntu startup routine work, meaning qemu does not directly jump into the kernel but start from the 16-bit real mode where all prerequisites are being made, switch to protected mode and finally to long mode and the 64-bit kernel.
QEMU doesn't do anything special to load the ISO, it simply provides an emulated disc drive with the ISO loaded as a virtual disc. The BIOS ROM inside QEMU will then perform the same boot process that real hardware does. All of those "prerequisites" are handled by the BIOS ROM and the bootloader in the ISO (probably GRUB).