-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dornerworks x64 VM patch #16
Conversation
58ea698
to
f4a922d
Compare
f4a922d
to
0f9286d
Compare
Is this the one that was on bitbucket? |
I think so, yeah. EDIT: No, nevermind, it's not. This is new. |
Ok will review then |
7be172e
to
6c21c8a
Compare
#ifdef CONFIG_ARCH_X86_64 | ||
vm_vmcs_init_64_bit_guest(vcpu); | ||
#else | ||
vm_vmcs_init_32_bit_guest(vcpu); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are example apps that run a 32bit guest on a 64 bit host. Is this no longer something that we will support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, just found out as well when fixing some builds. I need to make extra changes to the various repositories to allow 32-bit guest on 64-bit host.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have these changes been made?
What needs to happen to get this merged? |
@@ -4,6 +4,13 @@ | |||
* SPDX-License-Identifier: BSD-2-Clause | |||
*/ | |||
|
|||
/* Under release mode, this file will get built using -O3. Howerver on gcc 8.4, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a problem specific to GCC 8.4 or does it happen with newer versions and clang also? Such issues leave an odd feeling that there is an issue with the code (maybe alignment?) that I consider worth investigating. However, it should not be seen as a blocker for merging this as it temporarily fixes a problem.
I have created #75 to track this.
Seems it needs a rebase now. I have a few comments on the code quality, but have to leave it to other to comment on the x64 changes. |
@@ -368,15 +499,65 @@ uintptr_t vm_emulate_realmode(vm_vcpu_t *vcpu, uint8_t *instr_buf, | |||
case 0xa1: | |||
/* mov offset memory to eax */ | |||
instr++; | |||
#ifdef CONFIG_ARCH_X86_64 | |||
memcpy(&mem, instr, 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using sizeof(seL4_Word)/2
there is no need to duplicate the code. Might apply in other places also.
memcpy(&mem, instr, 4); | |
memcpy(&mem, instr, sizeof(seL4_Word)/2 ); |
6c21c8a
to
0f67bde
Compare
b86774f
to
ccb27a8
Compare
Update:
Future works: Current implementation for x64 support relies on the corresponding kernel implementation (see seL4/seL4#324), which does not support running both 32-bit VM guest and 64-bit VM guest on the same system. It will be ideal to implement this feature in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor changes can clean up some of the ifdefs. Otherwise, good to go.
This large commit combines a number of smaller commits in order to add 64-bit VM support to the VMM. The commits do the following: * Load elfs of the same architecture size * Support reading 64-bit vaddrs from elf files * Create initial address space based on guest architecture * Allow instruction decoding of 4-level paging scheme * Do not exit VMX state based on CR3 load/store in 64-bit mode * Use seL4_Word for vmcs and user context fields * Handle additional general purpose registers * Handle 64-bit MSRs * Configure 64-bit guests to boot in long mode * Let guest know about 64-bit hardware features in 64-bit mode * Add FADT and DSDT tables * Track guest state for additional 64-bit registers * Add new function to print 64-bit guest context * Properly emulate 64-bit trampoline code * Define access rights macros for vmcs initialization * Hardcode FADT table information * Set an initial stack pointer before running guest * Handle fetching cross-page instructions * Add additional x86 instruction prefixes CCDC-GVSC DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4481. Co-authored-by: Chris Guikema <[email protected]> Signed-off-by: Damon Lee <[email protected]>
Signed-off-by: Damon Lee <[email protected]>
As the comment in the file explains, optimisation level -O3 on gcc 8.4 is too aggressive and causes issues for the guest VM. The problem isn't limited to a single function or group of functions but rather the entire file for some reason that requires extra investigation (but is not worth the time to do so). Signed-off-by: Damon Lee <[email protected]>
Previously, the physical address of the ACPI tables were being tracked. This caused a Linux error while parsing the ACPI tables. Since Linux does not have access to those memory regions, they would appear empty, causing an Invalid Table Length bug print. By tracking the virtual address that Linux expects and placing the vaddr into the ACPI tables, Linux can parse the tables properly. Signed-off-by: Chris Guikema <[email protected]>
switch from CONFIG_ARCH_X86_64 to CONFIG_X86_64_VTX_64BIT_GUESTS to allow 32 bit guests on 64 bit hosts; fix print format for seL4_Word; misc improvement. Signed-off-by: Jingyao Zhou <[email protected]>
Signed-off-by: Jingyao Zhou <[email protected]>
ccb27a8
to
dd13a24
Compare
This PR contains commits from Dornerworks' x64 VM patches for the VMM: https://github.com/dornerworks/camkes-vm/commits/open_source_release. Parts of Dornerworks' patches have been updated and/or changed slightly to match the newer VMM structure compared to what the patches originally targeted.