Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
google
GitHub Repository: google/crosvm
Path: blob/main/hypervisor/src/gunyah/gunyah_sys/bindings.rs
5394 views
1
/* automatically generated by tools/bindgen-all-the-things */
2
3
#![allow(clippy::missing_safety_doc)]
4
#![allow(clippy::undocumented_unsafe_blocks)]
5
#![allow(clippy::upper_case_acronyms)]
6
#![allow(non_upper_case_globals)]
7
#![allow(non_camel_case_types)]
8
#![allow(non_snake_case)]
9
#![allow(dead_code)]
10
11
pub const GH_IOCTL_TYPE: u8 = 71u8;
12
pub const GH_MEM_ALLOW_READ: u32 = 1;
13
pub const GH_MEM_ALLOW_WRITE: u32 = 2;
14
pub const GH_MEM_ALLOW_EXEC: u32 = 4;
15
pub const GH_FN_VCPU: u32 = 1;
16
pub const GH_FN_IRQFD: u32 = 2;
17
pub const GH_FN_IOEVENTFD: u32 = 3;
18
pub const GH_FN_MAX_ARG_SIZE: u32 = 256;
19
pub const GH_IRQFD_LEVEL: u32 = 1;
20
pub const GH_IOEVENTFD_DATAMATCH: u32 = 1;
21
pub const GH_VM_MAX_EXIT_REASON_SIZE: u32 = 8;
22
pub const GH_VCPU_EXIT_UNKNOWN: u32 = 0;
23
pub const GH_VCPU_EXIT_MMIO: u32 = 1;
24
pub const GH_VCPU_EXIT_STATUS: u32 = 2;
25
pub const GH_ANDROID_IOCTL_TYPE: u8 = 65u8;
26
pub const GH_VM_BOOT_CONTEXT_REG_SHIFT: u32 = 8;
27
pub type i8 = ::std::os::raw::c_schar;
28
pub type u8 = ::std::os::raw::c_uchar;
29
pub type i16 = ::std::os::raw::c_short;
30
pub type u16 = ::std::os::raw::c_ushort;
31
pub type i32 = ::std::os::raw::c_int;
32
pub type u32 = ::std::os::raw::c_uint;
33
pub type i64 = ::std::os::raw::c_longlong;
34
pub type u64 = ::std::os::raw::c_ulonglong;
35
pub type __s128 = i128;
36
pub type __u128 = u128;
37
pub type __le16 = u16;
38
pub type __be16 = u16;
39
pub type __le32 = u32;
40
pub type __be32 = u32;
41
pub type __le64 = u64;
42
pub type __be64 = u64;
43
pub type __sum16 = u16;
44
pub type __wsum = u32;
45
pub type __poll_t = ::std::os::raw::c_uint;
46
pub const gunyah_auth_type_GUNYAH_ANDROID_PVM_TYPE: gunyah_auth_type = 0;
47
pub const gunyah_auth_type_GUNYAH_QCOM_TRUSTED_VM_TYPE: gunyah_auth_type = 1;
48
pub type gunyah_auth_type = ::std::os::raw::c_uint;
49
#[repr(C)]
50
#[derive(Debug, Default, Copy, Clone)]
51
pub struct gunyah_qtvm_auth_arg {
52
pub vm_id: u16,
53
pub pas_id: u32,
54
pub guest_phys_addr: u64,
55
pub size: u64,
56
}
57
#[repr(C)]
58
#[derive(Debug, Default, Copy, Clone)]
59
pub struct gunyah_auth_desc {
60
pub type_: u32,
61
pub arg_size: u32,
62
pub arg: u64,
63
}
64
#[repr(C)]
65
#[derive(Debug, Default, Copy, Clone)]
66
pub struct gh_userspace_memory_region {
67
pub label: u32,
68
pub flags: u32,
69
pub guest_phys_addr: u64,
70
pub memory_size: u64,
71
pub userspace_addr: u64,
72
}
73
#[repr(C)]
74
#[derive(Debug, Default, Copy, Clone)]
75
pub struct gh_vm_dtb_config {
76
pub guest_phys_addr: u64,
77
pub size: u64,
78
}
79
pub mod gh_vm_boot_context_reg {
80
pub type Type = ::std::os::raw::c_uint;
81
pub const REG_SET_X: Type = 0;
82
pub const REG_SET_PC: Type = 1;
83
pub const REG_SET_SP: Type = 2;
84
}
85
#[repr(C)]
86
#[derive(Debug, Default, Copy, Clone)]
87
pub struct gh_vm_boot_context {
88
pub reg: u32,
89
pub reserved: u32,
90
pub value: u64,
91
}
92
#[repr(C)]
93
#[derive(Debug, Default, Copy, Clone)]
94
pub struct gh_fn_vcpu_arg {
95
pub id: u32,
96
}
97
#[repr(C)]
98
#[derive(Debug, Default, Copy, Clone)]
99
pub struct gh_fn_irqfd_arg {
100
pub fd: u32,
101
pub label: u32,
102
pub flags: u32,
103
pub padding: u32,
104
}
105
#[repr(C)]
106
#[derive(Debug, Default, Copy, Clone)]
107
pub struct gh_fn_ioeventfd_arg {
108
pub datamatch: u64,
109
pub addr: u64,
110
pub len: u32,
111
pub fd: i32,
112
pub flags: u32,
113
pub padding: u32,
114
}
115
#[repr(C)]
116
#[derive(Debug, Default, Copy, Clone)]
117
pub struct gh_fn_desc {
118
pub type_: u32,
119
pub arg_size: u32,
120
pub arg: u64,
121
}
122
pub const GH_VM_STATUS_GH_VM_STATUS_LOAD_FAILED: gh_vm_status = 1;
123
pub const GH_VM_STATUS_GH_VM_STATUS_EXITED: gh_vm_status = 2;
124
pub const GH_VM_STATUS_GH_VM_STATUS_CRASHED: gh_vm_status = 3;
125
pub type gh_vm_status = ::std::os::raw::c_uint;
126
#[repr(C)]
127
#[derive(Debug, Default, Copy, Clone)]
128
pub struct gh_vm_exit_info {
129
pub type_: u16,
130
pub padding: u16,
131
pub reason_size: u32,
132
pub reason: [u8; 8usize],
133
}
134
#[repr(C)]
135
#[derive(Copy, Clone)]
136
pub struct gh_vcpu_run {
137
pub immediate_exit: u8,
138
pub padding: [u8; 7usize],
139
pub exit_reason: u32,
140
pub __bindgen_anon_1: gh_vcpu_run__bindgen_ty_1,
141
}
142
#[repr(C)]
143
#[derive(Copy, Clone)]
144
pub union gh_vcpu_run__bindgen_ty_1 {
145
pub mmio: gh_vcpu_run__bindgen_ty_1__bindgen_ty_1,
146
pub status: gh_vcpu_run__bindgen_ty_1__bindgen_ty_2,
147
}
148
#[repr(C)]
149
#[derive(Debug, Default, Copy, Clone)]
150
pub struct gh_vcpu_run__bindgen_ty_1__bindgen_ty_1 {
151
pub phys_addr: u64,
152
pub data: [u8; 8usize],
153
pub len: u32,
154
pub is_write: u8,
155
}
156
#[repr(C)]
157
#[derive(Debug, Copy, Clone)]
158
pub struct gh_vcpu_run__bindgen_ty_1__bindgen_ty_2 {
159
pub status: gh_vm_status,
160
pub exit_info: gh_vm_exit_info,
161
}
162
impl Default for gh_vcpu_run__bindgen_ty_1__bindgen_ty_2 {
163
fn default() -> Self {
164
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
165
unsafe {
166
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
167
s.assume_init()
168
}
169
}
170
}
171
impl Default for gh_vcpu_run__bindgen_ty_1 {
172
fn default() -> Self {
173
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
174
unsafe {
175
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
176
s.assume_init()
177
}
178
}
179
}
180
impl Default for gh_vcpu_run {
181
fn default() -> Self {
182
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
183
unsafe {
184
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
185
s.assume_init()
186
}
187
}
188
}
189
#[repr(C)]
190
#[derive(Debug, Default, Copy, Clone)]
191
pub struct gh_vm_firmware_config {
192
pub guest_phys_addr: u64,
193
pub size: u64,
194
}
195
#[repr(C)]
196
#[derive(Debug, Default, Copy, Clone)]
197
pub struct gunyah_address_range {
198
pub guest_phys_addr: u64,
199
pub size: u64,
200
}
201
pub const GUNYAH_MEM_ALLOW_READ: gunyah_map_flags = 1;
202
pub const GUNYAH_MEM_ALLOW_WRITE: gunyah_map_flags = 2;
203
pub const GUNYAH_MEM_ALLOW_EXEC: gunyah_map_flags = 4;
204
pub const GUNYAH_MEM_ALLOW_RWX: gunyah_map_flags = 7;
205
pub const GUNYAH_MEM_DEFAULT_ACCESS: gunyah_map_flags = 0;
206
pub const GUNYAH_MEM_FORCE_LEND: gunyah_map_flags = 16;
207
pub const GUNYAH_MEM_FORCE_SHARE: gunyah_map_flags = 32;
208
pub const GUNYAH_MEM_UNMAP: gunyah_map_flags = 256;
209
pub type gunyah_map_flags = ::std::os::raw::c_uint;
210
#[repr(C)]
211
#[derive(Debug, Default, Copy, Clone)]
212
pub struct gunyah_map_cma_mem_args {
213
pub label: u32,
214
pub guest_addr: u64,
215
pub flags: u32,
216
pub guest_mem_fd: u32,
217
pub offset: u64,
218
pub size: u64,
219
}
220
221