Commit Graph

8 Commits

Author SHA1 Message Date
Adrian-Ken Rueegsegger
1db8694fd0 vbox: Sync hw_x86_64_muen subject state with Muen SK
VM-exit interruption info was dropped and Vbox only needs guest CR3
value for guest-physical memory translation but does not actually change
it since the VM is running in unrestricted guest mode.
2017-05-31 13:16:21 +02:00
Alexander Boettcher
a5c70244bf vbox4/5: fix tr TSS_BUSY_FLAG handling
Fixes #2337
2017-03-24 16:19:58 +01:00
Norman Feske
29b8d609c9 Adjust file headers to refer to the AGPLv3 2017-02-28 12:59:29 +01:00
Alexander Boettcher
0a32fcf4e0 vbox: avoid using deprecated env()
Issue #1987
2017-01-13 13:07:08 +01:00
Alexander Boettcher
a8495a0dfe vbox: use emt thread names
- eases debugging on smp setups

Issue #2110
2016-10-21 12:39:31 +02:00
Norman Feske
17c79a9e23 base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.

While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).

To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.

Issue #1987
2016-08-29 17:27:10 +02:00
Adrian-Ken Rueegsegger
6d28ea1c5c vbox: Add platform-specific setup machine hook
Add call to genode_setup_machine prior to machine registration in
frontend machine setup code. This enables platform-specific adjustments
to the machine instance.

The new function is used on hw_x86_64_muen to clamp the processor count
to 1 as multiple virtual CPUs are not supported on this platform.

Issue #2016
2016-07-06 13:02:56 +02:00
Adrian-Ken Rueegsegger
e3fbeeb25e vbox: Implement hwaccl support for Muen
* Implement VMMR0_DO_VMMR0_INIT operation for Muen

   - Indicate VT-x support
   - Enable unrestricted guest mode
   - Set CR[0|4] mask to enable masking of guest CR0.[NE,NW,CD] and
     CR4.VMXE bits.

 * Implement VMMR0_DO_GVMM_CREATE_VM on Muen

   Return error if trying to create SMP VM as VMs with multiple CPUs are
   currently not supported on hw_x86_64_muen.

 * Add Muen-specific Mem_region type

   On hw_x86_64_muen the guest memory layout is static, thus regions are
   handed out from an array of memory regions.

   Use sinfo API to calculate the base address of the VM RAM physical
   0x0 region. This allows to dynamically modify the VM RAM size by
   adjusting the Muen policy and Genode vbox files accordingly.

   Zeroize all memory regions apart from VM Ram since Virtualbox expects
   these regions to be cleared.

 * Add Muen subject state struct

   The subject state encompasses the guest VM machine state that is
   transfered between Virtualbox and hardware accelerated execution on
   Muen.

 * Add Muen-specific Vm_handler class
 * Use Vm_handler to run VM
 * Instruct recompiler to flush its code cache
 * Copy the Muen subject state to/from the Vbox PCPUMCTX.
 * Use the VM interruptibility state to inform the recompiler whether
   interrupts are currently inhibited.
 * Explicitly handle control register access

   If a VM-exit occurs due to a control register access, handle it and
   directly continue hardware accelerated execution of guest VM.

   Note: On NOVA control register accesses are handled by the kernel [1].

   [1] - https://github.com/alex-ab/NOVA/blob/master/src/ec_vmx.cpp#L106

 * Reset guest interruptibility state

   Assert that interrupts are not inhibited in the Virtualbox machine
   state and clear Blocking-by-[STI|MOV to SS] guest interruptibility
   flags prior to running a guest VM in hwaccel mode.

 * Set return code depending on exit reason

   Do not unconditionally emulate the next instruction on VM exit. This
   makes sharing the VM FPU state with Virtualbox unnecessary, as FPU
   instructions are not emulated by the recompiler any longer.
   Also, assert that the FPU has not been used by the recompiler

 * Inject pending guest VM interrupts on Muen

   Use mapped subject pending interrupts page of guest VM to perform
   interrupt injection. IRQs are transferred from the Virtualbox trap
   manager state to the pending interrupts region for injection. If an
   IRQ remains pending upon returning to the recompiler, it is copied
   back to the trap manager state and cleared in the subject interrupts
   region.

 * Inform recompiler about changed SYSENTER_[CS|EIP|ESP] values,
   otherwise values set while running the guest VM hardware accelerated
   may get lost.

 * Implement genode_cpu_hz() on Muen

   Determine the CPU frequency dynamically using the sinfo API.

Issue #2016
2016-07-06 13:02:56 +02:00