I am currently trying to run vmlinux (made by "make tinyconfig" from source repository) in my OS using Intel VT-x. However I still fail to understand how to appropiately set the guest code segment base and guest instruction pointer.
The vmlinux ELF is currently loaded into memory by GRUB as a module:
Code: Select all
menuentry "cr0S" {
multiboot /boot/cr0S-bootstrap.bin
module /boot/cr0S-kernel.bin "cr0S"
module /boot/vmlinux.bin "vmlinux"
}
Now some other configurations are being made, and I ultimately initialize VMX inside the kernel. There I used the following settings for the guest code segment:
- - Code segment selector: 0xf000
- Code segment base: 0xffff0000
- Code segment limit: 0x0000ffff
However, I also use the Extended Page Table translation mechanism to resolve GPAs to HPAs. How do I correctly map the addresses so that I can set the guest instruction pointer to point to the vmlinux entry point? Because with a code segment base of 0xffff0000, I fail to understand how to choose an instruction pointer which points to an entry point of vmlinux located at 0x003C5000 in physical memory. Or how to map the addresses in the EPT to get the correct address.
I hope someone can explain and help me through my struggle.