3 * \brief ARM virtualization interface.
6 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
7 * Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
8 * economic rights: Technische Universität Dresden (Germany)
10 * This file is part of TUD:OS and distributed under the terms of the
11 * GNU General Public License 2.
12 * Please see the COPYING-GPL-2 file for details.
14 * As a special exception, you may use this file as part of a free software
15 * library without restriction. Specifically, if other files instantiate
16 * templates or use macros or inline functions from this file, or you compile
17 * this file and link it with other files to produce an executable, this
18 * file does not by itself cause the resulting executable to be covered by
19 * the GNU General Public License. This exception does not however
20 * invalidate any other reasons why the executable file might be covered by
21 * the GNU General Public License.
25 #include <l4/sys/ipc.h>
26 #include <l4/sys/task.h>
29 * \defgroup l4_vm_tz_api VM API for TZ
30 * \brief Virtual Machine API for ARM TrustZone
35 * \brief state structure for TrustZone VMs
36 * \ingroup l4_vm_tz_api
40 l4_umword_t r[13]; // r0 - r12
49 l4_umword_t r_fiq[5]; // r8 - r12
69 l4_umword_t pending_events;
71 l4_umword_t cp15_ttbr0;
72 l4_umword_t cp15_ttbr1;
73 l4_umword_t cp15_ttbc;
74 l4_umword_t cp15_vector_base;
75 l4_umword_t cp15_dfsr;
76 l4_umword_t cp15_dfar;
77 l4_umword_t cp15_ifsr;
78 l4_umword_t cp15_ifar;
79 l4_umword_t cp15_control;
80 l4_umword_t cp15_prim_region_remap;
81 l4_umword_t cp15_norm_region_remap;
82 l4_umword_t cp15_cid; // banked
83 l4_umword_t cp15_tls[3]; // banked
84 l4_umword_t cp10_fpexc;
88 l4_umword_t exit_reason;
94 * \ingroup l4_vm_tz_api
96 * \param vm Capability selector for VM
99 l4_vm_run(l4_cap_idx_t vm) L4_NOTHROW;
103 * \ingroup l4_vm_tz_api
105 L4_INLINE l4_msgtag_t
106 l4_vm_run_u(l4_cap_idx_t vm, l4_utcb_t *u) L4_NOTHROW;
110 * \brief Operations on task objects.
111 * \ingroup l4_vm_tz_api
115 L4_VM_RUN_OP = 0 /* Run a VM */
119 /****** Implementations ****************/
121 L4_INLINE l4_msgtag_t
122 l4_vm_run_u(l4_cap_idx_t vm, l4_fpage_t const vm_state_fpage,
123 l4_umword_t *label, l4_utcb_t *u) L4_NOTHROW
125 l4_msg_regs_t *r = l4_utcb_mr_u(u);
126 r->mr[0] = L4_VM_RUN_OP;
127 r->mr[1] = vm_state_fpage.raw;
130 return l4_ipc(vm, u, L4_SYSF_CALL, *label, l4_msgtag(L4_PROTO_TASK, 3, 0, 0), label, L4_IPC_NEVER);
133 L4_INLINE l4_msgtag_t
134 l4_vm_run(l4_cap_idx_t vm, l4_fpage_t const vm_state_fpage,
135 l4_umword_t *label) L4_NOTHROW
137 return l4_vm_run_u(vm, vm_state_fpage, label, l4_utcb());