4 * \brief X86 virtualization interface.
7 * (c) 2010 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
8 * Alexander Warg <warg@os.inf.tu-dresden.de>
9 * economic rights: Technische Universität Dresden (Germany)
11 * This file is part of TUD:OS and distributed under the terms of the
12 * GNU General Public License 2.
13 * Please see the COPYING-GPL-2 file for details.
15 * As a special exception, you may use this file as part of a free software
16 * library without restriction. Specifically, if other files instantiate
17 * templates or use macros or inline functions from this file, or you compile
18 * this file and link it with other files to produce an executable, this
19 * file does not by itself cause the resulting executable to be covered by
20 * the GNU General Public License. This exception does not however
21 * invalidate any other reasons why the executable file might be covered by
22 * the GNU General Public License.
27 * \defgroup l4_vm_vmx_api VM API for VMX
28 * \brief Virtual machine API for VMX.
34 * \brief Additional VMCS fields.
35 * \ingroup l4_vm_vmx_api
39 L4_VM_VMX_VMCS_CR2 = 0x6830,
43 * \brief Return length in bytes of a VMCS field.
44 * \ingroup l4_vm_vmx_api
46 * \param field Field number.
47 * \return Width of field in bytes.
51 l4_vm_vmx_field_len(unsigned field);
54 * \brief Get pointer into VMCS.
55 * \ingroup l4_vm_vmx_api
57 * \param vmcs Pointer to VMCS buffer.
58 * \param field Field number.
60 * \param Pointer to field in the VMCS.
64 l4_vm_vmx_field_ptr(void *vmcs, unsigned field);
71 l4_vm_vmx_field_len(unsigned field)
73 static const char widths[4] = { 2, 8, 4, sizeof(l4_umword_t) };
74 return widths[field >> 13];
79 l4_vm_vmx_field_ptr(void *vmcs, unsigned field)
81 return (void *)((char *)vmcs
82 + ((field >> 13) * 4 + ((field >> 10) & 3) + 1) * 0x80
83 + l4_vm_vmx_field_len(field) * ((field >> 1) & 0xff));