L4Re Operating System Framework – Interface and Usage Documentation
Loading...
Searching...
No Matches
__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
19typedef 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
29L4_INLINE void *l4_vcpu_e_ptr(void const *vcpu, unsigned id) L4_NOTHROW;
30L4_INLINE void *l4_vcpu_e_ptr(void const *vcpu, unsigned id) L4_NOTHROW
31{ return (void *)((l4_addr_t)vcpu + 0x400 + (id & 0xfff)); }
32
33enum L4_vcpu_e_consts
34{
35 L4_VCPU_E_NUM_LR = 4,
36};
37
38L4_INLINE l4_arm_vcpu_e_info_t const *
39l4_vcpu_e_info(void const *vcpu) L4_NOTHROW;
40
41L4_INLINE l4_arm_vcpu_e_info_t const *
42l4_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
48l4_vcpu_e_info_user(void *vcpu) L4_NOTHROW;
49
51l4_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
65l4_vcpu_e_read_32(void const *vcpu, unsigned id) L4_NOTHROW;
66
68l4_vcpu_e_read_32(void const *vcpu, unsigned id) L4_NOTHROW
69{ return *(l4_uint32_t const *)l4_vcpu_e_ptr(vcpu, id); }
70
78L4_INLINE void
79l4_vcpu_e_write_32(void *vcpu, unsigned id, l4_uint32_t val) L4_NOTHROW;
80
81L4_INLINE void
82l4_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
93l4_vcpu_e_read_64(void const *vcpu, unsigned id) L4_NOTHROW;
94
96l4_vcpu_e_read_64(void const *vcpu, unsigned id) L4_NOTHROW
97{ return *(l4_uint64_t const *)l4_vcpu_e_ptr(vcpu, id); }
98
106L4_INLINE void
107l4_vcpu_e_write_64(void *vcpu, unsigned id, l4_uint64_t val) L4_NOTHROW;
108
109L4_INLINE void
110l4_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
121l4_vcpu_e_read(void const *vcpu, unsigned id) L4_NOTHROW;
122
124l4_vcpu_e_read(void const *vcpu, unsigned id) L4_NOTHROW
125{ return *(l4_umword_t const *)l4_vcpu_e_ptr(vcpu, id); }
126
134L4_INLINE void
135l4_vcpu_e_write(void *vcpu, unsigned id, l4_umword_t val) L4_NOTHROW;
136
137L4_INLINE void
138l4_vcpu_e_write(void *vcpu, unsigned id, l4_umword_t val) L4_NOTHROW
139{ *((l4_umword_t *)l4_vcpu_e_ptr(vcpu, id)) = val; }
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
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:188
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:62