Loading...
Searching...
No Matches
vm.h
Go to the documentation of this file.
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#pragma once
struct l4_vm_tz_state_mode
{
l4_umword_t sp;
l4_umword_t lr;
l4_umword_t spsr;
};
struct l4_vm_tz_state_irq_inject
{
l4_uint32_t group;
l4_uint32_t irqs[8];
};
struct l4_vm_tz_state
{
l4_umword_t r[13]; // r0 - r12
l4_umword_t sp_usr;
l4_umword_t lr_usr;
struct l4_vm_tz_state_mode irq;
l4_umword_t r_fiq[5]; // r8 - r12
struct l4_vm_tz_state_mode fiq;
struct l4_vm_tz_state_mode abt;
struct l4_vm_tz_state_mode und;
struct l4_vm_tz_state_mode svc;
l4_umword_t pc;
l4_umword_t cpsr;
l4_umword_t pending_events;
l4_uint32_t cpacr;
l4_umword_t cp10_fpexc;
l4_umword_t pfs;
l4_umword_t pfa;
l4_umword_t exit_reason;
struct l4_vm_tz_state_irq_inject irq_inject;
};
enum L4_vm_exit_reason
{
L4_vm_exit_reason_vmm_call = 1,
L4_vm_exit_reason_inst_abort = 2,
L4_vm_exit_reason_data_abort = 3,
L4_vm_exit_reason_irq = 4,
L4_vm_exit_reason_fiq = 5,
L4_vm_exit_reason_undef = 6,
};
L4_INLINE int
l4_vm_tz_irq_inject(struct l4_vm_tz_state *state, unsigned irq);
L4_INLINE int
l4_vm_tz_irq_inject(struct l4_vm_tz_state *state, unsigned irq)
{
if (irq > sizeof(state->irq_inject.irqs) * 8)
return -L4_EINVAL;
unsigned g = irq / 32;
state->irq_inject.group |= 1 << g;
state->irq_inject.irqs[g] |= 1 << (irq & 31);
return 0;
}
l4_umword_t
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
l4_uint32_t
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition l4int.h:29
L4_EINVAL
@ L4_EINVAL
Invalid argument.
Definition err.h:46
L4_INLINE
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
l4_vm_tz_state
state structure for TrustZone VMs
Definition vm.h:42