L4Re – L4 Runtime Environment
__vcpu-arm.h
1 /*
2  * (c) 2017 Alexander Warg <alexander.warg@kernkonzept.com>
3  *
4  * This file is part of L4Re and distributed under the terms of the
5  * GNU General Public License 2.
6  * Please see the COPYING-GPL-2 file for details.
7  *
8  * As a special exception, you may use this file as part of a free software
9  * library without restriction. Specifically, if other files instantiate
10  * templates or use macros or inline functions from this file, or you compile
11  * this file and link it with other files to produce an executable, this
12  * file does not by itself cause the resulting executable to be covered by
13  * the GNU General Public License. This exception does not however
14  * invalidate any other reasons why the executable file might be covered by
15  * the GNU General Public License.
16  */
17 #pragma once
18 
19 typedef struct l4_arm_vcpu_e_info_t
20 {
21  l4_uint8_t version; // must be 0
22  l4_uint8_t gic_version;
23  l4_uint8_t _rsvd0[2];
24  l4_uint32_t features;
25  l4_uint32_t _rsvd1[14];
26  l4_umword_t user[8];
27 } l4_arm_vcpu_e_info_t;
28 
29 L4_INLINE void *l4_vcpu_e_ptr(void const *vcpu, unsigned id) L4_NOTHROW;
30 L4_INLINE void *l4_vcpu_e_ptr(void const *vcpu, unsigned id) L4_NOTHROW
31 { return (void *)((l4_addr_t)vcpu + 0x400 + (id & 0xfff)); }
32 
33 enum L4_vcpu_e_consts
34 {
35  L4_VCPU_E_NUM_LR = 4,
36 };
37 
38 L4_INLINE l4_arm_vcpu_e_info_t const *
39 l4_vcpu_e_info(void const *vcpu) L4_NOTHROW;
40 
41 L4_INLINE l4_arm_vcpu_e_info_t const *
42 l4_vcpu_e_info(void const *vcpu) L4_NOTHROW
43 {
44  return (l4_arm_vcpu_e_info_t const *)((l4_addr_t)vcpu + 0x200);
45 }
46 
47 L4_INLINE l4_umword_t *
48 l4_vcpu_e_info_user(void *vcpu) L4_NOTHROW;
49 
50 L4_INLINE l4_umword_t *
51 l4_vcpu_e_info_user(void *vcpu) L4_NOTHROW
52 {
53  return ((l4_arm_vcpu_e_info_t *)((l4_addr_t)vcpu + 0x200))->user;
54 }
55 
56 
64 L4_INLINE l4_uint32_t
65 l4_vcpu_e_read_32(void const *vcpu, unsigned id) L4_NOTHROW;
66 
67 L4_INLINE l4_uint32_t
68 l4_vcpu_e_read_32(void const *vcpu, unsigned id) L4_NOTHROW
69 { return *(l4_uint32_t const *)l4_vcpu_e_ptr(vcpu, id); }
70 
78 L4_INLINE void
79 l4_vcpu_e_write_32(void *vcpu, unsigned id, l4_uint32_t val) L4_NOTHROW;
80 
81 L4_INLINE void
82 l4_vcpu_e_write_32(void *vcpu, unsigned id, l4_uint32_t val) L4_NOTHROW
83 { *((l4_uint32_t *)l4_vcpu_e_ptr(vcpu, + id)) = val; }
84 
92 L4_INLINE l4_uint64_t
93 l4_vcpu_e_read_64(void const *vcpu, unsigned id) L4_NOTHROW;
94 
95 L4_INLINE l4_uint64_t
96 l4_vcpu_e_read_64(void const *vcpu, unsigned id) L4_NOTHROW
97 { return *(l4_uint64_t const *)l4_vcpu_e_ptr(vcpu, id); }
98 
106 L4_INLINE void
107 l4_vcpu_e_write_64(void *vcpu, unsigned id, l4_uint64_t val) L4_NOTHROW;
108 
109 L4_INLINE void
110 l4_vcpu_e_write_64(void *vcpu, unsigned id, l4_uint64_t val) L4_NOTHROW
111 { *((l4_uint64_t *)l4_vcpu_e_ptr(vcpu, id)) = val; }
112 
120 L4_INLINE l4_umword_t
121 l4_vcpu_e_read(void const *vcpu, unsigned id) L4_NOTHROW;
122 
123 L4_INLINE l4_umword_t
124 l4_vcpu_e_read(void const *vcpu, unsigned id) L4_NOTHROW
125 { return *(l4_umword_t const *)l4_vcpu_e_ptr(vcpu, id); }
126 
134 L4_INLINE void
135 l4_vcpu_e_write(void *vcpu, unsigned id, l4_umword_t val) L4_NOTHROW;
136 
137 L4_INLINE void
138 l4_vcpu_e_write(void *vcpu, unsigned id, l4_umword_t val) L4_NOTHROW
139 { *((l4_umword_t *)l4_vcpu_e_ptr(vcpu, id)) = val; }
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition: compiler.h:186
unsigned long l4_umword_t
Unsigned machine word.
Definition: l4int.h:51
unsigned long l4_addr_t
Address type.
Definition: l4int.h:45
unsigned char l4_uint8_t
Unsigned 8bit value.
Definition: l4int.h:36
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition: l4int.h:40
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition: l4int.h:42