L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
vm.h
1/*
2 * Copyright (C) 2024 Kernkonzept GmbH.
3 * Author(s): Georg Kotheimer <georg.kotheimer@kernkonzept.com>
4 *
5 * License: see LICENSE.spdx (in this directory or the directories above)
6 */
7#pragma once
8
9#include <l4/sys/vcpu.h>
10
11enum
12{
14 L4_vm_hstatus_vsbe = 1UL << 5,
16 L4_vm_hstatus_gva = 1UL << 6,
18 L4_vm_hstatus_spvp = 1UL << 8,
20 L4_vm_hstatus_vtw = 1UL << 21,
21
22 // Controls the effective XLEN for VS-mode, only available on RV64 and only if
23 // supported by the hardware.
24 L4_vm_hstatus_vsxl_32 = 1UL,
25 L4_vm_hstatus_vsxl_64 = 2UL,
26 L4_vm_hstatus_vsxl_128 = 3UL,
27 L4_vm_hstatus_vsxl_shift = 32,
28};
29
30typedef enum L4_vm_rfnc
31{
32 L4_vm_rfnc_none = 0,
33 L4_vm_rfnc_fence_i = 1,
34 L4_vm_rfnc_sfence_vma = 2,
35 L4_vm_rfnc_sfence_vma_asid = 3,
36} L4_vm_rfnc;
37
38enum
39{
40 L4_vm_hvip_vssip = 1UL << 2,
41 L4_vm_hvip_vstip = 1UL << 6,
42 L4_vm_hvip_vseip = 1UL << 10,
43};
44
50typedef struct l4_vm_state_t
51{
52 l4_umword_t hedeleg;
53 l4_umword_t hideleg;
54
55 l4_umword_t hvip;
56 l4_umword_t hip; // read-only
57 l4_umword_t hie;
58
59 l4_uint64_t htimedelta;
60
61 l4_umword_t htval;
62 l4_umword_t htinst;
63
64 l4_umword_t vsstatus;
65 l4_umword_t vstvec;
66 l4_umword_t vsscratch;
67 l4_umword_t vsepc;
68 l4_umword_t vscause;
69 l4_umword_t vstval;
70 l4_umword_t vsatp;
71 l4_uint64_t vstimecmp;
72
73 // Indicates that a hypervisor load/store instruction failed. VMM is
74 // responsible for resetting this value before executing a hypervisor/load
75 // store instruction.
76 l4_uint8_t hlsi_failed;
77
78 l4_uint8_t remote_fence;
79 l4_umword_t remote_fence_hart_mask;
80 l4_umword_t remote_fence_start_addr;
81 l4_umword_t remote_fence_size;
82 l4_umword_t remote_fence_asid;
84
85
87l4_vm_state(l4_vcpu_state_t *vcpu) L4_NOTHROW;
88
90l4_vm_state(l4_vcpu_state_t *vcpu) L4_NOTHROW
91{ return (l4_vm_state_t *)((char *)vcpu + 0x400); }
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
unsigned char l4_uint8_t
Unsigned 8bit value.
Definition l4int.h:25
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition l4int.h:31
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:167
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
State of a vCPU.
Definition vcpu.h:76
L4 extended vCPU state for RISC-V.
Definition vm.h:51
vCPU API