-
Notifications
You must be signed in to change notification settings - Fork 19
/
hv_kernel_structs.h
411 lines (396 loc) · 9.48 KB
/
hv_kernel_structs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
#pragma once
#include <Hypervisor/Hypervisor.h>
// Headers extracted from
// Kernel_Debug_Kit_12.5_build_21G5027d.dmg/kernel.release.t8101
// type lookup hv_vcpu_t
// type lookup arm_guest_context_t
typedef struct {
uint64_t mdscr_el1;
uint64_t tpidr_el1;
uint64_t tpidr_el0;
uint64_t tpidrro_el0;
uint64_t sp_el0;
uint64_t sp_el1;
uint64_t par_el1;
uint64_t csselr_el1;
uint64_t apstate;
uint64_t afpcr_el0;
} arm_guest_shared_sysregs_t;
typedef struct {
uint64_t ttbr0_el1;
uint64_t ttbr1_el1;
uint64_t tcr_el1;
uint64_t elr_el1;
uint64_t far_el1;
uint64_t esr_el1;
uint64_t mair_el1;
uint64_t amair_el1;
uint64_t vbar_el1;
uint64_t cntv_cval_el0;
uint64_t cntp_cval_el0;
uint64_t actlr_el1;
uint64_t sctlr_el1;
uint64_t cpacr_el1;
uint64_t spsr_el1;
uint64_t afsr0_el1;
uint64_t afsr1_el1;
uint64_t contextidr_el1;
uint64_t cntv_ctl_el0;
uint64_t cntp_ctl_el0;
uint64_t cntkctl_el1;
#ifndef OLDSTRUCT_IOS141
uint64_t ich_vmcr_el2;
#endif
} arm_guest_banked_sysregs_t;
typedef struct {
uint64_t hcr_el2;
uint64_t hacr_el2;
uint64_t cptr_el2;
uint64_t mdcr_el2;
uint64_t vmpidr_el2;
uint64_t vpidr_el2;
uint64_t virtual_timer_offset;
#ifdef OLDSTRUCT_IOS141
uint64_t ich_hcr_el2;
#endif
uint64_t hfgrtr_el2;
uint64_t hfgwtr_el2;
uint64_t hfgitr_el2;
uint64_t hdfgrtr_el2;
uint64_t hdfgwtr_el2;
#ifndef OLDSTRUCT_IOS141
uint64_t cnthctl_el2;
#endif
uint64_t timer;
uint64_t vmkeyhi_el2;
uint64_t vmkeylo_el2;
uint64_t apsts_el1;
#ifndef OLDSTRUCT_IOS141
uint64_t ich_hcr_el2;
uint64_t ich_lr_el2[8];
#endif
uint64_t host_debug;
#ifdef OLDSTRUCT_IOS141
uint64_t state_used;
#endif
} arm_guest_controls_t;
typedef struct {
struct {
uint64_t bvr;
uint64_t bcr;
} bp[16];
struct {
uint64_t wvr;
uint64_t wcr;
} wp[16];
uint64_t mdccint_el1;
uint64_t osdtrrx_el1;
uint64_t osdtrtx_el1;
uint8_t dbgclaim_el1;
} arm_guest_dbgregs_t;
typedef struct {
uint64_t amx_state_t_el1;
uint64_t amx_config_el1;
uint64_t aspsr_el1;
uint64_t ctrr_ctl_el1;
uint64_t ctrr_a_lwr_el1;
uint64_t ctrr_a_upr_el1;
uint64_t ctrr_b_lwr_el1;
uint64_t ctrr_b_upr_el1;
uint64_t ctrr_lock_el1;
uint64_t vmsa_lock_el1;
uint64_t pmcr1_el1;
uint64_t apctl_el1;
uint64_t apgakeyhi_el1;
uint64_t apgakeylo_el1;
uint64_t apiakeyhi_el1;
uint64_t apiakeylo_el1;
uint64_t apibkeyhi_el1;
uint64_t apibkeylo_el1;
uint64_t apdakeyhi_el1;
uint64_t apdakeylo_el1;
uint64_t apdbkeyhi_el1;
uint64_t apdbkeylo_el1;
uint64_t kernkeyhi_el1;
uint64_t kernkeylo_el1;
uint64_t gxf_config_el1;
uint64_t gxf_entry_el1;
uint64_t gxf_pabentry_el1;
uint64_t sp_gl1;
uint64_t tpidr_gl1;
uint64_t aspsr_gl1;
uint64_t vbar_gl1;
uint64_t far_gl1;
uint64_t esr_gl1;
uint64_t elr_gl1;
uint64_t spsr_gl1;
uint64_t pmcr1_gl1;
uint64_t afsr1_gl1;
uint64_t sprr_config_el1;
uint64_t sprr_amrange_el1;
uint64_t sprr_pperm_el1;
uint64_t sprr_uperm_el0;
uint64_t sprr_pmprr_el1;
uint64_t sprr_umprr_el1;
uint64_t sprr_pperm_sh1_el1;
uint64_t sprr_pperm_sh2_el1;
uint64_t sprr_pperm_sh3_el1;
uint64_t sprr_pperm_sh4_el1;
uint64_t sprr_pperm_sh5_el1;
uint64_t sprr_pperm_sh6_el1;
uint64_t sprr_pperm_sh7_el1;
uint64_t sprr_uperm_sh1_el1;
uint64_t sprr_uperm_sh2_el1;
uint64_t sprr_uperm_sh3_el1;
uint64_t sprr_uperm_sh4_el1;
uint64_t sprr_uperm_sh5_el1;
uint64_t sprr_uperm_sh6_el1;
uint64_t sprr_uperm_sh7_el1;
uint64_t acfg_el1;
uint64_t jrange_el1;
uint64_t jctl_el1;
uint64_t japiakeyhi_el1;
uint64_t japiakeylo_el1;
uint64_t japibkeyhi_el1;
uint64_t japibkeylo_el1;
} arm_guest_extregs_t;
typedef struct {
uint8_t __res_00_20[32];
uint64_t vttbr_el2;
uint64_t __res_28;
uint64_t vsttbr_el2;
uint64_t __res_38;
uint64_t vtcr_el2;
uint64_t vstcr_el2;
uint64_t vmpidr_el2;
uint64_t __res_58;
uint64_t cntvoff_el2;
uint8_t __res_68_78[16];
uint64_t hcr_el2;
uint64_t hstr_el2;
uint64_t vpidr_el2;
uint64_t tpidr_el2;
uint8_t __res_98_b0[24];
uint64_t vncr_el2;
uint8_t __res_b8_100[72];
uint64_t cpacr_el1;
uint64_t contextidr_el1;
uint64_t sctlr_el1;
uint64_t actlr_el1;
uint64_t tcr_el1;
uint64_t afsr0_el1;
uint64_t afsr1_el1;
uint64_t esr_el1;
uint64_t mair_el1;
uint64_t amair_el1;
uint8_t __res_158_150[8];
uint64_t mdscr_el1;
uint64_t spsr_el1;
uint64_t cntv_cval_el0;
uint64_t cntv_ctl_el0;
uint64_t cntp_cval_el0;
uint64_t cntp_ctl_el0;
uint64_t scxtnum_el1;
uint64_t tfsr_el1;
uint8_t __res_198_1a8[16];
uint64_t cntpoff_el2;
uint8_t __res_1b0_1b8[8];
uint64_t hfgrtr_el2;
uint64_t hfgwtr_el2;
uint64_t hfgitr_el2;
uint64_t hdfgrtr_el2;
uint64_t hdfgwtr_el2;
uint64_t zcr_el1;
uint8_t __res_1e8_200[24];
uint64_t ttbr0_el1;
uint8_t __res_208_210[8];
uint64_t ttbr1_el1;
uint8_t __res_218_220[8];
uint64_t far_el1;
uint8_t __res_228_230[8];
uint64_t elr_el1;
uint8_t __res_238_240[8];
uint64_t sp_el1;
uint8_t __res_248_250[8];
uint64_t vbar_el1;
uint8_t __res_400_258[424];
uint64_t ich_lr_el2[16];
uint64_t ich_ap0r_el2[4];
uint64_t ich_ap1r_el2[4];
uint64_t ich_hcr_el2;
uint64_t ich_vmcr_el2;
uint8_t __res_4d0_500[48];
uint64_t vdisr_el2;
uint64_t vsesr_el2;
uint8_t __res_510_800[752];
uint64_t pmblimitr_el1;
uint8_t __res_808_810[8];
uint64_t pmbptr_el1;
uint8_t __res_818_820[8];
uint64_t pmbsr_el1;
uint64_t pmscr_el1;
uint64_t pmsevfr_el1;
uint64_t pmsicr_el1;
uint64_t pmsirr_el1;
uint64_t pmslatfr_el1;
uint8_t __res_850_880[48];
uint64_t trfcr_el1;
uint8_t __res_888_1000[1912];
} arm_vncr_context_t;
typedef struct {
uint8_t __res_000_008[8];
uint64_t avncr_el2;
uint64_t aspsr_el1;
uint8_t __res_018_100[232];
uint64_t apctl_el1;
uint64_t apsts_el1;
uint64_t vmkey_lo_el2;
uint64_t vmkey_hi_el2;
uint64_t apgakeylo_el1;
uint64_t apgakeyhi_el1;
uint64_t apiakeylo_el1;
uint64_t apiakeyhi_el1;
uint64_t apibkeylo_el1;
uint64_t apibkeyhi_el1;
uint64_t apdakeylo_el1;
uint64_t apdakeyhi_el1;
uint64_t apdbkeylo_el1;
uint64_t apdbkeyhi_el1;
uint64_t kernkeylo_el1;
uint64_t kernkeyhi_el1;
uint8_t __res_180_2d0[336];
uint64_t jctl_el1;
uint64_t jrange_el1;
uint64_t japiakeylo_el1;
uint64_t japiakeyhi_el1;
uint64_t japibkeylo_el1;
uint64_t japibkeyhi_el1;
uint64_t amx_config_el1;
uint8_t __res_308_360[88];
uint64_t vmsa_lock_el1;
uint8_t __res_368_3c0[88];
uint64_t pmcr1_el1;
uint8_t __res_3c8_400[56];
uint64_t apl_lrtmr_el2;
uint64_t apl_intenable_el2;
uint8_t __res_410_1000[3056];
} apple_vncr_context_t;
typedef union {
struct {
union {
// arm_context_t guest_context;
struct {
uint64_t res1[1];
struct {
uint64_t x[29];
uint64_t fp;
uint64_t lr;
uint64_t sp;
uint64_t pc;
uint32_t cpsr;
uint32_t pad;
} regs;
uint64_t res2[4];
struct {
__uint128_t q[32];
uint32_t fpsr;
uint32_t fpcr;
} neon;
};
};
arm_guest_shared_sysregs_t shared_sysregs;
arm_guest_banked_sysregs_t banked_sysregs;
arm_guest_dbgregs_t dbgregs;
volatile arm_guest_controls_t controls;
volatile uint64_t state_dirty;
uint64_t guest_tick_count;
arm_guest_extregs_t extregs;
arm_vncr_context_t vncr;
apple_vncr_context_t avncr;
};
uint8_t page[16384];
} arm_guest_rw_context_t;
typedef struct {
uint32_t vmexit_reason;
uint32_t vmexit_esr;
uint32_t vmexit_instr;
uint64_t vmexit_far;
uint64_t vmexit_hpfar;
} arm_guest_vmexit_t;
typedef union {
struct {
uint64_t ver;
arm_guest_vmexit_t exit;
arm_guest_controls_t controls;
uint64_t state_valid;
uint64_t state_dirty;
uint64_t state_used;
uint32_t ich_vtr_el2;
uint32_t ich_misr_el2;
uint32_t ich_elrsr_el2;
};
uint8_t page[16384];
} arm_guest_ro_context_t;
typedef struct {
uint64_t cptr_el2;
uint64_t mdscr_el1;
uint64_t tpidr_el1;
uint64_t tpidr_el0;
uint64_t tpidrro_el0;
uint64_t sp_el0;
uint64_t jop_hash;
uint64_t vmenter_ticks;
uint64_t vmexit_ticks;
uint64_t vncr_el2;
uint64_t avncr_el2;
uint64_t ich_ap0r0_el2;
uint64_t ich_ap1r0_el2;
vm_map_t guest_map;
bool flush_local_tlb;
uint64_t actlr_en_mdsb;
} arm_host_context_t;
typedef struct {
arm_guest_rw_context_t rw;
arm_guest_ro_context_t ro;
arm_host_context_t priv;
} arm_guest_context_t;
typedef struct {
uint64_t api;
uint64_t vcpumax;
uint64_t control_hcr;
uint64_t control_hacr;
uint64_t control_cptr;
uint64_t control_mdcr;
uint64_t control_ich_hcr;
uint64_t control_vmpidr;
uint64_t control_vpidr;
uint64_t control_virtual_timer_offset;
uint64_t control_timer;
uint64_t control_vmkeyhi;
uint64_t control_vmkeylo;
uint64_t control_apsts;
uint64_t control_state_used;
uint64_t control_hfgrtr;
uint64_t control_hfgwtr;
uint64_t control_hfgitr;
uint64_t control_hdfgrtr;
uint64_t control_hdfgwtr;
uint64_t control_cnthctl;
uint64_t ctr_el0;
uint64_t dczid_el0;
uint64_t clidr_el1;
uint64_t ccsidr_el1_inst[8];
uint64_t ccsidr_el1_data_or_unified[8];
uint64_t id_aa64dfr0_el1;
uint64_t id_aa64dfr1_el1;
uint64_t id_aa64isar0_el1;
uint64_t id_aa64isar1_el1;
uint64_t id_aa64mmfr0_el1;
uint64_t id_aa64mmfr1_el1;
uint64_t id_aa64mmfr2_el1;
uint64_t id_aa64pfr0_el1;
uint64_t id_aa64pfr1_el1;
uint8_t gic_npie_active_pending_bug;
uint64_t ipa_bits_4k;
uint64_t ipa_bits_16k;
} hv_capabilities_t;