4 * \brief X86 virtualization interface.
7 * (c) 2008-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.
26 #include <l4/sys/__vm-svm.h>
27 #include <l4/sys/__vm-vmx.h>
30 * \group Return location where to store GP-regs.
33 * \return Location of GP-regs.
36 * Note that the function returns a location within the UTCB, i.e. between
37 * calling this function and l4_vm_run() the UTCB must not be used.
41 l4_vm_gpregs(void) L4_NOTHROW;
49 l4_vm_gpregs_u(l4_utcb_t *u) L4_NOTHROW;
55 * \param vm Capability selector for VM
56 * \param vmcb_fpage VMCB
57 * \param gpregs General purpose registers
59 * The general purpose registers are stored in the UTCB before calling this
60 * function with the function l4_vm_gpregs().
63 l4_vm_run(l4_cap_idx_t vm, l4_fpage_t vmcx_fpage) L4_NOTHROW;
70 l4_vm_run_u(l4_cap_idx_t vm_task, l4_fpage_t const vmcb_fpage,
71 l4_utcb_t *u) L4_NOTHROW;
76 * \brief Operations on task objects.
81 L4_VM_RUN_OP = L4_TASK_VM_OPS + 0 /* Run a VM */
85 /****** Implementations ****************/
89 l4_vm_gpregs_u(l4_utcb_t *u) L4_NOTHROW
94 l4_umword_t a[sizeof(l4_vm_gpregs_t) / sizeof(l4_umword_t)];
96 return &((union cast *)&l4_utcb_mr_u(u)->mr[1])->r;
100 l4_vm_run_u(l4_cap_idx_t vm_task, l4_fpage_t const vmcx_fpage,
101 l4_utcb_t *u) L4_NOTHROW
104 l4_msg_regs_t *v = l4_utcb_mr_u(u);
105 enum { GPREGS_WORDS = sizeof(l4_vm_gpregs_t) / sizeof(l4_umword_t) };
106 v->mr[0] = L4_VM_RUN_OP;
108 v->mr[1 + GPREGS_WORDS] = l4_map_control(0, 0, 0);
109 v->mr[2 + GPREGS_WORDS] = vmcx_fpage.raw;
111 tag = l4_ipc_call(vm_task, u,
112 l4_msgtag(L4_PROTO_TASK, 1 + GPREGS_WORDS, 1, 0),
120 l4_vm_gpregs(void) L4_NOTHROW
122 return l4_vm_gpregs_u(l4_utcb());
125 L4_INLINE l4_msgtag_t
126 l4_vm_run(l4_cap_idx_t task, l4_fpage_t vmcx_fpage) L4_NOTHROW
128 return l4_vm_run_u(task, vmcx_fpage, l4_utcb());