applevisor_sys/lib.rs
1#![doc = include_str!("../README.md")]
2#![cfg_attr(feature = "simd-nightly", feature(portable_simd), feature(simd_ffi))]
3#![allow(non_camel_case_types)]
4#![allow(improper_ctypes)]
5
6use core::ffi::c_void;
7
8#[cfg_attr(target_os = "macos", link(name = "Hypervisor", kind = "framework"))]
9unsafe extern "C" {}
10
11/// The size of a memory page on Apple Silicon.
12pub const PAGE_SIZE: usize = 0x4000;
13
14/// The return type of framework functions.
15pub type hv_return_t = i32;
16
17/// Errors returned by Hypervisor functions.
18#[repr(C)]
19#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
20pub enum hv_error_t {
21 /// The operation completed successfully.
22 HV_SUCCESS = 0,
23 /// The operation was unsuccessful.
24 HV_ERROR = 0xfae94001,
25 /// The operation was unsuccessful because the owning resource was busy.
26 HV_BUSY = 0xfae94002,
27 /// The operation was unsuccessful because the function call had an invalid argument.
28 HV_BAD_ARGUMENT = 0xfae94003,
29 /// The operation was unsuccessful because the guest is in an illegal state.
30 HV_ILLEGAL_GUEST_STATE = 0xfae94004,
31 /// The operation was unsuccessful because the host had no resources available to complete the
32 /// request.
33 HV_NO_RESOURCES = 0xfae94005,
34 /// The operation was unsuccessful because no VM or vCPU was available.
35 HV_NO_DEVICE = 0xfae94006,
36 /// The system didn’t allow the requested operation.
37 HV_DENIED = 0xfae94007,
38 /// HV_FAULT
39 HV_FAULT = 0xfae94008,
40 /// The operation requested isn’t supported by the hypervisor.
41 HV_UNSUPPORTED = 0xfae9400f,
42}
43
44// -----------------------------------------------------------------------------------------------
45// Utils
46// -----------------------------------------------------------------------------------------------
47
48unsafe extern "C" {
49 pub fn os_release(object: *mut c_void);
50}
51
52// -----------------------------------------------------------------------------------------------
53// Virtual Machine Management
54// -----------------------------------------------------------------------------------------------
55
56/// Supported intermediate physical address (IPA) granules.
57#[cfg(feature = "macos-26-0")]
58#[repr(C)]
59#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
60pub enum hv_ipa_granule_t {
61 /// 4KB Granule.
62 HV_IPA_GRANULE_4KB,
63 /// 16KB Granule.
64 HV_IPA_GRANULE_16KB,
65}
66
67/// The type that defines a virtual-machine configuration.
68pub type hv_vm_config_t = *mut c_void;
69
70/// Memory allocation flags.
71#[repr(C)]
72#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
73pub enum hv_allocate_flags_t {
74 /// Default allocation flags.
75 HV_ALLOCATE_DEFAULT = 0,
76}
77
78unsafe extern "C" {
79 /// Creates a virtual machine configuration object.
80 ///
81 /// # Return Value
82 ///
83 /// A new virtual-machine configuration object. Release this object with os_release when no
84 /// longer used.
85 pub fn hv_vm_config_create() -> hv_vm_config_t;
86
87 /// Creates a VM instance for the current process.
88 ///
89 /// # Parameters
90 ///
91 /// * `config`: The configuration of the vCPU. Pass NULL for the default configuration.
92 ///
93 /// # Return Value
94 ///
95 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
96 /// [`hv_return_t`].
97 pub fn hv_vm_create(config: hv_vm_config_t) -> hv_return_t;
98
99 /// Destroys the VM instance associated with the current process.
100 ///
101 /// # Return value
102 ///
103 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
104 /// [`hv_return_t`].
105 pub fn hv_vm_destroy() -> hv_return_t;
106
107 /// Allocates anonymous memory suitable to be mapped as guest memory.
108 ///
109 /// # Discussion
110 ///
111 /// - The memory is allocated with `VM_PROT_DEFAULT` permissions.
112 /// - This API enables accurate memory accounting of the allocations it creates.
113 /// - Memory allocated with this API should deallocated with [`hv_vm_deallocate`].
114 ///
115 /// # Parameters
116 ///
117 /// * `uvap`: Returned virtual address of the allocated memory.
118 /// * `size`: Size in bytes of the region to be allocated. Must be a multiple of [`PAGE_SIZE`].
119 /// * `flags`: Memory allocation flags.
120 ///
121 /// # Return value
122 ///
123 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
124 /// [`hv_return_t`].
125 #[cfg(feature = "macos-12-1")]
126 pub fn hv_vm_allocate(
127 uvap: *mut *mut c_void,
128 size: libc::size_t,
129 flags: hv_allocate_flags_t,
130 ) -> hv_return_t;
131
132 /// Deallocate memory previously allocated by [`hv_vm_allocate`].
133 ///
134 /// # Parameters
135 ///
136 /// * `uva`: Virtual address of the allocated memory.
137 /// * `size`: Size in bytes of the region to be deallocated.
138 ///
139 /// # Return value
140 ///
141 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
142 /// [`hv_return_t`].
143 #[cfg(feature = "macos-12-1")]
144 pub fn hv_vm_deallocate(uvap: *const c_void, size: libc::size_t) -> hv_return_t;
145
146 /// Return the maximum intermediate physical address bit length.
147 ///
148 /// # Discussion
149 ///
150 /// The bit length is the number of valid bits from an intermediate physical address (IPA).
151 /// For example, max IPA bit length of 36 means only the least significant 36 bits of an IPA
152 /// are valid, and covers a 64GB range.
153 ///
154 /// # Parameters
155 ///
156 /// * `ipa_bit_length`: Pointer to bit length (written on success).
157 ///
158 /// # Return value
159 ///
160 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
161 /// [`hv_return_t`].
162 #[cfg(feature = "macos-13-0")]
163 pub fn hv_vm_config_get_max_ipa_size(ipa_bit_length: *mut u32) -> hv_return_t;
164
165 /// Return the default intermediate physical address bit length.
166 ///
167 /// # Discussion
168 ///
169 /// This default IPA size is used if the IPA size is not set explicitly.
170 ///
171 /// # Parameters
172 ///
173 /// * `ipa_bit_length`: Pointer to bit length (written on success).
174 ///
175 /// # Return value
176 ///
177 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
178 /// [`hv_return_t`].
179 #[cfg(feature = "macos-13-0")]
180 pub fn hv_vm_config_get_default_ipa_size(ipa_bit_length: *mut u32) -> hv_return_t;
181
182 /// Set intermediate physical address bit length in virtual machine configuration.
183 ///
184 /// # Parameters
185 ///
186 /// * `config`: The configuration of the vCPU.
187 /// * `ipa_bit_length`: Intermediate physical address bit length.
188 ///
189 /// # Return value
190 ///
191 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
192 /// [`hv_return_t`].
193 #[cfg(feature = "macos-13-0")]
194 pub fn hv_vm_config_set_ipa_size(config: hv_vm_config_t, ipa_bit_length: u32) -> hv_return_t;
195
196 /// Return intermediate physical address bit length in configuration.
197 ///
198 /// # Parameters
199 ///
200 /// * `config`: The configuration of the vCPU.
201 /// * `ipa_bit_length`: Pointer to bit length (written on success).
202 ///
203 /// # Return value
204 ///
205 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
206 /// [`hv_return_t`].
207 #[cfg(feature = "macos-13-0")]
208 pub fn hv_vm_config_get_ipa_size(
209 config: hv_vm_config_t,
210 ipa_bit_length: *mut u32,
211 ) -> hv_return_t;
212
213 /// Return whether or not EL2 is supported on the current platform.
214 ///
215 /// # Parameters
216 ///
217 /// * `el2_supported`: Pointer to whether or not EL2 is supported (written on success).
218 ///
219 /// # Return value
220 ///
221 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
222 /// [`hv_return_t`].
223 #[cfg(feature = "macos-15-0")]
224 pub fn hv_vm_config_get_el2_supported(el2_supported: *mut bool) -> hv_return_t;
225
226 /// Return whether or not EL2 is enabled for a VM configuration.
227 ///
228 /// # Parameters
229 ///
230 /// * `config`: The configuration of the vCPU.
231 /// * `el2_enabled`: Pointer to whether or not EL2 is enabled (written on success).
232 ///
233 /// # Return value
234 ///
235 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
236 /// [`hv_return_t`].
237 #[cfg(feature = "macos-15-0")]
238 pub fn hv_vm_config_get_el2_enabled(
239 config: hv_vm_config_t,
240 el2_enabled: *mut bool,
241 ) -> hv_return_t;
242
243 /// Set whether or not EL2 is enabled for a VM configuration.
244 ///
245 /// # Parameters
246 ///
247 /// * `config`: The configuration of the vCPU.
248 /// * `el2_enabled`: Whether or not to enable EL2.
249 ///
250 /// # Return value
251 ///
252 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
253 /// [`hv_return_t`].
254 #[cfg(feature = "macos-15-0")]
255 pub fn hv_vm_config_set_el2_enabled(config: hv_vm_config_t, el2_enabled: bool) -> hv_return_t;
256
257 /// Return the default intermediate physical address granule.
258 ///
259 /// # Parameters
260 ///
261 /// * `granule`: Pointer to the default intermediate physical address granule size
262 /// (written on success).
263 ///
264 /// # Return value
265 ///
266 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
267 /// [`hv_return_t`].
268 #[cfg(feature = "macos-26-0")]
269 pub fn hv_vm_config_get_default_ipa_granule(granule: *mut hv_ipa_granule_t) -> hv_return_t;
270
271 /// Return the intermediate physical address granule size in virtual machine configuration.
272 ///
273 /// # Parameters
274 ///
275 /// * `config`: Configuration.
276 /// * `granule`: Pointer to the default intermediate physical address granule size
277 /// (written on success).
278 ///
279 /// # Return value
280 ///
281 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
282 /// [`hv_return_t`].
283 #[cfg(feature = "macos-26-0")]
284 pub fn hv_vm_config_get_ipa_granule(
285 config: hv_vm_config_t,
286 granule: *mut hv_ipa_granule_t,
287 ) -> hv_return_t;
288
289 /// Set the intermediate physical address granule size in virtual machine configuration.
290 ///
291 /// # Parameters
292 ///
293 /// * `config`: Configuration.
294 /// * `granule`: Granule size.
295 ///
296 /// # Return value
297 ///
298 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
299 /// [`hv_return_t`].
300 #[cfg(feature = "macos-26-0")]
301 pub fn hv_vm_config_set_ipa_granule(
302 config: hv_vm_config_t,
303 granule: hv_ipa_granule_t,
304 ) -> hv_return_t;
305}
306
307// -----------------------------------------------------------------------------------------------
308// vCPU Management - Configuration
309// -----------------------------------------------------------------------------------------------
310
311/// The type that defines a vCPU configuration.
312pub type hv_vcpu_config_t = *mut c_void;
313
314/// The type that defines feature registers.
315#[repr(C)]
316#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
317pub enum hv_feature_reg_t {
318 /// The value that identifies debug feature register 0, EL1 (DFR0_EL1).
319 ID_AA64DFR0_EL1,
320 /// The value that identifies debug feature register 1, EL1 (DFR1_EL1).
321 ID_AA64DFR1_EL1,
322 /// The value that identifies instruction set attribute register 0, EL1 (ISAR0_EL1).
323 ID_AA64ISAR0_EL1,
324 /// The value that identifies instruction set attribute register 1, EL1 (ISAR_EL1).
325 ID_AA64ISAR1_EL1,
326 /// The value that identifies memory model feature register 0, EL1(MMFR0_EL1).
327 ID_AA64MMFR0_EL1,
328 /// The value that identifies memory model feature register 1, EL1 (MMFR1_EL1).
329 ID_AA64MMFR1_EL1,
330 /// The value that identifies memory model feature register 2, EL1 (MMFR2_EL1).
331 ID_AA64MMFR2_EL1,
332 /// The value that identifies processor feature register 0, EL1 (PFR0_EL1).
333 ID_AA64PFR0_EL1,
334 /// The value that identifies processor feature register 1, EL1 (PFR1_EL1).
335 ID_AA64PFR1_EL1,
336 /// The value that describes Cache Type Register, EL0.
337 CTR_EL0,
338 /// The value that describes Cache Level ID Register, EL1.
339 CLIDR_EL1,
340 /// The values that describes Data Cache Zero ID Register, EL0.
341 DCZID_EL0,
342 /// The value that describes Scalable Matrix Extension (SME) Feature ID Register 0.
343 #[cfg(feature = "macos-15-2")]
344 ID_AA64SMFR0_EL1,
345 /// The value that describes Scalable Vector Extension instruction (SVE) Feature ID register 0.
346 #[cfg(feature = "macos-15-2")]
347 ID_AA64ZFR0_EL1,
348}
349
350/// The structure that describes an instruction or data cache element.
351#[repr(C)]
352#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
353pub enum hv_cache_type_t {
354 /// The value that describes a cached data value.
355 DATA,
356 /// The value that describes a cached instuction value.
357 INSTRUCTION,
358}
359
360unsafe extern "C" {
361 /// Creates a vCPU configuration object.
362 ///
363 /// # Return
364 ///
365 /// A new vCPU configuration object.
366 pub fn hv_vcpu_config_create() -> hv_vcpu_config_t;
367
368 /// Gets the value of a feature register.
369 ///
370 /// # Parameters
371 ///
372 /// * `config`: The vCPU configuration.
373 /// * `feature_reg`: The ID of the feature register.
374 /// * `value`: The value of `feature_reg` on output. Undefined if the call doesn’t succeed.
375 ///
376 /// # Return Value
377 ///
378 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
379 /// [`hv_return_t`].
380 pub fn hv_vcpu_config_get_feature_reg(
381 config: hv_vcpu_config_t,
382 feature_reg: hv_feature_reg_t,
383 value: *mut u64,
384 ) -> hv_return_t;
385
386 /// Returns the Cache Size ID Register (CCSIDR_EL1) values for the vCPU configuration and
387 /// cache type you specify.
388 ///
389 /// # Parameters
390 ///
391 /// * `config`: The vCPU configuration.
392 /// * `cache_type`: The cache type from the available [`hv_cache_type_t`] types.
393 /// * `values`: A pointer to the location for the return values.
394 ///
395 /// # Return Value
396 ///
397 /// A [`hv_return_t`] value that indicates that result of the function.
398 pub fn hv_vcpu_config_get_ccsidr_el1_sys_reg_values(
399 config: hv_vcpu_config_t,
400 cache_type: hv_cache_type_t,
401 values: *mut u64,
402 ) -> hv_return_t;
403}
404
405// -----------------------------------------------------------------------------------------------
406// vCPU Management - Creation and Destruction
407// -----------------------------------------------------------------------------------------------
408
409/// An opaque value that represents a vCPU instance.
410pub type hv_vcpu_t = u64;
411
412/// The structure that describes information about an exit from the virtual CPU (vCPU) to the host.
413#[repr(C)]
414#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
415pub struct hv_vcpu_exit_exception_t {
416 /// The vCPU exception syndrome causing the exception.
417 pub syndrome: u64,
418 /// The vCPU virtual address of the exception.
419 pub virtual_address: u64,
420 /// The intermediate physical address of the exception in the client.
421 pub physical_address: u64,
422}
423
424/// The type that describes the event that triggered a guest exit to the host.
425#[repr(C)]
426#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
427pub enum hv_exit_reason_t {
428 /// The value that identifies exits requested by exit handler on the host.
429 CANCELED,
430 /// The value that identifies traps caused by the guest operations.
431 EXCEPTION,
432 /// The value that identifies when the virtual timer enters the pending state.
433 VTIMER_ACTIVATED,
434 /// The value that identifies unexpected exits.
435 UNKNOWN,
436}
437
438/// Information about an exit from the vCPU to the host.
439#[repr(C)]
440#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
441pub struct hv_vcpu_exit_t {
442 /// Information about an exit from the vcpu to the host.
443 pub reason: hv_exit_reason_t,
444 /// Information about an exit exception from the vcpu to the host.
445 pub exception: hv_vcpu_exit_exception_t,
446}
447
448unsafe extern "C" {
449 /// Returns the maximum number of vCPUs that the hypervisor supports.
450 ///
451 /// # Parameters
452 ///
453 /// * `max_vcpu_count`: The maximum number of vCPUs on output. Undefined if the call doesn’t
454 /// succeed.
455 ///
456 /// # Return Value
457 ///
458 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
459 /// [`hv_return_t`].
460 pub fn hv_vm_get_max_vcpu_count(max_vcpu_count: *mut u32) -> hv_return_t;
461
462 /// Creates a vCPU instance for the current thread.
463 ///
464 /// # Parameters
465 ///
466 /// * `vcpu`: An argument that the hypervisor populates with the instance of a vCPU on a
467 /// successful return.
468 /// * `exit`: The pointer to the vCPU exit information. The function hv_vcpu_run updates this
469 /// structure on return.
470 /// * `config`: The configuration of the vCPU or nil for a default configuration.
471 ///
472 /// # Return Value
473 ///
474 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
475 /// [`hv_return_t`].
476 pub fn hv_vcpu_create(
477 vcpu: *mut hv_vcpu_t,
478 exit: *mut *const hv_vcpu_exit_t,
479 config: hv_vcpu_config_t,
480 ) -> hv_return_t;
481
482 /// Destroys the vCPU instance associated with the current thread.
483 ///
484 /// # Parameters
485 ///
486 /// * `vcpu`: The instance of the vCPU.
487 ///
488 /// # Return Value
489 ///
490 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
491 /// [`hv_return_t`].
492 pub fn hv_vcpu_destroy(vcpu: hv_vcpu_t) -> hv_return_t;
493}
494
495// -----------------------------------------------------------------------------------------------
496// vCPU Management - Runtime
497// -----------------------------------------------------------------------------------------------
498
499/// The type that defines the vCPU’s interrupts.
500#[repr(C)]
501#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
502pub enum hv_interrupt_type_t {
503 /// ARM Fast Interrupt Request.
504 FIQ,
505 /// ARM Interrupt Request.
506 IRQ,
507}
508
509unsafe extern "C" {
510 /// Starts the execution of a vCPU.
511 ///
512 /// # Parameters
513 ///
514 /// * `vcpu`: The instance of the vCPU.
515 ///
516 /// # Return Value
517 ///
518 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
519 /// [`hv_return_t`].
520 pub fn hv_vcpu_run(vcpu: hv_vcpu_t) -> hv_return_t;
521
522 /// Forces an immediate exit of a set of vCPUs of the VM.
523 ///
524 /// # Parameters
525 ///
526 /// * `vcpus`: An array of vCPU instances.
527 /// * `vcpu_count`: The number of vCPUs in the array.
528 ///
529 /// # Return Value
530 ///
531 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
532 /// [`hv_return_t`].
533 pub fn hv_vcpus_exit(vcpus: *const hv_vcpu_t, vcpu_count: u32) -> hv_return_t;
534
535 /// Gets pending interrupts for a vCPU.
536 ///
537 /// # Parameters
538 ///
539 /// * `vcpu`: The instance of the vCPU.
540 /// * `type`: The interrupt from Interrupt Constants.
541 /// * `pending`: A variable that indicates whether, on output, the interrupt of type is
542 /// pending or not.
543 ///
544 /// # Return Value
545 ///
546 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
547 /// [`hv_return_t`].
548 pub fn hv_vcpu_get_pending_interrupt(
549 vcpu: hv_vcpu_t,
550 _type: hv_interrupt_type_t,
551 pending: *mut bool,
552 ) -> hv_return_t;
553
554 /// Sets pending interrupts for a vCPU.
555 ///
556 /// # Parameters
557 ///
558 /// * `vcpu`: The instance of the vCPU.
559 /// * `type`: The interrupt from Interrupt Constants.
560 /// * `pending`: A Boolean that indicates whether the interrupt is pending.
561 ///
562 /// # Return Value
563 ///
564 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
565 /// [`hv_return_t`].
566 pub fn hv_vcpu_set_pending_interrupt(
567 vcpu: hv_vcpu_t,
568 _type: hv_interrupt_type_t,
569 pending: bool,
570 ) -> hv_return_t;
571
572 /// Returns, by reference, the cumulative execution time of a vCPU, in nanoseconds.
573 ///
574 /// # Parameters
575 ///
576 /// * `vcpu`: The instance of the vCPU.
577 /// * `time`: The execution time on output, in nanoseconds.
578 ///
579 /// # Return Value
580 ///
581 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
582 /// [`hv_return_t`].
583 pub fn hv_vcpu_get_exec_time(vcpu: hv_vcpu_t, time: *mut u64) -> hv_return_t;
584}
585
586// -----------------------------------------------------------------------------------------------
587// vCPU Management - General Registers
588// -----------------------------------------------------------------------------------------------
589
590/// The type that defines general registers.
591#[repr(C)]
592#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
593pub enum hv_reg_t {
594 /// The value that identifies register X0.
595 X0,
596 /// The value that identifies register X1.
597 X1,
598 /// The value that identifies register X2.
599 X2,
600 /// The value that identifies register X3.
601 X3,
602 /// The value that identifies register X4.
603 X4,
604 /// The value that identifies register X5.
605 X5,
606 /// The value that identifies register X6.
607 X6,
608 /// The value that identifies register X7.
609 X7,
610 /// The value that identifies register X8.
611 X8,
612 /// The value that identifies register X9.
613 X9,
614 /// The value that identifies register X10.
615 X10,
616 /// The value that identifies register X11.
617 X11,
618 /// The value that identifies register X12.
619 X12,
620 /// The value that identifies register X13.
621 X13,
622 /// The value that identifies register X14.
623 X14,
624 /// The value that identifies register X15.
625 X15,
626 /// The value that identifies register X16.
627 X16,
628 /// The value that identifies register X17.
629 X17,
630 /// The value that identifies register X18.
631 X18,
632 /// The value that identifies register X19.
633 X19,
634 /// The value that identifies register X20.
635 X20,
636 /// The value that identifies register X21.
637 X21,
638 /// The value that identifies register X22.
639 X22,
640 /// The value that identifies register X23.
641 X23,
642 /// The value that identifies register X24.
643 X24,
644 /// The value that identifies register X25.
645 X25,
646 /// The value that identifies register X26.
647 X26,
648 /// The value that identifies register X27.
649 X27,
650 /// The value that identifies register X28.
651 X28,
652 /// The value that identifies register X29.
653 X29,
654 /// The value that identifies register X30.
655 X30,
656 /// The value that identifies the program counter (PC).
657 PC,
658 /// The value that identifies the floating-point control register (FPCR).
659 FPCR,
660 /// The value that identifies the floating-point status register (FPSR).
661 FPSR,
662 /// The value that identifies the current program status register (CPSR).
663 CPSR,
664}
665
666impl hv_reg_t {
667 /// The value that identifies the frame pointer (FP).
668 pub const FP: Self = Self::X29;
669 /// The value that identifies the link register (LR).
670 pub const LR: Self = Self::X30;
671}
672
673unsafe extern "C" {
674 /// Gets the current value of a vCPU register.
675 ///
676 /// # Parameters
677 ///
678 /// * `vcpu`: The vCPU instance.
679 /// * `reg`: The ID of the general register.
680 /// * `value`: The value of the register reg on output.
681 ///
682 /// # Return Value
683 ///
684 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
685 /// [`hv_return_t`].
686 pub fn hv_vcpu_get_reg(vcpu: hv_vcpu_t, reg: hv_reg_t, value: *mut u64) -> hv_return_t;
687
688 /// Sets the value of a vCPU register.
689 ///
690 /// # Parameters
691 ///
692 /// * `vcpu`: The vCPU instance.
693 /// * `reg`: The ID of the general register.
694 /// * `value`: The new value of the register.
695 ///
696 /// # Return Value
697 ///
698 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
699 /// [`hv_return_t`].
700 pub fn hv_vcpu_set_reg(vcpu: hv_vcpu_t, reg: hv_reg_t, value: u64) -> hv_return_t;
701}
702
703// -----------------------------------------------------------------------------------------------
704// vCPU Management - SIMD & Floating-Point Registers
705// -----------------------------------------------------------------------------------------------
706
707/// The value that represents an ARM SIMD and FP register.
708#[cfg(feature = "simd-nightly")]
709pub type hv_simd_fp_uchar16_t = std::simd::u8x16;
710#[cfg(not(feature = "simd-nightly"))]
711pub type hv_simd_fp_uchar16_t = u128;
712
713/// The type that defines SIMD and floating-point registers.
714#[repr(C)]
715#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
716pub enum hv_simd_fp_reg_t {
717 /// The value representing SIMD register Q0.
718 Q0,
719 /// The value representing SIMD register Q1.
720 Q1,
721 /// The value representing SIMD register Q2.
722 Q2,
723 /// The value representing SIMD register Q3.
724 Q3,
725 /// The value representing SIMD register Q4.
726 Q4,
727 /// The value representing SIMD register Q5.
728 Q5,
729 /// The value representing SIMD register Q6.
730 Q6,
731 /// The value representing SIMD register Q7.
732 Q7,
733 /// The value representing SIMD register Q8.
734 Q8,
735 /// The value representing SIMD register Q9.
736 Q9,
737 /// The value representing SIMD register Q10.
738 Q10,
739 /// The value representing SIMD register Q11.
740 Q11,
741 /// The value representing SIMD register Q12.
742 Q12,
743 /// The value representing SIMD register Q13.
744 Q13,
745 /// The value representing SIMD register Q14.
746 Q14,
747 /// The value representing SIMD register Q15.
748 Q15,
749 /// The value representing SIMD register Q16.
750 Q16,
751 /// The value representing SIMD register Q17.
752 Q17,
753 /// The value representing SIMD register Q18.
754 Q18,
755 /// The value representing SIMD register Q19.
756 Q19,
757 /// The value representing SIMD register Q20.
758 Q20,
759 /// The value representing SIMD register Q21.
760 Q21,
761 /// The value representing SIMD register Q22.
762 Q22,
763 /// The value representing SIMD register Q23.
764 Q23,
765 /// The value representing SIMD register Q24.
766 Q24,
767 /// The value representing SIMD register Q25.
768 Q25,
769 /// The value representing SIMD register Q26.
770 Q26,
771 /// The value representing SIMD register Q27.
772 Q27,
773 /// The value representing SIMD register Q28.
774 Q28,
775 /// The value representing SIMD register Q29.
776 Q29,
777 /// The value representing SIMD register Q30.
778 Q30,
779 /// The value representing SIMD register Q31.
780 Q31,
781}
782
783unsafe extern "C" {
784 /// Gets the current value of a vCPU SIMD and FP register.
785 ///
786 /// # Parameters
787 ///
788 /// * `vcpu`: The vCPU instance.
789 /// * `reg`: The ID of the SIMD and FP register.
790 /// * `value`: The value of the register reg on output.
791 ///
792 /// # Return Value
793 ///
794 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
795 /// [`hv_return_t`].
796 pub fn hv_vcpu_get_simd_fp_reg(
797 vcpu: hv_vcpu_t,
798 reg: hv_simd_fp_reg_t,
799 value: *mut hv_simd_fp_uchar16_t,
800 ) -> hv_return_t;
801
802 /// Sets the value of a vCPU SIMD&FP register.
803 ///
804 /// # Parameters
805 ///
806 /// * `vcpu`: The vCPU instance.
807 /// * `reg`: The ID of the SIMD and FP register.
808 /// * `value`: The new value of the register.
809 ///
810 /// # Return Value
811 ///
812 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
813 /// [`hv_return_t`].
814 pub fn hv_vcpu_set_simd_fp_reg(
815 vcpu: hv_vcpu_t,
816 reg: hv_simd_fp_reg_t,
817 value: hv_simd_fp_uchar16_t,
818 ) -> hv_return_t;
819}
820
821// -----------------------------------------------------------------------------------------------
822// vCPU Management - SVE & SME
823// -----------------------------------------------------------------------------------------------
824
825/// Contains information about SME PSTATE.
826#[cfg(feature = "macos-15-2")]
827#[repr(C)]
828#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default)]
829pub struct hv_vcpu_sme_state_t {
830 /// Controls `PSTATE.SM`.
831 pub streaming_sve_mode_enabled: bool,
832 /// Controls `PSTATE.ZA`.
833 pub za_storage_enabled: bool,
834}
835
836/// Type of an ARM SME Z vector register.
837#[cfg(feature = "macos-15-2")]
838#[repr(C)]
839#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
840pub enum hv_sme_z_reg_t {
841 /// The value representing the streaming vector register Z0.
842 Z0,
843 /// The value representing the streaming vector register Z1.
844 Z1,
845 /// The value representing the streaming vector register Z2.
846 Z2,
847 /// The value representing the streaming vector register Z3.
848 Z3,
849 /// The value representing the streaming vector register Z4.
850 Z4,
851 /// The value representing the streaming vector register Z5.
852 Z5,
853 /// The value representing the streaming vector register Z6.
854 Z6,
855 /// The value representing the streaming vector register Z7.
856 Z7,
857 /// The value representing the streaming vector register Z8.
858 Z8,
859 /// The value representing the streaming vector register Z9.
860 Z9,
861 /// The value representing the streaming vector register Z10.
862 Z10,
863 /// The value representing the streaming vector register Z11.
864 Z11,
865 /// The value representing the streaming vector register Z12.
866 Z12,
867 /// The value representing the streaming vector register Z13.
868 Z13,
869 /// The value representing the streaming vector register Z14.
870 Z14,
871 /// The value representing the streaming vector register Z15.
872 Z15,
873 /// The value representing the streaming vector register Z16.
874 Z16,
875 /// The value representing the streaming vector register Z17.
876 Z17,
877 /// The value representing the streaming vector register Z18.
878 Z18,
879 /// The value representing the streaming vector register Z19.
880 Z19,
881 /// The value representing the streaming vector register Z20.
882 Z20,
883 /// The value representing the streaming vector register Z21.
884 Z21,
885 /// The value representing the streaming vector register Z22.
886 Z22,
887 /// The value representing the streaming vector register Z23.
888 Z23,
889 /// The value representing the streaming vector register Z24.
890 Z24,
891 /// The value representing the streaming vector register Z25.
892 Z25,
893 /// The value representing the streaming vector register Z26.
894 Z26,
895 /// The value representing the streaming vector register Z27.
896 Z27,
897 /// The value representing the streaming vector register Z28.
898 Z28,
899 /// The value representing the streaming vector register Z29.
900 Z29,
901 /// The value representing the streaming vector register Z30.
902 Z30,
903 /// The value representing the streaming vector register Z31.
904 Z31,
905}
906
907/// Type of an ARM SME P predicate register.
908#[cfg(feature = "macos-15-2")]
909#[repr(C)]
910#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
911pub enum hv_sme_p_reg_t {
912 /// The value representing the streaming predicate register P0.
913 P0,
914 /// The value representing the streaming predicate register P1.
915 P1,
916 /// The value representing the streaming predicate register P2.
917 P2,
918 /// The value representing the streaming predicate register P3.
919 P3,
920 /// The value representing the streaming predicate register P4.
921 P4,
922 /// The value representing the streaming predicate register P5.
923 P5,
924 /// The value representing the streaming predicate register P6.
925 P6,
926 /// The value representing the streaming predicate register P7.
927 P7,
928 /// The value representing the streaming predicate register P8.
929 P8,
930 /// The value representing the streaming predicate register P9.
931 P9,
932 /// The value representing the streaming predicate register P10.
933 P10,
934 /// The value representing the streaming predicate register P11.
935 P11,
936 /// The value representing the streaming predicate register P12.
937 P12,
938 /// The value representing the streaming predicate register P13.
939 P13,
940 /// The value representing the streaming predicate register P14.
941 P14,
942 /// The value representing the streaming predicate register P15.
943 P15,
944}
945
946/// Type of the SME2 ZT0 register.
947#[cfg(all(feature = "macos-15-2", not(feature = "simd-nightly")))]
948pub type hv_sme_zt0_uchar64_t = [u8; 64];
949#[cfg(all(feature = "macos-15-2", feature = "simd-nightly"))]
950pub type hv_sme_zt0_uchar64_t = std::simd::u8x64;
951
952unsafe extern "C" {
953 /// Returns the value of the maximum Streaming Vector Length (SVL) in bytes.
954 ///
955 /// # Discussion
956 ///
957 /// This is the maximum SVL that guests may use and separate from the effective SVL that
958 /// guests may set using `SMCR_EL1`.
959 ///
960 /// # Parameters
961 ///
962 /// * `value`: Pointer to the value.
963 ///
964 /// # Return Value
965 ///
966 /// - Returns `HV_UNSUPPORTED` if SME is not supported.
967 /// - `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
968 /// [`hv_return_t`].
969 #[cfg(feature = "macos-15-2")]
970 pub fn hv_sme_config_get_max_svl_bytes(value: *mut libc::size_t) -> hv_return_t;
971
972 /// Gets the current SME state consisting of the streaming SVE mode (`PSTATE.SM`) and ZA
973 /// storage enable (`PSTATE.ZA`).
974 ///
975 /// # Discussion
976 ///
977 /// Must be called by the owning thread.
978 ///
979 /// In streaming SVE mode, the SIMD Q registers are aliased to the bottom 128 bits of the
980 /// corresponding Z register, and any modification will reflect on the Z register state.
981 ///
982 /// # Parameters
983 ///
984 /// * `vcpu`: ID of the vCPU instance.
985 /// * `sme_state`: Pointer to the SME state.
986 ///
987 /// # Return Value
988 ///
989 /// - Returns `HV_UNSUPPORTED` if SME is not supported.
990 /// - `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
991 /// [`hv_return_t`].
992 #[cfg(feature = "macos-15-2")]
993 pub fn hv_vcpu_get_sme_state(
994 vcpu: hv_vcpu_t,
995 sme_state: *mut hv_vcpu_sme_state_t,
996 ) -> hv_return_t;
997
998 /// Sets the SME state consisting of the streaming SVE mode and ZA storage enable.
999 ///
1000 /// # Discussion
1001 ///
1002 /// Must be called by the owning thread.
1003 ///
1004 /// For any entry or exit from streaming SVE mode, all Z vector and P predicate registers
1005 /// are set to zero, and all FPSR flags are set; this state must be saved if it needs to be
1006 /// retained across streaming SVE mode transitions.
1007 ///
1008 /// In streaming SVE mode, the SIMD Q registers are aliased to the bottom 128 bits of the
1009 /// corresponding Z register, and any modification will reflect on the Z register state.
1010 ///
1011 /// If the optional `FEAT_SME_FA64` is implemented, the full SIMD instruction set is supported
1012 /// in streaming SVE mode; otherwise many legacy SIMD instructions are illegal in this mode.
1013 ///
1014 /// When finished, disable streaming SVE mode and ZA storage; this serves as a power-down
1015 /// hint for SME-related hardware.
1016 ///
1017 /// # Parameters
1018 ///
1019 /// * `vcpu`: ID of the vCPU instance.
1020 /// * `sme_state`: Pointer to the SME state to set.
1021 ///
1022 /// # Return Value
1023 ///
1024 /// - Returns `HV_UNSUPPORTED` if SME is not supported.
1025 /// - `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1026 /// [`hv_return_t`].
1027 #[cfg(feature = "macos-15-2")]
1028 pub fn hv_vcpu_set_sme_state(
1029 vcpu: hv_vcpu_t,
1030 sme_state: *const hv_vcpu_sme_state_t,
1031 ) -> hv_return_t;
1032
1033 /// Returns the value of a vCPU Z vector register in streaming SVE mode.
1034 ///
1035 /// # Discussion
1036 ///
1037 /// Must be called by the owning thread.
1038 ///
1039 /// # Parameters
1040 ///
1041 /// * `vcpu`: ID of the vCPU instance.
1042 /// * `reg`: ID of the Z vector register.
1043 /// * `value`: Pointer to the retrieved register value.
1044 /// * `length`: The length (in bytes) of the provided value storage.
1045 ///
1046 /// # Return Value
1047 ///
1048 /// - `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1049 /// [`hv_return_t`].
1050 /// - Returns an error if not in streaming SVE mode (i.e. `streaming_sve_mode_enabled` is
1051 /// false), or if the provided value storage is not maximum SVL bytes.
1052 #[cfg(feature = "macos-15-2")]
1053 pub fn hv_vcpu_get_sme_z_reg(
1054 vcpu: hv_vcpu_t,
1055 reg: hv_sme_z_reg_t,
1056 value: *mut u8,
1057 length: libc::size_t,
1058 ) -> hv_return_t;
1059
1060 /// Sets the value of a vCPU Z vector register in streaming SVE mode.
1061 ///
1062 /// # Discussion
1063 ///
1064 /// Must be called by the owning thread.
1065 ///
1066 /// # Parameters
1067 ///
1068 /// * `vcpu`: ID of the vCPU instance.
1069 /// * `reg`: ID of the Z vector register.
1070 /// * `value`: Pointer to the register value to set.
1071 /// * `length`: The length (in bytes) of the Z register value.
1072 ///
1073 /// # Return Value
1074 ///
1075 /// - `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1076 /// [`hv_return_t`].
1077 /// - Returns an error if not in streaming SVE mode (i.e. `streaming_sve_mode_enabled` is
1078 /// false), or if the value length is not maximum SVL bytes.
1079 #[cfg(feature = "macos-15-2")]
1080 pub fn hv_vcpu_set_sme_z_reg(
1081 vcpu: hv_vcpu_t,
1082 reg: hv_sme_z_reg_t,
1083 value: *const u8,
1084 length: libc::size_t,
1085 ) -> hv_return_t;
1086
1087 /// Returns the value of a vCPU P predicate register in streaming SVE mode.
1088 ///
1089 /// # Discussion
1090 ///
1091 /// Must be called by the owning thread.
1092 ///
1093 /// # Parameters
1094 ///
1095 /// * `vcpu`: ID of the vCPU instance.
1096 /// * `reg`: ID of the P vector register.
1097 /// * `value`: Pointer to the retrieved register value.
1098 /// * `length`: The length (in bytes) of the provided value storage.
1099 ///
1100 /// # Return Value
1101 ///
1102 /// - `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1103 /// [`hv_return_t`].
1104 /// - Returns an error if not in streaming SVE mode (i.e. `streaming_sve_mode_enabled` is
1105 /// false), or if the provided value storage is not maximum SVL bytes.
1106 #[cfg(feature = "macos-15-2")]
1107 pub fn hv_vcpu_get_sme_p_reg(
1108 vcpu: hv_vcpu_t,
1109 reg: hv_sme_p_reg_t,
1110 value: *mut u8,
1111 length: libc::size_t,
1112 ) -> hv_return_t;
1113
1114 /// Sets the value of a vCPU P predicate register in streaming SVE mode.
1115 ///
1116 /// # Discussion
1117 ///
1118 /// Must be called by the owning thread.
1119 ///
1120 /// # Parameters
1121 ///
1122 /// * `vcpu`: ID of the vCPU instance.
1123 /// * `reg`: ID of the P vector register.
1124 /// * `value`: Pointer to the register value to set.
1125 /// * `length`: The length (in bytes) of the P register value.
1126 ///
1127 /// # Return Value
1128 ///
1129 /// - `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1130 /// [`hv_return_t`].
1131 /// - Returns an error if not in streaming SVE mode (i.e. `streaming_sve_mode_enabled` is
1132 /// false), or if the value length is not maximum SVL bytes.
1133 #[cfg(feature = "macos-15-2")]
1134 pub fn hv_vcpu_set_sme_p_reg(
1135 vcpu: hv_vcpu_t,
1136 reg: hv_sme_p_reg_t,
1137 value: *const u8,
1138 length: libc::size_t,
1139 ) -> hv_return_t;
1140
1141 /// Returns the value of the vCPU ZA matrix register in streaming SVE mode.
1142 ///
1143 /// # Discussion
1144 ///
1145 /// Must be called by the owning thread.
1146 ///
1147 /// Does not require streaming SVE mode enabled.
1148 ///
1149 /// # Parameters
1150 ///
1151 /// * `vcpu`: ID of the vCPU instance.
1152 /// * `value`: Pointer to the retrieved register value.
1153 /// * `length`: The length (in bytes) of the provided value storage.
1154 ///
1155 /// # Return Value
1156 ///
1157 /// - `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1158 /// [`hv_return_t`].
1159 /// - Returns an error if `PSTATE.ZA` is 0 (i.e. `za_storage_enabled` is false), or if the
1160 /// provided value storage is not [maximum SVL bytes x maximum SVL bytes].
1161 #[cfg(feature = "macos-15-2")]
1162 pub fn hv_vcpu_get_sme_za_reg(
1163 vcpu: hv_vcpu_t,
1164 value: *mut u8,
1165 length: libc::size_t,
1166 ) -> hv_return_t;
1167
1168 /// Sets the value of the vCPU ZA matrix register in streaming SVE mode.
1169 ///
1170 /// # Discussion
1171 ///
1172 /// Must be called by the owning thread.
1173 ///
1174 /// # Parameters
1175 ///
1176 /// * `vcpu`: ID of the vCPU instance.
1177 /// * `value`: Pointer to the register value to set.
1178 /// * `length`: The length (in bytes) of the provided ZA register value.
1179 ///
1180 /// # Return Value
1181 ///
1182 /// - `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1183 /// [`hv_return_t`].
1184 /// - Returns an error if `PSTATE.ZA` is 0 (i.e. `za_storage_enabled` is false), or if the
1185 /// value length is not [maximum SVL bytes x maximum SVL bytes].
1186 #[cfg(feature = "macos-15-2")]
1187 pub fn hv_vcpu_set_sme_za_reg(
1188 vcpu: hv_vcpu_t,
1189 value: *const u8,
1190 length: libc::size_t,
1191 ) -> hv_return_t;
1192
1193 /// Returns the current value of the vCPU ZT0 register in streaming SVE mode.
1194 ///
1195 /// # Discussion
1196 ///
1197 /// Must be called by the owning thread.
1198 ///
1199 /// Does not require streaming SVE mode enabled.
1200 ///
1201 /// # Parameters
1202 ///
1203 /// * `vcpu`: ID of the vCPU instance.
1204 /// * `value`: Pointer to the retrieved register value.
1205 ///
1206 /// # Return Value
1207 ///
1208 /// - `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1209 /// [`hv_return_t`].
1210 /// - Returns an error if `PSTATE.ZA` is 0 (i.e. `za_storage_enabled` is false).
1211 #[cfg(feature = "macos-15-2")]
1212 pub fn hv_vcpu_get_sme_zt0_reg(vcpu: hv_vcpu_t, value: *mut u8) -> hv_return_t;
1213
1214 /// Sets the value of the vCPU ZT0 register in streaming SVE mode.
1215 ///
1216 /// # Discussion
1217 ///
1218 /// Must be called by the owning thread.
1219 ///
1220 /// # Parameters
1221 ///
1222 /// * `vcpu`: ID of the vCPU instance.
1223 /// * `value`: Pointer to the register value to set.
1224 ///
1225 /// # Return Value
1226 ///
1227 /// - `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1228 /// [`hv_return_t`].
1229 /// - Returns an error if `PSTATE.ZA` is 0 (i.e. `za_storage_enabled` is false).
1230 #[cfg(feature = "macos-15-2")]
1231 pub fn hv_vcpu_set_sme_zt0_reg(vcpu: hv_vcpu_t, value: *const u8) -> hv_return_t;
1232}
1233
1234// -----------------------------------------------------------------------------------------------
1235// vCPU Management - System Registers
1236// -----------------------------------------------------------------------------------------------
1237
1238/// The type of system registers.
1239#[repr(C)]
1240#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
1241pub enum hv_sys_reg_t {
1242 /// The value that represents the system register DBGBVR0_EL1.
1243 DBGBVR0_EL1 = 0x8004,
1244 /// The value that represents the system register DBGBCR0_EL1.
1245 DBGBCR0_EL1 = 0x8005,
1246 /// The value that represents the system register DBGWVR0_EL1.
1247 DBGWVR0_EL1 = 0x8006,
1248 /// The value that represents the system register DBGWCR0_EL1.
1249 DBGWCR0_EL1 = 0x8007,
1250 /// The value that represents the system register DBGBVR1_EL1.
1251 DBGBVR1_EL1 = 0x800c,
1252 /// The value that represents the system register DBGBCR1_EL1.
1253 DBGBCR1_EL1 = 0x800d,
1254 /// The value that represents the system register DBGWVR1_EL1.
1255 DBGWVR1_EL1 = 0x800e,
1256 /// The value that represents the system register DBGWCR1_EL1.
1257 DBGWCR1_EL1 = 0x800f,
1258 /// The value that represents the system register MDCCINT_EL1.
1259 MDCCINT_EL1 = 0x8010,
1260 /// The value that represents the system register MDSCR_EL1.
1261 MDSCR_EL1 = 0x8012,
1262 /// The value that represents the system register DBGBVR2_EL1.
1263 DBGBVR2_EL1 = 0x8014,
1264 /// The value that represents the system register DBGBCR2_EL1.
1265 DBGBCR2_EL1 = 0x8015,
1266 /// The value that represents the system register DBGWVR2_EL1.
1267 DBGWVR2_EL1 = 0x8016,
1268 /// The value that represents the system register DBGWCR2_EL1.
1269 DBGWCR2_EL1 = 0x8017,
1270 /// The value that represents the system register DBGBVR3_EL1.
1271 DBGBVR3_EL1 = 0x801c,
1272 /// The value that represents the system register DBGBCR3_EL1.
1273 DBGBCR3_EL1 = 0x801d,
1274 /// The value that represents the system register DBGWVR3_EL1.
1275 DBGWVR3_EL1 = 0x801e,
1276 /// The value that represents the system register DBGWCR3_EL1.
1277 DBGWCR3_EL1 = 0x801f,
1278 /// The value that represents the system register DBGBVR4_EL1.
1279 DBGBVR4_EL1 = 0x8024,
1280 /// The value that represents the system register DBGBCR4_EL1.
1281 DBGBCR4_EL1 = 0x8025,
1282 /// The value that represents the system register DBGWVR4_EL1.
1283 DBGWVR4_EL1 = 0x8026,
1284 /// The value that represents the system register DBGWCR4_EL1.
1285 DBGWCR4_EL1 = 0x8027,
1286 /// The value that represents the system register DBGBVR5_EL1.
1287 DBGBVR5_EL1 = 0x802c,
1288 /// The value that represents the system register DBGBCR5_EL1.
1289 DBGBCR5_EL1 = 0x802d,
1290 /// The value that represents the system register DBGWVR5_EL1.
1291 DBGWVR5_EL1 = 0x802e,
1292 /// The value that represents the system register DBGWCR5_EL1.
1293 DBGWCR5_EL1 = 0x802f,
1294 /// The value that represents the system register DBGBVR6_EL1.
1295 DBGBVR6_EL1 = 0x8034,
1296 /// The value that represents the system register DBGBCR6_EL1.
1297 DBGBCR6_EL1 = 0x8035,
1298 /// The value that represents the system register DBGWVR6_EL1.
1299 DBGWVR6_EL1 = 0x8036,
1300 /// The value that represents the system register DBGWCR6_EL1.
1301 DBGWCR6_EL1 = 0x8037,
1302 /// The value that represents the system register DBGBVR7_EL1.
1303 DBGBVR7_EL1 = 0x803c,
1304 /// The value that represents the system register DBGBCR7_EL1.
1305 DBGBCR7_EL1 = 0x803d,
1306 /// The value that represents the system register DBGWVR7_EL1.
1307 DBGWVR7_EL1 = 0x803e,
1308 /// The value that represents the system register DBGWCR7_EL1.
1309 DBGWCR7_EL1 = 0x803f,
1310 /// The value that represents the system register DBGBVR8_EL1.
1311 DBGBVR8_EL1 = 0x8044,
1312 /// The value that represents the system register DBGBCR8_EL1.
1313 DBGBCR8_EL1 = 0x8045,
1314 /// The value that represents the system register DBGWVR8_EL1.
1315 DBGWVR8_EL1 = 0x8046,
1316 /// The value that represents the system register DBGWCR8_EL1.
1317 DBGWCR8_EL1 = 0x8047,
1318 /// The value that represents the system register DBGBVR9_EL1.
1319 DBGBVR9_EL1 = 0x804c,
1320 /// The value that represents the system register DBGBCR9_EL1.
1321 DBGBCR9_EL1 = 0x804d,
1322 /// The value that represents the system register DBGWVR9_EL1.
1323 DBGWVR9_EL1 = 0x804e,
1324 /// The value that represents the system register DBGWCR9_EL1.
1325 DBGWCR9_EL1 = 0x804f,
1326 /// The value that represents the system register DBGBVR10_EL1.
1327 DBGBVR10_EL1 = 0x8054,
1328 /// The value that represents the system register DBGBCR10_EL1.
1329 DBGBCR10_EL1 = 0x8055,
1330 /// The value that represents the system register DBGWVR10_EL1.
1331 DBGWVR10_EL1 = 0x8056,
1332 /// The value that represents the system register DBGWCR10_EL1.
1333 DBGWCR10_EL1 = 0x8057,
1334 /// The value that represents the system register DBGBVR11_EL1.
1335 DBGBVR11_EL1 = 0x805c,
1336 /// The value that represents the system register DBGBCR11_EL1.
1337 DBGBCR11_EL1 = 0x805d,
1338 /// The value that represents the system register DBGWVR11_EL1.
1339 DBGWVR11_EL1 = 0x805e,
1340 /// The value that represents the system register DBGWCR11_EL1.
1341 DBGWCR11_EL1 = 0x805f,
1342 /// The value that represents the system register DBGBVR12_EL1.
1343 DBGBVR12_EL1 = 0x8064,
1344 /// The value that represents the system register DBGBCR12_EL1.
1345 DBGBCR12_EL1 = 0x8065,
1346 /// The value that represents the system register DBGWVR12_EL1.
1347 DBGWVR12_EL1 = 0x8066,
1348 /// The value that represents the system register DBGWCR12_EL1.
1349 DBGWCR12_EL1 = 0x8067,
1350 /// The value that represents the system register DBGBVR13_EL1.
1351 DBGBVR13_EL1 = 0x806c,
1352 /// The value that represents the system register DBGBCR13_EL1.
1353 DBGBCR13_EL1 = 0x806d,
1354 /// The value that represents the system register DBGWVR13_EL1.
1355 DBGWVR13_EL1 = 0x806e,
1356 /// The value that represents the system register DBGWCR13_EL1.
1357 DBGWCR13_EL1 = 0x806f,
1358 /// The value that represents the system register DBGBVR14_EL1.
1359 DBGBVR14_EL1 = 0x8074,
1360 /// The value that represents the system register DBGBCR14_EL1.
1361 DBGBCR14_EL1 = 0x8075,
1362 /// The value that represents the system register DBGWVR14_EL1.
1363 DBGWVR14_EL1 = 0x8076,
1364 /// The value that represents the system register DBGWCR14_EL1.
1365 DBGWCR14_EL1 = 0x8077,
1366 /// The value that represents the system register DBGBVR15_EL1.
1367 DBGBVR15_EL1 = 0x807c,
1368 /// The value that represents the system register DBGBCR15_EL1.
1369 DBGBCR15_EL1 = 0x807d,
1370 /// The value that represents the system register DBGWVR15_EL1.
1371 DBGWVR15_EL1 = 0x807e,
1372 /// The value that represents the system register DBGWCR15_EL1.
1373 DBGWCR15_EL1 = 0x807f,
1374 /// The value that represents the system register MIDR_EL1.
1375 MIDR_EL1 = 0xc000,
1376 /// The value that represents the system register MPIDR_EL1.
1377 MPIDR_EL1 = 0xc005,
1378 /// The value that describes the AArch64 Processor Feature Register 0.
1379 ID_AA64PFR0_EL1 = 0xc020,
1380 /// The value that describes the AArch64 Processor Feature Register 1.
1381 ID_AA64PFR1_EL1 = 0xc021,
1382 /// The value that describes the AArch64 SVE Feature ID register 0.
1383 #[cfg(feature = "macos-15-2")]
1384 ID_AA64ZFR0_EL1 = 0xc024,
1385 /// The value that describes the AArch64 SME Feature ID register 0.
1386 #[cfg(feature = "macos-15-2")]
1387 ID_AA64SMFR0_EL1 = 0xc025,
1388 /// The value that describes the AArch64 Debug Feature Register 0.
1389 ID_AA64DFR0_EL1 = 0xc028,
1390 /// The value that describes the AArch64 Debug Feature Register 1.
1391 ID_AA64DFR1_EL1 = 0xc029,
1392 /// The value that describes the AArch64 Instruction Set Attribute Register 0.
1393 ID_AA64ISAR0_EL1 = 0xc030,
1394 /// The value that describes the AArch64 Instruction Set Attribute Register 1.
1395 ID_AA64ISAR1_EL1 = 0xc031,
1396 /// The value that describes the AArch64 Memory Model Feature Register 0.
1397 ID_AA64MMFR0_EL1 = 0xc038,
1398 /// The value that describes the AArch64 Memory Model Feature Register 1.
1399 ID_AA64MMFR1_EL1 = 0xc039,
1400 /// The value that describes the AArch64 Memory Model Feature Register 2.
1401 ID_AA64MMFR2_EL1 = 0xc03a,
1402 /// The value that represents the system register SCTLR_EL1.
1403 SCTLR_EL1 = 0xc080,
1404 /// The value that represents the system register CPACR_EL1.
1405 CPACR_EL1 = 0xc082,
1406 /// The value that represents the system register ACTLR_EL1.
1407 ///
1408 /// This only allows getting / setting of the ACTLR_EL1.EnTSO bit (index 1). Setting this bit
1409 /// to 1 will cause the vcpu to use a TSO memory model, whereas clearing it will cause the vcpu
1410 /// to use the default ARM64 memory model (weakly ordered loads / stores).
1411 #[cfg(feature = "macos-15-0")]
1412 ACTLR_EL1 = 0xc081,
1413 /// The value that describes the Streaming Mode Priority Register.
1414 #[cfg(feature = "macos-15-2")]
1415 SMPRI_EL1 = 0xc094,
1416 /// The value that describes the SME Control Register.
1417 #[cfg(feature = "macos-15-2")]
1418 SMCR_EL1 = 0xc096,
1419 /// The value that represents the system register TTBR0_EL1.
1420 TTBR0_EL1 = 0xc100,
1421 /// The value that represents the system register TTBR1_EL1.
1422 TTBR1_EL1 = 0xc101,
1423 /// The value that represents the system register TCR_EL1.
1424 TCR_EL1 = 0xc102,
1425 /// The value that represents the system register APIAKEYLO_EL1.
1426 APIAKEYLO_EL1 = 0xc108,
1427 /// The value that represents the system register APIAKEYHI_EL1.
1428 APIAKEYHI_EL1 = 0xc109,
1429 /// The value that represents the system register APIBKEYLO_EL1.
1430 APIBKEYLO_EL1 = 0xc10a,
1431 /// The value that represents the system register APIBKEYHI_EL1.
1432 APIBKEYHI_EL1 = 0xc10b,
1433 /// The value that represents the system register APDAKEYLO_EL1.
1434 APDAKEYLO_EL1 = 0xc110,
1435 /// The value that represents the system register APDAKEYHI_EL1.
1436 APDAKEYHI_EL1 = 0xc111,
1437 /// The value that represents the system register APDBKEYLO_EL1.
1438 APDBKEYLO_EL1 = 0xc112,
1439 /// The value that represents the system register APDBKEYHI_EL1.
1440 APDBKEYHI_EL1 = 0xc113,
1441 /// The value that represents the system register APGAKEYLO_EL1.
1442 APGAKEYLO_EL1 = 0xc118,
1443 /// The value that represents the system register APGAKEYHI_EL1.
1444 APGAKEYHI_EL1 = 0xc119,
1445 /// The value that represents the system register SPSR_EL1.
1446 SPSR_EL1 = 0xc200,
1447 /// The value that represents the system register ELR_EL1.
1448 ELR_EL1 = 0xc201,
1449 /// The value that represents the system register SP_EL0.
1450 SP_EL0 = 0xc208,
1451 /// The value that represents the system register AFSR0_EL1.
1452 AFSR0_EL1 = 0xc288,
1453 /// The value that represents the system register AFSR1_EL1.
1454 AFSR1_EL1 = 0xc289,
1455 /// The value that represents the system register ESR_EL1.
1456 ESR_EL1 = 0xc290,
1457 /// The value that represents the system register FAR_EL1.
1458 FAR_EL1 = 0xc300,
1459 /// The value that represents the system register PAR_EL1.
1460 PAR_EL1 = 0xc3a0,
1461 /// The value that represents the system register MAIR_EL1.
1462 MAIR_EL1 = 0xc510,
1463 /// The value that represents the system register AMAIR_EL1.
1464 AMAIR_EL1 = 0xc518,
1465 /// The value that represents the system register VBAR_EL1.
1466 VBAR_EL1 = 0xc600,
1467 /// The value that represents the system register CONTEXTIDR_EL1.
1468 CONTEXTIDR_EL1 = 0xc681,
1469 /// The value that represents the system register TPIDR_EL1.
1470 TPIDR_EL1 = 0xc684,
1471 /// The value that represents the system register SCXTNUM_EL1.
1472 #[cfg(feature = "macos-15-2")]
1473 SCXTNUM_EL1 = 0xc687,
1474 /// The value that represents the system register CNTKCTL_EL1.
1475 CNTKCTL_EL1 = 0xc708,
1476 /// The value that represents the system register CSSELR_EL1.
1477 CSSELR_EL1 = 0xd000,
1478 /// The value that represents the system register TPIDR_EL0.
1479 TPIDR_EL0 = 0xde82,
1480 /// The value that represents the system register TPIDRRO_EL0.
1481 TPIDRRO_EL0 = 0xde83,
1482 /// The value that represents the system register TPIDR2_EL0.
1483 #[cfg(feature = "macos-15-2")]
1484 TPIDR2_EL0 = 0xde85,
1485 /// The value that represents the system register SCXTNUM_EL0.
1486 #[cfg(feature = "macos-15-2")]
1487 SCXTNUM_EL0 = 0xde87,
1488 /// The value that represents the system register CNTV_CTL_EL0.
1489 CNTV_CTL_EL0 = 0xdf19,
1490 /// The value that represents the system register CNTV_CVAL_EL0.
1491 CNTV_CVAL_EL0 = 0xdf1a,
1492 /// The value that represents the system register SP_EL1.
1493 SP_EL1 = 0xe208,
1494 /// The value that represents the system register CNTP_CTL_EL0.
1495 /// This register is only available if EL2 was enabled in the VM configuration.
1496 #[cfg(feature = "macos-15-0")]
1497 CNTP_CTL_EL0 = 0xdf11,
1498 /// The value that represents the system register CNTP_CVAL_EL0.
1499 /// This register is only available if EL2 was enabled in the VM configuration.
1500 #[cfg(feature = "macos-15-0")]
1501 CNTP_CVAL_EL0 = 0xdf12,
1502 /// The value that represents the system register CNTP_TVAL_EL0.
1503 /// This register is only available if EL2 was enabled in the VM configuration.
1504 #[cfg(feature = "macos-15-0")]
1505 CNTP_TVAL_EL0 = 0xdf10,
1506 /// The value that represents the system register CNTHCTL_EL2.
1507 /// This register is only available if EL2 was enabled in the VM configuration.
1508 #[cfg(feature = "macos-15-0")]
1509 CNTHCTL_EL2 = 0xe708,
1510 /// The value that represents the system register CNTHP_CTL_EL2.
1511 /// This register is only available if EL2 was enabled in the VM configuration.
1512 #[cfg(feature = "macos-15-0")]
1513 CNTHP_CTL_EL2 = 0xe711,
1514 /// The value that represents the system register CNTHP_CVAL_EL2.
1515 /// This register is only available if EL2 was enabled in the VM configuration.
1516 #[cfg(feature = "macos-15-0")]
1517 CNTHP_CVAL_EL2 = 0xe712,
1518 /// The value that represents the system register CNTHP_TVAL_EL2.
1519 /// This register is only available if EL2 was enabled in the VM configuration.
1520 #[cfg(feature = "macos-15-0")]
1521 CNTHP_TVAL_EL2 = 0xe710,
1522 /// The value that represents the system register CNTVOFF_EL2.
1523 /// This register is only available if EL2 was enabled in the VM configuration.
1524 #[cfg(feature = "macos-15-0")]
1525 CNTVOFF_EL2 = 0xe703,
1526 /// The value that represents the system register CPTR_EL2.
1527 /// This register is only available if EL2 was enabled in the VM configuration.
1528 #[cfg(feature = "macos-15-0")]
1529 CPTR_EL2 = 0xe08a,
1530 /// The value that represents the system register ELR_EL2.
1531 /// This register is only available if EL2 was enabled in the VM configuration.
1532 #[cfg(feature = "macos-15-0")]
1533 ELR_EL2 = 0xe201,
1534 /// The value that represents the system register ESR_EL2.
1535 /// This register is only available if EL2 was enabled in the VM configuration.
1536 #[cfg(feature = "macos-15-0")]
1537 ESR_EL2 = 0xe290,
1538 /// The value that represents the system register FAR_EL2.
1539 /// This register is only available if EL2 was enabled in the VM configuration.
1540 #[cfg(feature = "macos-15-0")]
1541 FAR_EL2 = 0xe300,
1542 /// The value that represents the system register HCR_EL2.
1543 /// This register is only available if EL2 was enabled in the VM configuration.
1544 #[cfg(feature = "macos-15-0")]
1545 HCR_EL2 = 0xe088,
1546 /// The value that represents the system register HPFAR_EL2.
1547 /// This register is only available if EL2 was enabled in the VM configuration.
1548 #[cfg(feature = "macos-15-0")]
1549 HPFAR_EL2 = 0xe304,
1550 /// The value that represents the system register MAIR_EL2.
1551 /// This register is only available if EL2 was enabled in the VM configuration.
1552 #[cfg(feature = "macos-15-0")]
1553 MAIR_EL2 = 0xe510,
1554 /// The value that represents the system register MDCR_EL2.
1555 /// This register is only available if EL2 was enabled in the VM configuration.
1556 #[cfg(feature = "macos-15-0")]
1557 MDCR_EL2 = 0xe019,
1558 /// The value that represents the system register SCTLR_EL2.
1559 /// This register is only available if EL2 was enabled in the VM configuration.
1560 #[cfg(feature = "macos-15-0")]
1561 SCTLR_EL2 = 0xe080,
1562 /// The value that represents the system register SPSR_EL2.
1563 /// This register is only available if EL2 was enabled in the VM configuration.
1564 #[cfg(feature = "macos-15-0")]
1565 SPSR_EL2 = 0xe200,
1566 /// The value that represents the system register SP_EL2.
1567 /// This register is only available if EL2 was enabled in the VM configuration.
1568 #[cfg(feature = "macos-15-0")]
1569 SP_EL2 = 0xf208,
1570 /// The value that represents the system register TCR_EL2.
1571 /// This register is only available if EL2 was enabled in the VM configuration.
1572 #[cfg(feature = "macos-15-0")]
1573 TCR_EL2 = 0xe102,
1574 /// The value that represents the system register TPIDR_EL2.
1575 /// This register is only available if EL2 was enabled in the VM configuration.
1576 #[cfg(feature = "macos-15-0")]
1577 TPIDR_EL2 = 0xe682,
1578 /// The value that represents the system register TTBR0_EL2.
1579 /// This register is only available if EL2 was enabled in the VM configuration.
1580 #[cfg(feature = "macos-15-0")]
1581 TTBR0_EL2 = 0xe100,
1582 /// The value that represents the system register TTBR1_EL2.
1583 /// This register is only available if EL2 was enabled in the VM configuration.
1584 #[cfg(feature = "macos-15-0")]
1585 TTBR1_EL2 = 0xe101,
1586 /// The value that represents the system register VBAR_EL2.
1587 /// This register is only available if EL2 was enabled in the VM configuration.
1588 #[cfg(feature = "macos-15-0")]
1589 VBAR_EL2 = 0xe600,
1590 /// The value that represents the system register VMPIDR_EL2.
1591 /// This register is only available if EL2 was enabled in the VM configuration.
1592 #[cfg(feature = "macos-15-0")]
1593 VMPIDR_EL2 = 0xe005,
1594 /// The value that represents the system register VPIDR_EL2.
1595 /// This register is only available if EL2 was enabled in the VM configuration.
1596 #[cfg(feature = "macos-15-0")]
1597 VPIDR_EL2 = 0xe000,
1598 /// The value that represents the system register VTCR_EL2.
1599 /// This register is only available if EL2 was enabled in the VM configuration.
1600 #[cfg(feature = "macos-15-0")]
1601 VTCR_EL2 = 0xe10a,
1602 /// The value that represents the system register VTTBR_EL2.
1603 /// This register is only available if EL2 was enabled in the VM configuration.
1604 #[cfg(feature = "macos-15-0")]
1605 VTTBR_EL2 = 0xe108,
1606}
1607
1608unsafe extern "C" {
1609 /// Gets the current value of a vCPU system register.
1610 ///
1611 /// # Parameters
1612 ///
1613 /// * `vcpu`: The vCPU instance.
1614 /// * `reg`: The ID of the system register.
1615 /// * `value`: The value of the register reg on output.
1616 ///
1617 /// # Return Value
1618 ///
1619 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1620 /// [`hv_return_t`].
1621 pub fn hv_vcpu_get_sys_reg(vcpu: hv_vcpu_t, reg: hv_sys_reg_t, value: *mut u64) -> hv_return_t;
1622
1623 /// Sets the value of a vCPU system register.
1624 ///
1625 /// # Parameters
1626 ///
1627 /// * `vcpu`: The vCPU instance.
1628 /// * `reg`: The ID of the system register.
1629 /// * `value`: The new value of the register.
1630 ///
1631 /// # Return Value
1632 ///
1633 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1634 /// [`hv_return_t`].
1635 pub fn hv_vcpu_set_sys_reg(vcpu: hv_vcpu_t, reg: hv_sys_reg_t, value: u64) -> hv_return_t;
1636}
1637
1638// -----------------------------------------------------------------------------------------------
1639// vCPU Management - Trap Configuration
1640// -----------------------------------------------------------------------------------------------
1641
1642unsafe extern "C" {
1643 /// Gets whether debug exceptions exit the guest.
1644 ///
1645 /// # Parameters
1646 ///
1647 /// * `vcpu`: The vCPU instance.
1648 /// * `value`: Indicates whether debug exceptions in the guest trap to the host on output.
1649 ///
1650 /// # Return Value
1651 ///
1652 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1653 /// [`hv_return_t`].
1654 pub fn hv_vcpu_get_trap_debug_exceptions(vcpu: hv_vcpu_t, value: *mut bool) -> hv_return_t;
1655
1656 /// Sets whether debug exceptions exit the guest.
1657 ///
1658 /// # Parameters
1659 ///
1660 /// * `vcpu`: The vCPU instance.
1661 /// * `value`: A Boolean value that if true indicates debug exceptions in the guest trap to
1662 /// the host.
1663 ///
1664 /// # Return Value
1665 ///
1666 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1667 /// [`hv_return_t`].
1668 pub fn hv_vcpu_set_trap_debug_exceptions(vcpu: hv_vcpu_t, value: bool) -> hv_return_t;
1669
1670 /// Gets whether debug-register accesses exit the guest.
1671 ///
1672 /// # Parameters
1673 ///
1674 /// * `vcpu`: The vCPU instance.
1675 /// * `value`: Indicates whether debug-register accesses in the guest trap to the host on
1676 /// output.
1677 ///
1678 /// # Return Value
1679 ///
1680 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1681 /// [`hv_return_t`].
1682 pub fn hv_vcpu_get_trap_debug_reg_accesses(vcpu: hv_vcpu_t, value: *mut bool) -> hv_return_t;
1683
1684 /// Sets whether debug-register accesses exit the guest.
1685 ///
1686 /// # Parameters
1687 ///
1688 /// * `vcpu`: The vCPU instance.
1689 /// * `value`: A Boolean value that if true indicates debug-register accesses in the guest
1690 /// trap to the host.
1691 ///
1692 /// # Return Value
1693 ///
1694 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1695 /// [`hv_return_t`].
1696 pub fn hv_vcpu_set_trap_debug_reg_accesses(vcpu: hv_vcpu_t, value: bool) -> hv_return_t;
1697}
1698
1699// -----------------------------------------------------------------------------------------------
1700// Memory Management
1701// -----------------------------------------------------------------------------------------------
1702
1703/// The type of an intermediate physical address, which is a guest physical address space of the
1704/// VM.
1705pub type hv_ipa_t = u64;
1706/// The permissions for guest physical memory regions.
1707pub type hv_memory_flags_t = u64;
1708
1709/// The value that represents no memory permission.
1710pub const HV_MEMORY_NONE: hv_memory_flags_t = 0u64;
1711/// The value that represents the memory-read permission.
1712pub const HV_MEMORY_READ: hv_memory_flags_t = 1u64 << 0;
1713/// The value that represents the memory-write permission.
1714pub const HV_MEMORY_WRITE: hv_memory_flags_t = 1u64 << 1;
1715/// The value that represents the memory-execute permission.
1716pub const HV_MEMORY_EXEC: hv_memory_flags_t = 1u64 << 2;
1717
1718unsafe extern "C" {
1719 /// Maps a region in the virtual address space of the current process into the guest physical
1720 /// address space of the VM.
1721 ///
1722 /// # Parameters
1723 ///
1724 /// * `addr`: The address in the current process. It must be page-aligned.
1725 /// * `ipa`: The address in the intermediate physical address space. It must be page-aligned.
1726 /// * `size`: The size of the mapped region in bytes. It must be a multiple of the page size.
1727 /// * `flags`: The permissions for the mapped region. For a list of valid options, see
1728 /// [`hv_memory_flags_t`].
1729 ///
1730 /// # Return Value
1731 ///
1732 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1733 /// [`hv_return_t`].
1734 pub fn hv_vm_map(
1735 addr: *const c_void,
1736 ipa: hv_ipa_t,
1737 size: usize,
1738 flags: hv_memory_flags_t,
1739 ) -> hv_return_t;
1740
1741 /// Unmaps a region in the guest physical address space of the VM.
1742 ///
1743 /// # Parameters
1744 ///
1745 /// * `ipa`: The address in the intermediate physical address space. It must be page-aligned.
1746 /// * `size`: The size of the region to unmap, in bytes. It must be a multiple of the page
1747 /// size.
1748 ///
1749 /// # Return Value
1750 ///
1751 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1752 /// [`hv_return_t`].
1753 pub fn hv_vm_unmap(ipa: hv_ipa_t, size: usize) -> hv_return_t;
1754
1755 /// Modifies the permissions of a region in the guest physical address space of the VM.
1756 ///
1757 /// # Parameters
1758 ///
1759 /// * `ipa`: The address in the intermediate physical address space. It must be page-aligned.
1760 /// * `size`: The size of the region to unmap, in bytes. It must be a multiple of the page
1761 /// size.
1762 /// * `flags`: The permissions for the protected region. For a list of valid options, see
1763 /// [`hv_memory_flags_t.
1764 ///
1765 /// # Return Value
1766 ///
1767 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1768 /// [`hv_return_t`].
1769 pub fn hv_vm_protect(ipa: hv_ipa_t, size: usize, flags: hv_memory_flags_t) -> hv_return_t;
1770}
1771
1772// -----------------------------------------------------------------------------------------------
1773// Timer Functions
1774// -----------------------------------------------------------------------------------------------
1775
1776unsafe extern "C" {
1777 /// Gets the virtual timer mask.
1778 ///
1779 /// # Parameters
1780 ///
1781 /// * `vcpu`: The ID of the vCPU instance.
1782 /// * `vtimer_is_masked`: The value of the mask.
1783 ///
1784 /// # Return Value
1785 ///
1786 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1787 /// [`hv_return_t`].
1788 pub fn hv_vcpu_get_vtimer_mask(vcpu: hv_vcpu_t, vtimer_is_masked: *mut bool) -> hv_return_t;
1789
1790 /// Sets or clears the virtual timer mask.
1791 ///
1792 /// # Parameters
1793 ///
1794 /// * `vcpu`: The ID of the vCPU instance.
1795 /// * `vtimer_is_masked`: A Boolean value that indicates whether the vTimer has a mask set.
1796 ///
1797 /// # Return Value
1798 ///
1799 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1800 /// [`hv_return_t`].
1801 pub fn hv_vcpu_set_vtimer_mask(vcpu: hv_vcpu_t, vtimer_is_masked: bool) -> hv_return_t;
1802
1803 /// Returns the vTimer offset for the vCPU ID you specify.
1804 ///
1805 /// # Parameters
1806 ///
1807 /// * `vcpu`: The ID of the vCPU instance.
1808 /// * `vtimer_offset`: A pointer to vTimer offset; the Hypervisor writes to this value on
1809 /// success.
1810 ///
1811 /// # Return Value
1812 ///
1813 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1814 /// [`hv_return_t`].
1815 pub fn hv_vcpu_get_vtimer_offset(vcpu: hv_vcpu_t, vtimer_offset: *mut u64) -> hv_return_t;
1816
1817 /// Sets the vTimer offset to a value that you provide.
1818 ///
1819 /// # Parameters
1820 ///
1821 /// * `vcpu`: The ID of the vCPU instance.
1822 /// * `vtimer_offset`: The new vTimer offset.
1823 ///
1824 /// # Return Value
1825 ///
1826 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
1827 /// [`hv_return_t`].
1828 pub fn hv_vcpu_set_vtimer_offset(vcpu: hv_vcpu_t, vtimer_offset: u64) -> hv_return_t;
1829}
1830
1831// -----------------------------------------------------------------------------------------------
1832// Global Interrupt Controller
1833// -----------------------------------------------------------------------------------------------
1834
1835/// Configuration for [`hv_gic_create`].
1836pub type hv_gic_config_t = *mut c_void;
1837
1838/// GIC state for [`hv_gic_state_get_data`] and [`hv_gic_state_get_size`]
1839pub type hv_gic_state_t = *mut c_void;
1840
1841/// Type of an ARM GIC interrupt id.
1842///
1843/// # Discussion
1844///
1845/// Note that [`hv_gic_intid_t::MAINTENANCE`] and [`hv_gic_intid_t::EL2_PHYSICAL_TIMER`] are only
1846/// present when EL2 (nested virtualization) is enabled.
1847#[repr(C)]
1848#[cfg(feature = "macos-15-0")]
1849#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
1850pub enum hv_gic_intid_t {
1851 PERFORMANCE_MONITOR = 23,
1852 MAINTENANCE = 25,
1853 EL2_PHYSICAL_TIMER = 26,
1854 EL1_VIRTUAL_TIMER = 27,
1855 EL1_PHYSICAL_TIMER = 30,
1856}
1857
1858/// Type of an ARM GIC distributor register.
1859#[repr(C)]
1860#[cfg(feature = "macos-15-0")]
1861#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
1862pub enum hv_gic_distributor_reg_t {
1863 CTLR = 0x0000,
1864 TYPER = 0x0004,
1865
1866 IGROUPR0 = 0x0080,
1867 IGROUPR1 = 0x0084,
1868 IGROUPR2 = 0x0088,
1869 IGROUPR3 = 0x008c,
1870 IGROUPR4 = 0x0090,
1871 IGROUPR5 = 0x0094,
1872 IGROUPR6 = 0x0098,
1873 IGROUPR7 = 0x009c,
1874 IGROUPR8 = 0x00a0,
1875 IGROUPR9 = 0x00a4,
1876 IGROUPR10 = 0x00a8,
1877 IGROUPR11 = 0x00ac,
1878 IGROUPR12 = 0x00b0,
1879 IGROUPR13 = 0x00b4,
1880 IGROUPR14 = 0x00b8,
1881 IGROUPR15 = 0x00bc,
1882 IGROUPR16 = 0x00c0,
1883 IGROUPR17 = 0x00c4,
1884 IGROUPR18 = 0x00c8,
1885 IGROUPR19 = 0x00cc,
1886 IGROUPR20 = 0x00d0,
1887 IGROUPR21 = 0x00d4,
1888 IGROUPR22 = 0x00d8,
1889 IGROUPR23 = 0x00dc,
1890 IGROUPR24 = 0x00e0,
1891 IGROUPR25 = 0x00e4,
1892 IGROUPR26 = 0x00e8,
1893 IGROUPR27 = 0x00ec,
1894 IGROUPR28 = 0x00f0,
1895 IGROUPR29 = 0x00f4,
1896 IGROUPR30 = 0x00f8,
1897 IGROUPR31 = 0x00fc,
1898
1899 ISENABLER0 = 0x0100,
1900 ISENABLER1 = 0x0104,
1901 ISENABLER2 = 0x0108,
1902 ISENABLER3 = 0x010c,
1903 ISENABLER4 = 0x0110,
1904 ISENABLER5 = 0x0114,
1905 ISENABLER6 = 0x0118,
1906 ISENABLER7 = 0x011c,
1907 ISENABLER8 = 0x0120,
1908 ISENABLER9 = 0x0124,
1909 ISENABLER10 = 0x0128,
1910 ISENABLER11 = 0x012c,
1911 ISENABLER12 = 0x0130,
1912 ISENABLER13 = 0x0134,
1913 ISENABLER14 = 0x0138,
1914 ISENABLER15 = 0x013c,
1915 ISENABLER16 = 0x0140,
1916 ISENABLER17 = 0x0144,
1917 ISENABLER18 = 0x0148,
1918 ISENABLER19 = 0x014c,
1919 ISENABLER20 = 0x0150,
1920 ISENABLER21 = 0x0154,
1921 ISENABLER22 = 0x0158,
1922 ISENABLER23 = 0x015c,
1923 ISENABLER24 = 0x0160,
1924 ISENABLER25 = 0x0164,
1925 ISENABLER26 = 0x0168,
1926 ISENABLER27 = 0x016c,
1927 ISENABLER28 = 0x0170,
1928 ISENABLER29 = 0x0174,
1929 ISENABLER30 = 0x0178,
1930 ISENABLER31 = 0x017c,
1931
1932 ICENABLER0 = 0x0180,
1933 ICENABLER1 = 0x0184,
1934 ICENABLER2 = 0x0188,
1935 ICENABLER3 = 0x018c,
1936 ICENABLER4 = 0x0190,
1937 ICENABLER5 = 0x0194,
1938 ICENABLER6 = 0x0198,
1939 ICENABLER7 = 0x019c,
1940 ICENABLER8 = 0x01a0,
1941 ICENABLER9 = 0x01a4,
1942 ICENABLER10 = 0x01a8,
1943 ICENABLER11 = 0x01ac,
1944 ICENABLER12 = 0x01b0,
1945 ICENABLER13 = 0x01b4,
1946 ICENABLER14 = 0x01b8,
1947 ICENABLER15 = 0x01bc,
1948 ICENABLER16 = 0x01c0,
1949 ICENABLER17 = 0x01c4,
1950 ICENABLER18 = 0x01c8,
1951 ICENABLER19 = 0x01cc,
1952 ICENABLER20 = 0x01d0,
1953 ICENABLER21 = 0x01d4,
1954 ICENABLER22 = 0x01d8,
1955 ICENABLER23 = 0x01dc,
1956 ICENABLER24 = 0x01e0,
1957 ICENABLER25 = 0x01e4,
1958 ICENABLER26 = 0x01e8,
1959 ICENABLER27 = 0x01ec,
1960 ICENABLER28 = 0x01f0,
1961 ICENABLER29 = 0x01f4,
1962 ICENABLER30 = 0x01f8,
1963 ICENABLER31 = 0x01fc,
1964
1965 ISPENDR0 = 0x0200,
1966 ISPENDR1 = 0x0204,
1967 ISPENDR2 = 0x0208,
1968 ISPENDR3 = 0x020c,
1969 ISPENDR4 = 0x0210,
1970 ISPENDR5 = 0x0214,
1971 ISPENDR6 = 0x0218,
1972 ISPENDR7 = 0x021c,
1973 ISPENDR8 = 0x0220,
1974 ISPENDR9 = 0x0224,
1975 ISPENDR10 = 0x0228,
1976 ISPENDR11 = 0x022c,
1977 ISPENDR12 = 0x0230,
1978 ISPENDR13 = 0x0234,
1979 ISPENDR14 = 0x0238,
1980 ISPENDR15 = 0x023c,
1981 ISPENDR16 = 0x0240,
1982 ISPENDR17 = 0x0244,
1983 ISPENDR18 = 0x0248,
1984 ISPENDR19 = 0x024c,
1985 ISPENDR20 = 0x0250,
1986 ISPENDR21 = 0x0254,
1987 ISPENDR22 = 0x0258,
1988 ISPENDR23 = 0x025c,
1989 ISPENDR24 = 0x0260,
1990 ISPENDR25 = 0x0264,
1991 ISPENDR26 = 0x0268,
1992 ISPENDR27 = 0x026c,
1993 ISPENDR28 = 0x0270,
1994 ISPENDR29 = 0x0274,
1995 ISPENDR30 = 0x0278,
1996 ISPENDR31 = 0x027c,
1997
1998 ICPENDR0 = 0x0280,
1999 ICPENDR1 = 0x0284,
2000 ICPENDR2 = 0x0288,
2001 ICPENDR3 = 0x028c,
2002 ICPENDR4 = 0x0290,
2003 ICPENDR5 = 0x0294,
2004 ICPENDR6 = 0x0298,
2005 ICPENDR7 = 0x029c,
2006 ICPENDR8 = 0x02a0,
2007 ICPENDR9 = 0x02a4,
2008 ICPENDR10 = 0x02a8,
2009 ICPENDR11 = 0x02ac,
2010 ICPENDR12 = 0x02b0,
2011 ICPENDR13 = 0x02b4,
2012 ICPENDR14 = 0x02b8,
2013 ICPENDR15 = 0x02bc,
2014 ICPENDR16 = 0x02c0,
2015 ICPENDR17 = 0x02c4,
2016 ICPENDR18 = 0x02c8,
2017 ICPENDR19 = 0x02cc,
2018 ICPENDR20 = 0x02d0,
2019 ICPENDR21 = 0x02d4,
2020 ICPENDR22 = 0x02d8,
2021 ICPENDR23 = 0x02dc,
2022 ICPENDR24 = 0x02e0,
2023 ICPENDR25 = 0x02e4,
2024 ICPENDR26 = 0x02e8,
2025 ICPENDR27 = 0x02ec,
2026 ICPENDR28 = 0x02f0,
2027 ICPENDR29 = 0x02f4,
2028 ICPENDR30 = 0x02f8,
2029 ICPENDR31 = 0x02fc,
2030
2031 ISACTIVER0 = 0x0300,
2032 ISACTIVER1 = 0x0304,
2033 ISACTIVER2 = 0x0308,
2034 ISACTIVER3 = 0x030c,
2035 ISACTIVER4 = 0x0310,
2036 ISACTIVER5 = 0x0314,
2037 ISACTIVER6 = 0x0318,
2038 ISACTIVER7 = 0x031c,
2039 ISACTIVER8 = 0x0320,
2040 ISACTIVER9 = 0x0324,
2041 ISACTIVER10 = 0x0328,
2042 ISACTIVER11 = 0x032c,
2043 ISACTIVER12 = 0x0330,
2044 ISACTIVER13 = 0x0334,
2045 ISACTIVER14 = 0x0338,
2046 ISACTIVER15 = 0x033c,
2047 ISACTIVER16 = 0x0340,
2048 ISACTIVER17 = 0x0344,
2049 ISACTIVER18 = 0x0348,
2050 ISACTIVER19 = 0x034c,
2051 ISACTIVER20 = 0x0350,
2052 ISACTIVER21 = 0x0354,
2053 ISACTIVER22 = 0x0358,
2054 ISACTIVER23 = 0x035c,
2055 ISACTIVER24 = 0x0360,
2056 ISACTIVER25 = 0x0364,
2057 ISACTIVER26 = 0x0368,
2058 ISACTIVER27 = 0x036c,
2059 ISACTIVER28 = 0x0370,
2060 ISACTIVER29 = 0x0374,
2061 ISACTIVER30 = 0x0378,
2062 ISACTIVER31 = 0x037c,
2063
2064 ICACTIVER0 = 0x0380,
2065 ICACTIVER1 = 0x0384,
2066 ICACTIVER2 = 0x0388,
2067 ICACTIVER3 = 0x038c,
2068 ICACTIVER4 = 0x0390,
2069 ICACTIVER5 = 0x0394,
2070 ICACTIVER6 = 0x0398,
2071 ICACTIVER7 = 0x039c,
2072 ICACTIVER8 = 0x03a0,
2073 ICACTIVER9 = 0x03a4,
2074 ICACTIVER10 = 0x03a8,
2075 ICACTIVER11 = 0x03ac,
2076 ICACTIVER12 = 0x03b0,
2077 ICACTIVER13 = 0x03b4,
2078 ICACTIVER14 = 0x03b8,
2079 ICACTIVER15 = 0x03bc,
2080 ICACTIVER16 = 0x03c0,
2081 ICACTIVER17 = 0x03c4,
2082 ICACTIVER18 = 0x03c8,
2083 ICACTIVER19 = 0x03cc,
2084 ICACTIVER20 = 0x03d0,
2085 ICACTIVER21 = 0x03d4,
2086 ICACTIVER22 = 0x03d8,
2087 ICACTIVER23 = 0x03dc,
2088 ICACTIVER24 = 0x03e0,
2089 ICACTIVER25 = 0x03e4,
2090 ICACTIVER26 = 0x03e8,
2091 ICACTIVER27 = 0x03ec,
2092 ICACTIVER28 = 0x03f0,
2093 ICACTIVER29 = 0x03f4,
2094 ICACTIVER30 = 0x03f8,
2095 ICACTIVER31 = 0x03fc,
2096
2097 IPRIORITYR0 = 0x0400,
2098 IPRIORITYR1 = 0x0404,
2099 IPRIORITYR2 = 0x0408,
2100 IPRIORITYR3 = 0x040c,
2101 IPRIORITYR4 = 0x0410,
2102 IPRIORITYR5 = 0x0414,
2103 IPRIORITYR6 = 0x0418,
2104 IPRIORITYR7 = 0x041c,
2105 IPRIORITYR8 = 0x0420,
2106 IPRIORITYR9 = 0x0424,
2107 IPRIORITYR10 = 0x0428,
2108 IPRIORITYR11 = 0x042c,
2109 IPRIORITYR12 = 0x0430,
2110 IPRIORITYR13 = 0x0434,
2111 IPRIORITYR14 = 0x0438,
2112 IPRIORITYR15 = 0x043c,
2113 IPRIORITYR16 = 0x0440,
2114 IPRIORITYR17 = 0x0444,
2115 IPRIORITYR18 = 0x0448,
2116 IPRIORITYR19 = 0x044c,
2117 IPRIORITYR20 = 0x0450,
2118 IPRIORITYR21 = 0x0454,
2119 IPRIORITYR22 = 0x0458,
2120 IPRIORITYR23 = 0x045c,
2121 IPRIORITYR24 = 0x0460,
2122 IPRIORITYR25 = 0x0464,
2123 IPRIORITYR26 = 0x0468,
2124 IPRIORITYR27 = 0x046c,
2125 IPRIORITYR28 = 0x0470,
2126 IPRIORITYR29 = 0x0474,
2127 IPRIORITYR30 = 0x0478,
2128 IPRIORITYR31 = 0x047c,
2129 IPRIORITYR32 = 0x0480,
2130 IPRIORITYR33 = 0x0484,
2131 IPRIORITYR34 = 0x0488,
2132 IPRIORITYR35 = 0x048c,
2133 IPRIORITYR36 = 0x0490,
2134 IPRIORITYR37 = 0x0494,
2135 IPRIORITYR38 = 0x0498,
2136 IPRIORITYR39 = 0x049c,
2137 IPRIORITYR40 = 0x04a0,
2138 IPRIORITYR41 = 0x04a4,
2139 IPRIORITYR42 = 0x04a8,
2140 IPRIORITYR43 = 0x04ac,
2141 IPRIORITYR44 = 0x04b0,
2142 IPRIORITYR45 = 0x04b4,
2143 IPRIORITYR46 = 0x04b8,
2144 IPRIORITYR47 = 0x04bc,
2145 IPRIORITYR48 = 0x04c0,
2146 IPRIORITYR49 = 0x04c4,
2147 IPRIORITYR50 = 0x04c8,
2148 IPRIORITYR51 = 0x04cc,
2149 IPRIORITYR52 = 0x04d0,
2150 IPRIORITYR53 = 0x04d4,
2151 IPRIORITYR54 = 0x04d8,
2152 IPRIORITYR55 = 0x04dc,
2153 IPRIORITYR56 = 0x04e0,
2154 IPRIORITYR57 = 0x04e4,
2155 IPRIORITYR58 = 0x04e8,
2156 IPRIORITYR59 = 0x04ec,
2157 IPRIORITYR60 = 0x04f0,
2158 IPRIORITYR61 = 0x04f4,
2159 IPRIORITYR62 = 0x04f8,
2160 IPRIORITYR63 = 0x04fc,
2161 IPRIORITYR64 = 0x0500,
2162 IPRIORITYR65 = 0x0504,
2163 IPRIORITYR66 = 0x0508,
2164 IPRIORITYR67 = 0x050c,
2165 IPRIORITYR68 = 0x0510,
2166 IPRIORITYR69 = 0x0514,
2167 IPRIORITYR70 = 0x0518,
2168 IPRIORITYR71 = 0x051c,
2169 IPRIORITYR72 = 0x0520,
2170 IPRIORITYR73 = 0x0524,
2171 IPRIORITYR74 = 0x0528,
2172 IPRIORITYR75 = 0x052c,
2173 IPRIORITYR76 = 0x0530,
2174 IPRIORITYR77 = 0x0534,
2175 IPRIORITYR78 = 0x0538,
2176 IPRIORITYR79 = 0x053c,
2177 IPRIORITYR80 = 0x0540,
2178 IPRIORITYR81 = 0x0544,
2179 IPRIORITYR82 = 0x0548,
2180 IPRIORITYR83 = 0x054c,
2181 IPRIORITYR84 = 0x0550,
2182 IPRIORITYR85 = 0x0554,
2183 IPRIORITYR86 = 0x0558,
2184 IPRIORITYR87 = 0x055c,
2185 IPRIORITYR88 = 0x0560,
2186 IPRIORITYR89 = 0x0564,
2187 IPRIORITYR90 = 0x0568,
2188 IPRIORITYR91 = 0x056c,
2189 IPRIORITYR92 = 0x0570,
2190 IPRIORITYR93 = 0x0574,
2191 IPRIORITYR94 = 0x0578,
2192 IPRIORITYR95 = 0x057c,
2193 IPRIORITYR96 = 0x0580,
2194 IPRIORITYR97 = 0x0584,
2195 IPRIORITYR98 = 0x0588,
2196 IPRIORITYR99 = 0x058c,
2197 IPRIORITYR100 = 0x0590,
2198 IPRIORITYR101 = 0x0594,
2199 IPRIORITYR102 = 0x0598,
2200 IPRIORITYR103 = 0x059c,
2201 IPRIORITYR104 = 0x05a0,
2202 IPRIORITYR105 = 0x05a4,
2203 IPRIORITYR106 = 0x05a8,
2204 IPRIORITYR107 = 0x05ac,
2205 IPRIORITYR108 = 0x05b0,
2206 IPRIORITYR109 = 0x05b4,
2207 IPRIORITYR110 = 0x05b8,
2208 IPRIORITYR111 = 0x05bc,
2209 IPRIORITYR112 = 0x05c0,
2210 IPRIORITYR113 = 0x05c4,
2211 IPRIORITYR114 = 0x05c8,
2212 IPRIORITYR115 = 0x05cc,
2213 IPRIORITYR116 = 0x05d0,
2214 IPRIORITYR117 = 0x05d4,
2215 IPRIORITYR118 = 0x05d8,
2216 IPRIORITYR119 = 0x05dc,
2217 IPRIORITYR120 = 0x05e0,
2218 IPRIORITYR121 = 0x05e4,
2219 IPRIORITYR122 = 0x05e8,
2220 IPRIORITYR123 = 0x05ec,
2221 IPRIORITYR124 = 0x05f0,
2222 IPRIORITYR125 = 0x05f4,
2223 IPRIORITYR126 = 0x05f8,
2224 IPRIORITYR127 = 0x05fc,
2225 IPRIORITYR128 = 0x0600,
2226 IPRIORITYR129 = 0x0604,
2227 IPRIORITYR130 = 0x0608,
2228 IPRIORITYR131 = 0x060c,
2229 IPRIORITYR132 = 0x0610,
2230 IPRIORITYR133 = 0x0614,
2231 IPRIORITYR134 = 0x0618,
2232 IPRIORITYR135 = 0x061c,
2233 IPRIORITYR136 = 0x0620,
2234 IPRIORITYR137 = 0x0624,
2235 IPRIORITYR138 = 0x0628,
2236 IPRIORITYR139 = 0x062c,
2237 IPRIORITYR140 = 0x0630,
2238 IPRIORITYR141 = 0x0634,
2239 IPRIORITYR142 = 0x0638,
2240 IPRIORITYR143 = 0x063c,
2241 IPRIORITYR144 = 0x0640,
2242 IPRIORITYR145 = 0x0644,
2243 IPRIORITYR146 = 0x0648,
2244 IPRIORITYR147 = 0x064c,
2245 IPRIORITYR148 = 0x0650,
2246 IPRIORITYR149 = 0x0654,
2247 IPRIORITYR150 = 0x0658,
2248 IPRIORITYR151 = 0x065c,
2249 IPRIORITYR152 = 0x0660,
2250 IPRIORITYR153 = 0x0664,
2251 IPRIORITYR154 = 0x0668,
2252 IPRIORITYR155 = 0x066c,
2253 IPRIORITYR156 = 0x0670,
2254 IPRIORITYR157 = 0x0674,
2255 IPRIORITYR158 = 0x0678,
2256 IPRIORITYR159 = 0x067c,
2257 IPRIORITYR160 = 0x0680,
2258 IPRIORITYR161 = 0x0684,
2259 IPRIORITYR162 = 0x0688,
2260 IPRIORITYR163 = 0x068c,
2261 IPRIORITYR164 = 0x0690,
2262 IPRIORITYR165 = 0x0694,
2263 IPRIORITYR166 = 0x0698,
2264 IPRIORITYR167 = 0x069c,
2265 IPRIORITYR168 = 0x06a0,
2266 IPRIORITYR169 = 0x06a4,
2267 IPRIORITYR170 = 0x06a8,
2268 IPRIORITYR171 = 0x06ac,
2269 IPRIORITYR172 = 0x06b0,
2270 IPRIORITYR173 = 0x06b4,
2271 IPRIORITYR174 = 0x06b8,
2272 IPRIORITYR175 = 0x06bc,
2273 IPRIORITYR176 = 0x06c0,
2274 IPRIORITYR177 = 0x06c4,
2275 IPRIORITYR178 = 0x06c8,
2276 IPRIORITYR179 = 0x06cc,
2277 IPRIORITYR180 = 0x06d0,
2278 IPRIORITYR181 = 0x06d4,
2279 IPRIORITYR182 = 0x06d8,
2280 IPRIORITYR183 = 0x06dc,
2281 IPRIORITYR184 = 0x06e0,
2282 IPRIORITYR185 = 0x06e4,
2283 IPRIORITYR186 = 0x06e8,
2284 IPRIORITYR187 = 0x06ec,
2285 IPRIORITYR188 = 0x06f0,
2286 IPRIORITYR189 = 0x06f4,
2287 IPRIORITYR190 = 0x06f8,
2288 IPRIORITYR191 = 0x06fc,
2289 IPRIORITYR192 = 0x0700,
2290 IPRIORITYR193 = 0x0704,
2291 IPRIORITYR194 = 0x0708,
2292 IPRIORITYR195 = 0x070c,
2293 IPRIORITYR196 = 0x0710,
2294 IPRIORITYR197 = 0x0714,
2295 IPRIORITYR198 = 0x0718,
2296 IPRIORITYR199 = 0x071c,
2297 IPRIORITYR200 = 0x0720,
2298 IPRIORITYR201 = 0x0724,
2299 IPRIORITYR202 = 0x0728,
2300 IPRIORITYR203 = 0x072c,
2301 IPRIORITYR204 = 0x0730,
2302 IPRIORITYR205 = 0x0734,
2303 IPRIORITYR206 = 0x0738,
2304 IPRIORITYR207 = 0x073c,
2305 IPRIORITYR208 = 0x0740,
2306 IPRIORITYR209 = 0x0744,
2307 IPRIORITYR210 = 0x0748,
2308 IPRIORITYR211 = 0x074c,
2309 IPRIORITYR212 = 0x0750,
2310 IPRIORITYR213 = 0x0754,
2311 IPRIORITYR214 = 0x0758,
2312 IPRIORITYR215 = 0x075c,
2313 IPRIORITYR216 = 0x0760,
2314 IPRIORITYR217 = 0x0764,
2315 IPRIORITYR218 = 0x0768,
2316 IPRIORITYR219 = 0x076c,
2317 IPRIORITYR220 = 0x0770,
2318 IPRIORITYR221 = 0x0774,
2319 IPRIORITYR222 = 0x0778,
2320 IPRIORITYR223 = 0x077c,
2321 IPRIORITYR224 = 0x0780,
2322 IPRIORITYR225 = 0x0784,
2323 IPRIORITYR226 = 0x0788,
2324 IPRIORITYR227 = 0x078c,
2325 IPRIORITYR228 = 0x0790,
2326 IPRIORITYR229 = 0x0794,
2327 IPRIORITYR230 = 0x0798,
2328 IPRIORITYR231 = 0x079c,
2329 IPRIORITYR232 = 0x07a0,
2330 IPRIORITYR233 = 0x07a4,
2331 IPRIORITYR234 = 0x07a8,
2332 IPRIORITYR235 = 0x07ac,
2333 IPRIORITYR236 = 0x07b0,
2334 IPRIORITYR237 = 0x07b4,
2335 IPRIORITYR238 = 0x07b8,
2336 IPRIORITYR239 = 0x07bc,
2337 IPRIORITYR240 = 0x07c0,
2338 IPRIORITYR241 = 0x07c4,
2339 IPRIORITYR242 = 0x07c8,
2340 IPRIORITYR243 = 0x07cc,
2341 IPRIORITYR244 = 0x07d0,
2342 IPRIORITYR245 = 0x07d4,
2343 IPRIORITYR246 = 0x07d8,
2344 IPRIORITYR247 = 0x07dc,
2345 IPRIORITYR248 = 0x07e0,
2346 IPRIORITYR249 = 0x07e4,
2347 IPRIORITYR250 = 0x07e8,
2348 IPRIORITYR251 = 0x07ec,
2349 IPRIORITYR252 = 0x07f0,
2350 IPRIORITYR253 = 0x07f4,
2351 IPRIORITYR254 = 0x07f8,
2352
2353 ICFGR0 = 0x0c00,
2354 ICFGR1 = 0x0c04,
2355 ICFGR2 = 0x0c08,
2356 ICFGR3 = 0x0c0c,
2357 ICFGR4 = 0x0c10,
2358 ICFGR5 = 0x0c14,
2359 ICFGR6 = 0x0c18,
2360 ICFGR7 = 0x0c1c,
2361 ICFGR8 = 0x0c20,
2362 ICFGR9 = 0x0c24,
2363 ICFGR10 = 0x0c28,
2364 ICFGR11 = 0x0c2c,
2365 ICFGR12 = 0x0c30,
2366 ICFGR13 = 0x0c34,
2367 ICFGR14 = 0x0c38,
2368 ICFGR15 = 0x0c3c,
2369 ICFGR16 = 0x0c40,
2370 ICFGR17 = 0x0c44,
2371 ICFGR18 = 0x0c48,
2372 ICFGR19 = 0x0c4c,
2373 ICFGR20 = 0x0c50,
2374 ICFGR21 = 0x0c54,
2375 ICFGR22 = 0x0c58,
2376 ICFGR23 = 0x0c5c,
2377 ICFGR24 = 0x0c60,
2378 ICFGR25 = 0x0c64,
2379 ICFGR26 = 0x0c68,
2380 ICFGR27 = 0x0c6c,
2381 ICFGR28 = 0x0c70,
2382 ICFGR29 = 0x0c74,
2383 ICFGR30 = 0x0c78,
2384 ICFGR31 = 0x0c7c,
2385 ICFGR32 = 0x0c80,
2386 ICFGR33 = 0x0c84,
2387 ICFGR34 = 0x0c88,
2388 ICFGR35 = 0x0c8c,
2389 ICFGR36 = 0x0c90,
2390 ICFGR37 = 0x0c94,
2391 ICFGR38 = 0x0c98,
2392 ICFGR39 = 0x0c9c,
2393 ICFGR40 = 0x0ca0,
2394 ICFGR41 = 0x0ca4,
2395 ICFGR42 = 0x0ca8,
2396 ICFGR43 = 0x0cac,
2397 ICFGR44 = 0x0cb0,
2398 ICFGR45 = 0x0cb4,
2399 ICFGR46 = 0x0cb8,
2400 ICFGR47 = 0x0cbc,
2401 ICFGR48 = 0x0cc0,
2402 ICFGR49 = 0x0cc4,
2403 ICFGR50 = 0x0cc8,
2404 ICFGR51 = 0x0ccc,
2405 ICFGR52 = 0x0cd0,
2406 ICFGR53 = 0x0cd4,
2407 ICFGR54 = 0x0cd8,
2408 ICFGR55 = 0x0cdc,
2409 ICFGR56 = 0x0ce0,
2410 ICFGR57 = 0x0ce4,
2411 ICFGR58 = 0x0ce8,
2412 ICFGR59 = 0x0cec,
2413 ICFGR60 = 0x0cf0,
2414 ICFGR61 = 0x0cf4,
2415 ICFGR62 = 0x0cf8,
2416 ICFGR63 = 0x0cfc,
2417
2418 IROUTER32 = 0x6100,
2419 IROUTER33 = 0x6108,
2420 IROUTER34 = 0x6110,
2421 IROUTER35 = 0x6118,
2422 IROUTER36 = 0x6120,
2423 IROUTER37 = 0x6128,
2424 IROUTER38 = 0x6130,
2425 IROUTER39 = 0x6138,
2426 IROUTER40 = 0x6140,
2427 IROUTER41 = 0x6148,
2428 IROUTER42 = 0x6150,
2429 IROUTER43 = 0x6158,
2430 IROUTER44 = 0x6160,
2431 IROUTER45 = 0x6168,
2432 IROUTER46 = 0x6170,
2433 IROUTER47 = 0x6178,
2434 IROUTER48 = 0x6180,
2435 IROUTER49 = 0x6188,
2436 IROUTER50 = 0x6190,
2437 IROUTER51 = 0x6198,
2438 IROUTER52 = 0x61a0,
2439 IROUTER53 = 0x61a8,
2440 IROUTER54 = 0x61b0,
2441 IROUTER55 = 0x61b8,
2442 IROUTER56 = 0x61c0,
2443 IROUTER57 = 0x61c8,
2444 IROUTER58 = 0x61d0,
2445 IROUTER59 = 0x61d8,
2446 IROUTER60 = 0x61e0,
2447 IROUTER61 = 0x61e8,
2448 IROUTER62 = 0x61f0,
2449 IROUTER63 = 0x61f8,
2450 IROUTER64 = 0x6200,
2451 IROUTER65 = 0x6208,
2452 IROUTER66 = 0x6210,
2453 IROUTER67 = 0x6218,
2454 IROUTER68 = 0x6220,
2455 IROUTER69 = 0x6228,
2456 IROUTER70 = 0x6230,
2457 IROUTER71 = 0x6238,
2458 IROUTER72 = 0x6240,
2459 IROUTER73 = 0x6248,
2460 IROUTER74 = 0x6250,
2461 IROUTER75 = 0x6258,
2462 IROUTER76 = 0x6260,
2463 IROUTER77 = 0x6268,
2464 IROUTER78 = 0x6270,
2465 IROUTER79 = 0x6278,
2466 IROUTER80 = 0x6280,
2467 IROUTER81 = 0x6288,
2468 IROUTER82 = 0x6290,
2469 IROUTER83 = 0x6298,
2470 IROUTER84 = 0x62a0,
2471 IROUTER85 = 0x62a8,
2472 IROUTER86 = 0x62b0,
2473 IROUTER87 = 0x62b8,
2474 IROUTER88 = 0x62c0,
2475 IROUTER89 = 0x62c8,
2476 IROUTER90 = 0x62d0,
2477 IROUTER91 = 0x62d8,
2478 IROUTER92 = 0x62e0,
2479 IROUTER93 = 0x62e8,
2480 IROUTER94 = 0x62f0,
2481 IROUTER95 = 0x62f8,
2482 IROUTER96 = 0x6300,
2483 IROUTER97 = 0x6308,
2484 IROUTER98 = 0x6310,
2485 IROUTER99 = 0x6318,
2486 IROUTER100 = 0x6320,
2487 IROUTER101 = 0x6328,
2488 IROUTER102 = 0x6330,
2489 IROUTER103 = 0x6338,
2490 IROUTER104 = 0x6340,
2491 IROUTER105 = 0x6348,
2492 IROUTER106 = 0x6350,
2493 IROUTER107 = 0x6358,
2494 IROUTER108 = 0x6360,
2495 IROUTER109 = 0x6368,
2496 IROUTER110 = 0x6370,
2497 IROUTER111 = 0x6378,
2498 IROUTER112 = 0x6380,
2499 IROUTER113 = 0x6388,
2500 IROUTER114 = 0x6390,
2501 IROUTER115 = 0x6398,
2502 IROUTER116 = 0x63a0,
2503 IROUTER117 = 0x63a8,
2504 IROUTER118 = 0x63b0,
2505 IROUTER119 = 0x63b8,
2506 IROUTER120 = 0x63c0,
2507 IROUTER121 = 0x63c8,
2508 IROUTER122 = 0x63d0,
2509 IROUTER123 = 0x63d8,
2510 IROUTER124 = 0x63e0,
2511 IROUTER125 = 0x63e8,
2512 IROUTER126 = 0x63f0,
2513 IROUTER127 = 0x63f8,
2514 IROUTER128 = 0x6400,
2515 IROUTER129 = 0x6408,
2516 IROUTER130 = 0x6410,
2517 IROUTER131 = 0x6418,
2518 IROUTER132 = 0x6420,
2519 IROUTER133 = 0x6428,
2520 IROUTER134 = 0x6430,
2521 IROUTER135 = 0x6438,
2522 IROUTER136 = 0x6440,
2523 IROUTER137 = 0x6448,
2524 IROUTER138 = 0x6450,
2525 IROUTER139 = 0x6458,
2526 IROUTER140 = 0x6460,
2527 IROUTER141 = 0x6468,
2528 IROUTER142 = 0x6470,
2529 IROUTER143 = 0x6478,
2530 IROUTER144 = 0x6480,
2531 IROUTER145 = 0x6488,
2532 IROUTER146 = 0x6490,
2533 IROUTER147 = 0x6498,
2534 IROUTER148 = 0x64a0,
2535 IROUTER149 = 0x64a8,
2536 IROUTER150 = 0x64b0,
2537 IROUTER151 = 0x64b8,
2538 IROUTER152 = 0x64c0,
2539 IROUTER153 = 0x64c8,
2540 IROUTER154 = 0x64d0,
2541 IROUTER155 = 0x64d8,
2542 IROUTER156 = 0x64e0,
2543 IROUTER157 = 0x64e8,
2544 IROUTER158 = 0x64f0,
2545 IROUTER159 = 0x64f8,
2546 IROUTER160 = 0x6500,
2547 IROUTER161 = 0x6508,
2548 IROUTER162 = 0x6510,
2549 IROUTER163 = 0x6518,
2550 IROUTER164 = 0x6520,
2551 IROUTER165 = 0x6528,
2552 IROUTER166 = 0x6530,
2553 IROUTER167 = 0x6538,
2554 IROUTER168 = 0x6540,
2555 IROUTER169 = 0x6548,
2556 IROUTER170 = 0x6550,
2557 IROUTER171 = 0x6558,
2558 IROUTER172 = 0x6560,
2559 IROUTER173 = 0x6568,
2560 IROUTER174 = 0x6570,
2561 IROUTER175 = 0x6578,
2562 IROUTER176 = 0x6580,
2563 IROUTER177 = 0x6588,
2564 IROUTER178 = 0x6590,
2565 IROUTER179 = 0x6598,
2566 IROUTER180 = 0x65a0,
2567 IROUTER181 = 0x65a8,
2568 IROUTER182 = 0x65b0,
2569 IROUTER183 = 0x65b8,
2570 IROUTER184 = 0x65c0,
2571 IROUTER185 = 0x65c8,
2572 IROUTER186 = 0x65d0,
2573 IROUTER187 = 0x65d8,
2574 IROUTER188 = 0x65e0,
2575 IROUTER189 = 0x65e8,
2576 IROUTER190 = 0x65f0,
2577 IROUTER191 = 0x65f8,
2578 IROUTER192 = 0x6600,
2579 IROUTER193 = 0x6608,
2580 IROUTER194 = 0x6610,
2581 IROUTER195 = 0x6618,
2582 IROUTER196 = 0x6620,
2583 IROUTER197 = 0x6628,
2584 IROUTER198 = 0x6630,
2585 IROUTER199 = 0x6638,
2586 IROUTER200 = 0x6640,
2587 IROUTER201 = 0x6648,
2588 IROUTER202 = 0x6650,
2589 IROUTER203 = 0x6658,
2590 IROUTER204 = 0x6660,
2591 IROUTER205 = 0x6668,
2592 IROUTER206 = 0x6670,
2593 IROUTER207 = 0x6678,
2594 IROUTER208 = 0x6680,
2595 IROUTER209 = 0x6688,
2596 IROUTER210 = 0x6690,
2597 IROUTER211 = 0x6698,
2598 IROUTER212 = 0x66a0,
2599 IROUTER213 = 0x66a8,
2600 IROUTER214 = 0x66b0,
2601 IROUTER215 = 0x66b8,
2602 IROUTER216 = 0x66c0,
2603 IROUTER217 = 0x66c8,
2604 IROUTER218 = 0x66d0,
2605 IROUTER219 = 0x66d8,
2606 IROUTER220 = 0x66e0,
2607 IROUTER221 = 0x66e8,
2608 IROUTER222 = 0x66f0,
2609 IROUTER223 = 0x66f8,
2610 IROUTER224 = 0x6700,
2611 IROUTER225 = 0x6708,
2612 IROUTER226 = 0x6710,
2613 IROUTER227 = 0x6718,
2614 IROUTER228 = 0x6720,
2615 IROUTER229 = 0x6728,
2616 IROUTER230 = 0x6730,
2617 IROUTER231 = 0x6738,
2618 IROUTER232 = 0x6740,
2619 IROUTER233 = 0x6748,
2620 IROUTER234 = 0x6750,
2621 IROUTER235 = 0x6758,
2622 IROUTER236 = 0x6760,
2623 IROUTER237 = 0x6768,
2624 IROUTER238 = 0x6770,
2625 IROUTER239 = 0x6778,
2626 IROUTER240 = 0x6780,
2627 IROUTER241 = 0x6788,
2628 IROUTER242 = 0x6790,
2629 IROUTER243 = 0x6798,
2630 IROUTER244 = 0x67a0,
2631 IROUTER245 = 0x67a8,
2632 IROUTER246 = 0x67b0,
2633 IROUTER247 = 0x67b8,
2634 IROUTER248 = 0x67c0,
2635 IROUTER249 = 0x67c8,
2636 IROUTER250 = 0x67d0,
2637 IROUTER251 = 0x67d8,
2638 IROUTER252 = 0x67e0,
2639 IROUTER253 = 0x67e8,
2640 IROUTER254 = 0x67f0,
2641 IROUTER255 = 0x67f8,
2642 IROUTER256 = 0x6800,
2643 IROUTER257 = 0x6808,
2644 IROUTER258 = 0x6810,
2645 IROUTER259 = 0x6818,
2646 IROUTER260 = 0x6820,
2647 IROUTER261 = 0x6828,
2648 IROUTER262 = 0x6830,
2649 IROUTER263 = 0x6838,
2650 IROUTER264 = 0x6840,
2651 IROUTER265 = 0x6848,
2652 IROUTER266 = 0x6850,
2653 IROUTER267 = 0x6858,
2654 IROUTER268 = 0x6860,
2655 IROUTER269 = 0x6868,
2656 IROUTER270 = 0x6870,
2657 IROUTER271 = 0x6878,
2658 IROUTER272 = 0x6880,
2659 IROUTER273 = 0x6888,
2660 IROUTER274 = 0x6890,
2661 IROUTER275 = 0x6898,
2662 IROUTER276 = 0x68a0,
2663 IROUTER277 = 0x68a8,
2664 IROUTER278 = 0x68b0,
2665 IROUTER279 = 0x68b8,
2666 IROUTER280 = 0x68c0,
2667 IROUTER281 = 0x68c8,
2668 IROUTER282 = 0x68d0,
2669 IROUTER283 = 0x68d8,
2670 IROUTER284 = 0x68e0,
2671 IROUTER285 = 0x68e8,
2672 IROUTER286 = 0x68f0,
2673 IROUTER287 = 0x68f8,
2674 IROUTER288 = 0x6900,
2675 IROUTER289 = 0x6908,
2676 IROUTER290 = 0x6910,
2677 IROUTER291 = 0x6918,
2678 IROUTER292 = 0x6920,
2679 IROUTER293 = 0x6928,
2680 IROUTER294 = 0x6930,
2681 IROUTER295 = 0x6938,
2682 IROUTER296 = 0x6940,
2683 IROUTER297 = 0x6948,
2684 IROUTER298 = 0x6950,
2685 IROUTER299 = 0x6958,
2686 IROUTER300 = 0x6960,
2687 IROUTER301 = 0x6968,
2688 IROUTER302 = 0x6970,
2689 IROUTER303 = 0x6978,
2690 IROUTER304 = 0x6980,
2691 IROUTER305 = 0x6988,
2692 IROUTER306 = 0x6990,
2693 IROUTER307 = 0x6998,
2694 IROUTER308 = 0x69a0,
2695 IROUTER309 = 0x69a8,
2696 IROUTER310 = 0x69b0,
2697 IROUTER311 = 0x69b8,
2698 IROUTER312 = 0x69c0,
2699 IROUTER313 = 0x69c8,
2700 IROUTER314 = 0x69d0,
2701 IROUTER315 = 0x69d8,
2702 IROUTER316 = 0x69e0,
2703 IROUTER317 = 0x69e8,
2704 IROUTER318 = 0x69f0,
2705 IROUTER319 = 0x69f8,
2706 IROUTER320 = 0x6a00,
2707 IROUTER321 = 0x6a08,
2708 IROUTER322 = 0x6a10,
2709 IROUTER323 = 0x6a18,
2710 IROUTER324 = 0x6a20,
2711 IROUTER325 = 0x6a28,
2712 IROUTER326 = 0x6a30,
2713 IROUTER327 = 0x6a38,
2714 IROUTER328 = 0x6a40,
2715 IROUTER329 = 0x6a48,
2716 IROUTER330 = 0x6a50,
2717 IROUTER331 = 0x6a58,
2718 IROUTER332 = 0x6a60,
2719 IROUTER333 = 0x6a68,
2720 IROUTER334 = 0x6a70,
2721 IROUTER335 = 0x6a78,
2722 IROUTER336 = 0x6a80,
2723 IROUTER337 = 0x6a88,
2724 IROUTER338 = 0x6a90,
2725 IROUTER339 = 0x6a98,
2726 IROUTER340 = 0x6aa0,
2727 IROUTER341 = 0x6aa8,
2728 IROUTER342 = 0x6ab0,
2729 IROUTER343 = 0x6ab8,
2730 IROUTER344 = 0x6ac0,
2731 IROUTER345 = 0x6ac8,
2732 IROUTER346 = 0x6ad0,
2733 IROUTER347 = 0x6ad8,
2734 IROUTER348 = 0x6ae0,
2735 IROUTER349 = 0x6ae8,
2736 IROUTER350 = 0x6af0,
2737 IROUTER351 = 0x6af8,
2738 IROUTER352 = 0x6b00,
2739 IROUTER353 = 0x6b08,
2740 IROUTER354 = 0x6b10,
2741 IROUTER355 = 0x6b18,
2742 IROUTER356 = 0x6b20,
2743 IROUTER357 = 0x6b28,
2744 IROUTER358 = 0x6b30,
2745 IROUTER359 = 0x6b38,
2746 IROUTER360 = 0x6b40,
2747 IROUTER361 = 0x6b48,
2748 IROUTER362 = 0x6b50,
2749 IROUTER363 = 0x6b58,
2750 IROUTER364 = 0x6b60,
2751 IROUTER365 = 0x6b68,
2752 IROUTER366 = 0x6b70,
2753 IROUTER367 = 0x6b78,
2754 IROUTER368 = 0x6b80,
2755 IROUTER369 = 0x6b88,
2756 IROUTER370 = 0x6b90,
2757 IROUTER371 = 0x6b98,
2758 IROUTER372 = 0x6ba0,
2759 IROUTER373 = 0x6ba8,
2760 IROUTER374 = 0x6bb0,
2761 IROUTER375 = 0x6bb8,
2762 IROUTER376 = 0x6bc0,
2763 IROUTER377 = 0x6bc8,
2764 IROUTER378 = 0x6bd0,
2765 IROUTER379 = 0x6bd8,
2766 IROUTER380 = 0x6be0,
2767 IROUTER381 = 0x6be8,
2768 IROUTER382 = 0x6bf0,
2769 IROUTER383 = 0x6bf8,
2770 IROUTER384 = 0x6c00,
2771 IROUTER385 = 0x6c08,
2772 IROUTER386 = 0x6c10,
2773 IROUTER387 = 0x6c18,
2774 IROUTER388 = 0x6c20,
2775 IROUTER389 = 0x6c28,
2776 IROUTER390 = 0x6c30,
2777 IROUTER391 = 0x6c38,
2778 IROUTER392 = 0x6c40,
2779 IROUTER393 = 0x6c48,
2780 IROUTER394 = 0x6c50,
2781 IROUTER395 = 0x6c58,
2782 IROUTER396 = 0x6c60,
2783 IROUTER397 = 0x6c68,
2784 IROUTER398 = 0x6c70,
2785 IROUTER399 = 0x6c78,
2786 IROUTER400 = 0x6c80,
2787 IROUTER401 = 0x6c88,
2788 IROUTER402 = 0x6c90,
2789 IROUTER403 = 0x6c98,
2790 IROUTER404 = 0x6ca0,
2791 IROUTER405 = 0x6ca8,
2792 IROUTER406 = 0x6cb0,
2793 IROUTER407 = 0x6cb8,
2794 IROUTER408 = 0x6cc0,
2795 IROUTER409 = 0x6cc8,
2796 IROUTER410 = 0x6cd0,
2797 IROUTER411 = 0x6cd8,
2798 IROUTER412 = 0x6ce0,
2799 IROUTER413 = 0x6ce8,
2800 IROUTER414 = 0x6cf0,
2801 IROUTER415 = 0x6cf8,
2802 IROUTER416 = 0x6d00,
2803 IROUTER417 = 0x6d08,
2804 IROUTER418 = 0x6d10,
2805 IROUTER419 = 0x6d18,
2806 IROUTER420 = 0x6d20,
2807 IROUTER421 = 0x6d28,
2808 IROUTER422 = 0x6d30,
2809 IROUTER423 = 0x6d38,
2810 IROUTER424 = 0x6d40,
2811 IROUTER425 = 0x6d48,
2812 IROUTER426 = 0x6d50,
2813 IROUTER427 = 0x6d58,
2814 IROUTER428 = 0x6d60,
2815 IROUTER429 = 0x6d68,
2816 IROUTER430 = 0x6d70,
2817 IROUTER431 = 0x6d78,
2818 IROUTER432 = 0x6d80,
2819 IROUTER433 = 0x6d88,
2820 IROUTER434 = 0x6d90,
2821 IROUTER435 = 0x6d98,
2822 IROUTER436 = 0x6da0,
2823 IROUTER437 = 0x6da8,
2824 IROUTER438 = 0x6db0,
2825 IROUTER439 = 0x6db8,
2826 IROUTER440 = 0x6dc0,
2827 IROUTER441 = 0x6dc8,
2828 IROUTER442 = 0x6dd0,
2829 IROUTER443 = 0x6dd8,
2830 IROUTER444 = 0x6de0,
2831 IROUTER445 = 0x6de8,
2832 IROUTER446 = 0x6df0,
2833 IROUTER447 = 0x6df8,
2834 IROUTER448 = 0x6e00,
2835 IROUTER449 = 0x6e08,
2836 IROUTER450 = 0x6e10,
2837 IROUTER451 = 0x6e18,
2838 IROUTER452 = 0x6e20,
2839 IROUTER453 = 0x6e28,
2840 IROUTER454 = 0x6e30,
2841 IROUTER455 = 0x6e38,
2842 IROUTER456 = 0x6e40,
2843 IROUTER457 = 0x6e48,
2844 IROUTER458 = 0x6e50,
2845 IROUTER459 = 0x6e58,
2846 IROUTER460 = 0x6e60,
2847 IROUTER461 = 0x6e68,
2848 IROUTER462 = 0x6e70,
2849 IROUTER463 = 0x6e78,
2850 IROUTER464 = 0x6e80,
2851 IROUTER465 = 0x6e88,
2852 IROUTER466 = 0x6e90,
2853 IROUTER467 = 0x6e98,
2854 IROUTER468 = 0x6ea0,
2855 IROUTER469 = 0x6ea8,
2856 IROUTER470 = 0x6eb0,
2857 IROUTER471 = 0x6eb8,
2858 IROUTER472 = 0x6ec0,
2859 IROUTER473 = 0x6ec8,
2860 IROUTER474 = 0x6ed0,
2861 IROUTER475 = 0x6ed8,
2862 IROUTER476 = 0x6ee0,
2863 IROUTER477 = 0x6ee8,
2864 IROUTER478 = 0x6ef0,
2865 IROUTER479 = 0x6ef8,
2866 IROUTER480 = 0x6f00,
2867 IROUTER481 = 0x6f08,
2868 IROUTER482 = 0x6f10,
2869 IROUTER483 = 0x6f18,
2870 IROUTER484 = 0x6f20,
2871 IROUTER485 = 0x6f28,
2872 IROUTER486 = 0x6f30,
2873 IROUTER487 = 0x6f38,
2874 IROUTER488 = 0x6f40,
2875 IROUTER489 = 0x6f48,
2876 IROUTER490 = 0x6f50,
2877 IROUTER491 = 0x6f58,
2878 IROUTER492 = 0x6f60,
2879 IROUTER493 = 0x6f68,
2880 IROUTER494 = 0x6f70,
2881 IROUTER495 = 0x6f78,
2882 IROUTER496 = 0x6f80,
2883 IROUTER497 = 0x6f88,
2884 IROUTER498 = 0x6f90,
2885 IROUTER499 = 0x6f98,
2886 IROUTER500 = 0x6fa0,
2887 IROUTER501 = 0x6fa8,
2888 IROUTER502 = 0x6fb0,
2889 IROUTER503 = 0x6fb8,
2890 IROUTER504 = 0x6fc0,
2891 IROUTER505 = 0x6fc8,
2892 IROUTER506 = 0x6fd0,
2893 IROUTER507 = 0x6fd8,
2894 IROUTER508 = 0x6fe0,
2895 IROUTER509 = 0x6fe8,
2896 IROUTER510 = 0x6ff0,
2897 IROUTER511 = 0x6ff8,
2898 IROUTER512 = 0x7000,
2899 IROUTER513 = 0x7008,
2900 IROUTER514 = 0x7010,
2901 IROUTER515 = 0x7018,
2902 IROUTER516 = 0x7020,
2903 IROUTER517 = 0x7028,
2904 IROUTER518 = 0x7030,
2905 IROUTER519 = 0x7038,
2906 IROUTER520 = 0x7040,
2907 IROUTER521 = 0x7048,
2908 IROUTER522 = 0x7050,
2909 IROUTER523 = 0x7058,
2910 IROUTER524 = 0x7060,
2911 IROUTER525 = 0x7068,
2912 IROUTER526 = 0x7070,
2913 IROUTER527 = 0x7078,
2914 IROUTER528 = 0x7080,
2915 IROUTER529 = 0x7088,
2916 IROUTER530 = 0x7090,
2917 IROUTER531 = 0x7098,
2918 IROUTER532 = 0x70a0,
2919 IROUTER533 = 0x70a8,
2920 IROUTER534 = 0x70b0,
2921 IROUTER535 = 0x70b8,
2922 IROUTER536 = 0x70c0,
2923 IROUTER537 = 0x70c8,
2924 IROUTER538 = 0x70d0,
2925 IROUTER539 = 0x70d8,
2926 IROUTER540 = 0x70e0,
2927 IROUTER541 = 0x70e8,
2928 IROUTER542 = 0x70f0,
2929 IROUTER543 = 0x70f8,
2930 IROUTER544 = 0x7100,
2931 IROUTER545 = 0x7108,
2932 IROUTER546 = 0x7110,
2933 IROUTER547 = 0x7118,
2934 IROUTER548 = 0x7120,
2935 IROUTER549 = 0x7128,
2936 IROUTER550 = 0x7130,
2937 IROUTER551 = 0x7138,
2938 IROUTER552 = 0x7140,
2939 IROUTER553 = 0x7148,
2940 IROUTER554 = 0x7150,
2941 IROUTER555 = 0x7158,
2942 IROUTER556 = 0x7160,
2943 IROUTER557 = 0x7168,
2944 IROUTER558 = 0x7170,
2945 IROUTER559 = 0x7178,
2946 IROUTER560 = 0x7180,
2947 IROUTER561 = 0x7188,
2948 IROUTER562 = 0x7190,
2949 IROUTER563 = 0x7198,
2950 IROUTER564 = 0x71a0,
2951 IROUTER565 = 0x71a8,
2952 IROUTER566 = 0x71b0,
2953 IROUTER567 = 0x71b8,
2954 IROUTER568 = 0x71c0,
2955 IROUTER569 = 0x71c8,
2956 IROUTER570 = 0x71d0,
2957 IROUTER571 = 0x71d8,
2958 IROUTER572 = 0x71e0,
2959 IROUTER573 = 0x71e8,
2960 IROUTER574 = 0x71f0,
2961 IROUTER575 = 0x71f8,
2962 IROUTER576 = 0x7200,
2963 IROUTER577 = 0x7208,
2964 IROUTER578 = 0x7210,
2965 IROUTER579 = 0x7218,
2966 IROUTER580 = 0x7220,
2967 IROUTER581 = 0x7228,
2968 IROUTER582 = 0x7230,
2969 IROUTER583 = 0x7238,
2970 IROUTER584 = 0x7240,
2971 IROUTER585 = 0x7248,
2972 IROUTER586 = 0x7250,
2973 IROUTER587 = 0x7258,
2974 IROUTER588 = 0x7260,
2975 IROUTER589 = 0x7268,
2976 IROUTER590 = 0x7270,
2977 IROUTER591 = 0x7278,
2978 IROUTER592 = 0x7280,
2979 IROUTER593 = 0x7288,
2980 IROUTER594 = 0x7290,
2981 IROUTER595 = 0x7298,
2982 IROUTER596 = 0x72a0,
2983 IROUTER597 = 0x72a8,
2984 IROUTER598 = 0x72b0,
2985 IROUTER599 = 0x72b8,
2986 IROUTER600 = 0x72c0,
2987 IROUTER601 = 0x72c8,
2988 IROUTER602 = 0x72d0,
2989 IROUTER603 = 0x72d8,
2990 IROUTER604 = 0x72e0,
2991 IROUTER605 = 0x72e8,
2992 IROUTER606 = 0x72f0,
2993 IROUTER607 = 0x72f8,
2994 IROUTER608 = 0x7300,
2995 IROUTER609 = 0x7308,
2996 IROUTER610 = 0x7310,
2997 IROUTER611 = 0x7318,
2998 IROUTER612 = 0x7320,
2999 IROUTER613 = 0x7328,
3000 IROUTER614 = 0x7330,
3001 IROUTER615 = 0x7338,
3002 IROUTER616 = 0x7340,
3003 IROUTER617 = 0x7348,
3004 IROUTER618 = 0x7350,
3005 IROUTER619 = 0x7358,
3006 IROUTER620 = 0x7360,
3007 IROUTER621 = 0x7368,
3008 IROUTER622 = 0x7370,
3009 IROUTER623 = 0x7378,
3010 IROUTER624 = 0x7380,
3011 IROUTER625 = 0x7388,
3012 IROUTER626 = 0x7390,
3013 IROUTER627 = 0x7398,
3014 IROUTER628 = 0x73a0,
3015 IROUTER629 = 0x73a8,
3016 IROUTER630 = 0x73b0,
3017 IROUTER631 = 0x73b8,
3018 IROUTER632 = 0x73c0,
3019 IROUTER633 = 0x73c8,
3020 IROUTER634 = 0x73d0,
3021 IROUTER635 = 0x73d8,
3022 IROUTER636 = 0x73e0,
3023 IROUTER637 = 0x73e8,
3024 IROUTER638 = 0x73f0,
3025 IROUTER639 = 0x73f8,
3026 IROUTER640 = 0x7400,
3027 IROUTER641 = 0x7408,
3028 IROUTER642 = 0x7410,
3029 IROUTER643 = 0x7418,
3030 IROUTER644 = 0x7420,
3031 IROUTER645 = 0x7428,
3032 IROUTER646 = 0x7430,
3033 IROUTER647 = 0x7438,
3034 IROUTER648 = 0x7440,
3035 IROUTER649 = 0x7448,
3036 IROUTER650 = 0x7450,
3037 IROUTER651 = 0x7458,
3038 IROUTER652 = 0x7460,
3039 IROUTER653 = 0x7468,
3040 IROUTER654 = 0x7470,
3041 IROUTER655 = 0x7478,
3042 IROUTER656 = 0x7480,
3043 IROUTER657 = 0x7488,
3044 IROUTER658 = 0x7490,
3045 IROUTER659 = 0x7498,
3046 IROUTER660 = 0x74a0,
3047 IROUTER661 = 0x74a8,
3048 IROUTER662 = 0x74b0,
3049 IROUTER663 = 0x74b8,
3050 IROUTER664 = 0x74c0,
3051 IROUTER665 = 0x74c8,
3052 IROUTER666 = 0x74d0,
3053 IROUTER667 = 0x74d8,
3054 IROUTER668 = 0x74e0,
3055 IROUTER669 = 0x74e8,
3056 IROUTER670 = 0x74f0,
3057 IROUTER671 = 0x74f8,
3058 IROUTER672 = 0x7500,
3059 IROUTER673 = 0x7508,
3060 IROUTER674 = 0x7510,
3061 IROUTER675 = 0x7518,
3062 IROUTER676 = 0x7520,
3063 IROUTER677 = 0x7528,
3064 IROUTER678 = 0x7530,
3065 IROUTER679 = 0x7538,
3066 IROUTER680 = 0x7540,
3067 IROUTER681 = 0x7548,
3068 IROUTER682 = 0x7550,
3069 IROUTER683 = 0x7558,
3070 IROUTER684 = 0x7560,
3071 IROUTER685 = 0x7568,
3072 IROUTER686 = 0x7570,
3073 IROUTER687 = 0x7578,
3074 IROUTER688 = 0x7580,
3075 IROUTER689 = 0x7588,
3076 IROUTER690 = 0x7590,
3077 IROUTER691 = 0x7598,
3078 IROUTER692 = 0x75a0,
3079 IROUTER693 = 0x75a8,
3080 IROUTER694 = 0x75b0,
3081 IROUTER695 = 0x75b8,
3082 IROUTER696 = 0x75c0,
3083 IROUTER697 = 0x75c8,
3084 IROUTER698 = 0x75d0,
3085 IROUTER699 = 0x75d8,
3086 IROUTER700 = 0x75e0,
3087 IROUTER701 = 0x75e8,
3088 IROUTER702 = 0x75f0,
3089 IROUTER703 = 0x75f8,
3090 IROUTER704 = 0x7600,
3091 IROUTER705 = 0x7608,
3092 IROUTER706 = 0x7610,
3093 IROUTER707 = 0x7618,
3094 IROUTER708 = 0x7620,
3095 IROUTER709 = 0x7628,
3096 IROUTER710 = 0x7630,
3097 IROUTER711 = 0x7638,
3098 IROUTER712 = 0x7640,
3099 IROUTER713 = 0x7648,
3100 IROUTER714 = 0x7650,
3101 IROUTER715 = 0x7658,
3102 IROUTER716 = 0x7660,
3103 IROUTER717 = 0x7668,
3104 IROUTER718 = 0x7670,
3105 IROUTER719 = 0x7678,
3106 IROUTER720 = 0x7680,
3107 IROUTER721 = 0x7688,
3108 IROUTER722 = 0x7690,
3109 IROUTER723 = 0x7698,
3110 IROUTER724 = 0x76a0,
3111 IROUTER725 = 0x76a8,
3112 IROUTER726 = 0x76b0,
3113 IROUTER727 = 0x76b8,
3114 IROUTER728 = 0x76c0,
3115 IROUTER729 = 0x76c8,
3116 IROUTER730 = 0x76d0,
3117 IROUTER731 = 0x76d8,
3118 IROUTER732 = 0x76e0,
3119 IROUTER733 = 0x76e8,
3120 IROUTER734 = 0x76f0,
3121 IROUTER735 = 0x76f8,
3122 IROUTER736 = 0x7700,
3123 IROUTER737 = 0x7708,
3124 IROUTER738 = 0x7710,
3125 IROUTER739 = 0x7718,
3126 IROUTER740 = 0x7720,
3127 IROUTER741 = 0x7728,
3128 IROUTER742 = 0x7730,
3129 IROUTER743 = 0x7738,
3130 IROUTER744 = 0x7740,
3131 IROUTER745 = 0x7748,
3132 IROUTER746 = 0x7750,
3133 IROUTER747 = 0x7758,
3134 IROUTER748 = 0x7760,
3135 IROUTER749 = 0x7768,
3136 IROUTER750 = 0x7770,
3137 IROUTER751 = 0x7778,
3138 IROUTER752 = 0x7780,
3139 IROUTER753 = 0x7788,
3140 IROUTER754 = 0x7790,
3141 IROUTER755 = 0x7798,
3142 IROUTER756 = 0x77a0,
3143 IROUTER757 = 0x77a8,
3144 IROUTER758 = 0x77b0,
3145 IROUTER759 = 0x77b8,
3146 IROUTER760 = 0x77c0,
3147 IROUTER761 = 0x77c8,
3148 IROUTER762 = 0x77d0,
3149 IROUTER763 = 0x77d8,
3150 IROUTER764 = 0x77e0,
3151 IROUTER765 = 0x77e8,
3152 IROUTER766 = 0x77f0,
3153 IROUTER767 = 0x77f8,
3154 IROUTER768 = 0x7800,
3155 IROUTER769 = 0x7808,
3156 IROUTER770 = 0x7810,
3157 IROUTER771 = 0x7818,
3158 IROUTER772 = 0x7820,
3159 IROUTER773 = 0x7828,
3160 IROUTER774 = 0x7830,
3161 IROUTER775 = 0x7838,
3162 IROUTER776 = 0x7840,
3163 IROUTER777 = 0x7848,
3164 IROUTER778 = 0x7850,
3165 IROUTER779 = 0x7858,
3166 IROUTER780 = 0x7860,
3167 IROUTER781 = 0x7868,
3168 IROUTER782 = 0x7870,
3169 IROUTER783 = 0x7878,
3170 IROUTER784 = 0x7880,
3171 IROUTER785 = 0x7888,
3172 IROUTER786 = 0x7890,
3173 IROUTER787 = 0x7898,
3174 IROUTER788 = 0x78a0,
3175 IROUTER789 = 0x78a8,
3176 IROUTER790 = 0x78b0,
3177 IROUTER791 = 0x78b8,
3178 IROUTER792 = 0x78c0,
3179 IROUTER793 = 0x78c8,
3180 IROUTER794 = 0x78d0,
3181 IROUTER795 = 0x78d8,
3182 IROUTER796 = 0x78e0,
3183 IROUTER797 = 0x78e8,
3184 IROUTER798 = 0x78f0,
3185 IROUTER799 = 0x78f8,
3186 IROUTER800 = 0x7900,
3187 IROUTER801 = 0x7908,
3188 IROUTER802 = 0x7910,
3189 IROUTER803 = 0x7918,
3190 IROUTER804 = 0x7920,
3191 IROUTER805 = 0x7928,
3192 IROUTER806 = 0x7930,
3193 IROUTER807 = 0x7938,
3194 IROUTER808 = 0x7940,
3195 IROUTER809 = 0x7948,
3196 IROUTER810 = 0x7950,
3197 IROUTER811 = 0x7958,
3198 IROUTER812 = 0x7960,
3199 IROUTER813 = 0x7968,
3200 IROUTER814 = 0x7970,
3201 IROUTER815 = 0x7978,
3202 IROUTER816 = 0x7980,
3203 IROUTER817 = 0x7988,
3204 IROUTER818 = 0x7990,
3205 IROUTER819 = 0x7998,
3206 IROUTER820 = 0x79a0,
3207 IROUTER821 = 0x79a8,
3208 IROUTER822 = 0x79b0,
3209 IROUTER823 = 0x79b8,
3210 IROUTER824 = 0x79c0,
3211 IROUTER825 = 0x79c8,
3212 IROUTER826 = 0x79d0,
3213 IROUTER827 = 0x79d8,
3214 IROUTER828 = 0x79e0,
3215 IROUTER829 = 0x79e8,
3216 IROUTER830 = 0x79f0,
3217 IROUTER831 = 0x79f8,
3218 IROUTER832 = 0x7a00,
3219 IROUTER833 = 0x7a08,
3220 IROUTER834 = 0x7a10,
3221 IROUTER835 = 0x7a18,
3222 IROUTER836 = 0x7a20,
3223 IROUTER837 = 0x7a28,
3224 IROUTER838 = 0x7a30,
3225 IROUTER839 = 0x7a38,
3226 IROUTER840 = 0x7a40,
3227 IROUTER841 = 0x7a48,
3228 IROUTER842 = 0x7a50,
3229 IROUTER843 = 0x7a58,
3230 IROUTER844 = 0x7a60,
3231 IROUTER845 = 0x7a68,
3232 IROUTER846 = 0x7a70,
3233 IROUTER847 = 0x7a78,
3234 IROUTER848 = 0x7a80,
3235 IROUTER849 = 0x7a88,
3236 IROUTER850 = 0x7a90,
3237 IROUTER851 = 0x7a98,
3238 IROUTER852 = 0x7aa0,
3239 IROUTER853 = 0x7aa8,
3240 IROUTER854 = 0x7ab0,
3241 IROUTER855 = 0x7ab8,
3242 IROUTER856 = 0x7ac0,
3243 IROUTER857 = 0x7ac8,
3244 IROUTER858 = 0x7ad0,
3245 IROUTER859 = 0x7ad8,
3246 IROUTER860 = 0x7ae0,
3247 IROUTER861 = 0x7ae8,
3248 IROUTER862 = 0x7af0,
3249 IROUTER863 = 0x7af8,
3250 IROUTER864 = 0x7b00,
3251 IROUTER865 = 0x7b08,
3252 IROUTER866 = 0x7b10,
3253 IROUTER867 = 0x7b18,
3254 IROUTER868 = 0x7b20,
3255 IROUTER869 = 0x7b28,
3256 IROUTER870 = 0x7b30,
3257 IROUTER871 = 0x7b38,
3258 IROUTER872 = 0x7b40,
3259 IROUTER873 = 0x7b48,
3260 IROUTER874 = 0x7b50,
3261 IROUTER875 = 0x7b58,
3262 IROUTER876 = 0x7b60,
3263 IROUTER877 = 0x7b68,
3264 IROUTER878 = 0x7b70,
3265 IROUTER879 = 0x7b78,
3266 IROUTER880 = 0x7b80,
3267 IROUTER881 = 0x7b88,
3268 IROUTER882 = 0x7b90,
3269 IROUTER883 = 0x7b98,
3270 IROUTER884 = 0x7ba0,
3271 IROUTER885 = 0x7ba8,
3272 IROUTER886 = 0x7bb0,
3273 IROUTER887 = 0x7bb8,
3274 IROUTER888 = 0x7bc0,
3275 IROUTER889 = 0x7bc8,
3276 IROUTER890 = 0x7bd0,
3277 IROUTER891 = 0x7bd8,
3278 IROUTER892 = 0x7be0,
3279 IROUTER893 = 0x7be8,
3280 IROUTER894 = 0x7bf0,
3281 IROUTER895 = 0x7bf8,
3282 IROUTER896 = 0x7c00,
3283 IROUTER897 = 0x7c08,
3284 IROUTER898 = 0x7c10,
3285 IROUTER899 = 0x7c18,
3286 IROUTER900 = 0x7c20,
3287 IROUTER901 = 0x7c28,
3288 IROUTER902 = 0x7c30,
3289 IROUTER903 = 0x7c38,
3290 IROUTER904 = 0x7c40,
3291 IROUTER905 = 0x7c48,
3292 IROUTER906 = 0x7c50,
3293 IROUTER907 = 0x7c58,
3294 IROUTER908 = 0x7c60,
3295 IROUTER909 = 0x7c68,
3296 IROUTER910 = 0x7c70,
3297 IROUTER911 = 0x7c78,
3298 IROUTER912 = 0x7c80,
3299 IROUTER913 = 0x7c88,
3300 IROUTER914 = 0x7c90,
3301 IROUTER915 = 0x7c98,
3302 IROUTER916 = 0x7ca0,
3303 IROUTER917 = 0x7ca8,
3304 IROUTER918 = 0x7cb0,
3305 IROUTER919 = 0x7cb8,
3306 IROUTER920 = 0x7cc0,
3307 IROUTER921 = 0x7cc8,
3308 IROUTER922 = 0x7cd0,
3309 IROUTER923 = 0x7cd8,
3310 IROUTER924 = 0x7ce0,
3311 IROUTER925 = 0x7ce8,
3312 IROUTER926 = 0x7cf0,
3313 IROUTER927 = 0x7cf8,
3314 IROUTER928 = 0x7d00,
3315 IROUTER929 = 0x7d08,
3316 IROUTER930 = 0x7d10,
3317 IROUTER931 = 0x7d18,
3318 IROUTER932 = 0x7d20,
3319 IROUTER933 = 0x7d28,
3320 IROUTER934 = 0x7d30,
3321 IROUTER935 = 0x7d38,
3322 IROUTER936 = 0x7d40,
3323 IROUTER937 = 0x7d48,
3324 IROUTER938 = 0x7d50,
3325 IROUTER939 = 0x7d58,
3326 IROUTER940 = 0x7d60,
3327 IROUTER941 = 0x7d68,
3328 IROUTER942 = 0x7d70,
3329 IROUTER943 = 0x7d78,
3330 IROUTER944 = 0x7d80,
3331 IROUTER945 = 0x7d88,
3332 IROUTER946 = 0x7d90,
3333 IROUTER947 = 0x7d98,
3334 IROUTER948 = 0x7da0,
3335 IROUTER949 = 0x7da8,
3336 IROUTER950 = 0x7db0,
3337 IROUTER951 = 0x7db8,
3338 IROUTER952 = 0x7dc0,
3339 IROUTER953 = 0x7dc8,
3340 IROUTER954 = 0x7dd0,
3341 IROUTER955 = 0x7dd8,
3342 IROUTER956 = 0x7de0,
3343 IROUTER957 = 0x7de8,
3344 IROUTER958 = 0x7df0,
3345 IROUTER959 = 0x7df8,
3346 IROUTER960 = 0x7e00,
3347 IROUTER961 = 0x7e08,
3348 IROUTER962 = 0x7e10,
3349 IROUTER963 = 0x7e18,
3350 IROUTER964 = 0x7e20,
3351 IROUTER965 = 0x7e28,
3352 IROUTER966 = 0x7e30,
3353 IROUTER967 = 0x7e38,
3354 IROUTER968 = 0x7e40,
3355 IROUTER969 = 0x7e48,
3356 IROUTER970 = 0x7e50,
3357 IROUTER971 = 0x7e58,
3358 IROUTER972 = 0x7e60,
3359 IROUTER973 = 0x7e68,
3360 IROUTER974 = 0x7e70,
3361 IROUTER975 = 0x7e78,
3362 IROUTER976 = 0x7e80,
3363 IROUTER977 = 0x7e88,
3364 IROUTER978 = 0x7e90,
3365 IROUTER979 = 0x7e98,
3366 IROUTER980 = 0x7ea0,
3367 IROUTER981 = 0x7ea8,
3368 IROUTER982 = 0x7eb0,
3369 IROUTER983 = 0x7eb8,
3370 IROUTER984 = 0x7ec0,
3371 IROUTER985 = 0x7ec8,
3372 IROUTER986 = 0x7ed0,
3373 IROUTER987 = 0x7ed8,
3374 IROUTER988 = 0x7ee0,
3375 IROUTER989 = 0x7ee8,
3376 IROUTER990 = 0x7ef0,
3377 IROUTER991 = 0x7ef8,
3378 IROUTER992 = 0x7f00,
3379 IROUTER993 = 0x7f08,
3380 IROUTER994 = 0x7f10,
3381 IROUTER995 = 0x7f18,
3382 IROUTER996 = 0x7f20,
3383 IROUTER997 = 0x7f28,
3384 IROUTER998 = 0x7f30,
3385 IROUTER999 = 0x7f38,
3386 IROUTER1000 = 0x7f40,
3387 IROUTER1001 = 0x7f48,
3388 IROUTER1002 = 0x7f50,
3389 IROUTER1003 = 0x7f58,
3390 IROUTER1004 = 0x7f60,
3391 IROUTER1005 = 0x7f68,
3392 IROUTER1006 = 0x7f70,
3393 IROUTER1007 = 0x7f78,
3394 IROUTER1008 = 0x7f80,
3395 IROUTER1009 = 0x7f88,
3396 IROUTER1010 = 0x7f90,
3397 IROUTER1011 = 0x7f98,
3398 IROUTER1012 = 0x7fa0,
3399 IROUTER1013 = 0x7fa8,
3400 IROUTER1014 = 0x7fb0,
3401 IROUTER1015 = 0x7fb8,
3402 IROUTER1016 = 0x7fc0,
3403 IROUTER1017 = 0x7fc8,
3404 IROUTER1018 = 0x7fd0,
3405 IROUTER1019 = 0x7fd8,
3406
3407 PIDR2 = 0xffe8,
3408}
3409
3410/// Type of an ARM GIC redistributor register.
3411#[repr(C)]
3412#[cfg(feature = "macos-15-0")]
3413#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
3414pub enum hv_gic_redistributor_reg_t {
3415 TYPER = 0x0008,
3416 PIDR2 = 0xffe8,
3417
3418 IGROUPR0 = 0x10080,
3419 ISENABLER0 = 0x10100,
3420 ICENABLER0 = 0x10180,
3421 ISPENDR0 = 0x10200,
3422 ICPENDR0 = 0x10280,
3423 ISACTIVER0 = 0x10300,
3424 ICACTIVER0 = 0x10380,
3425
3426 IPRIORITYR0 = 0x10400,
3427 IPRIORITYR1 = 0x10404,
3428 IPRIORITYR2 = 0x10408,
3429 IPRIORITYR3 = 0x1040c,
3430 IPRIORITYR4 = 0x10410,
3431 IPRIORITYR5 = 0x10414,
3432 IPRIORITYR6 = 0x10418,
3433 IPRIORITYR7 = 0x1041c,
3434
3435 ICFGR0 = 0x10c00,
3436 ICFGR1 = 0x10c04,
3437}
3438
3439/// Type of an ARM GIC ICC system control register.
3440#[repr(C)]
3441#[cfg(feature = "macos-15-0")]
3442#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
3443pub enum hv_gic_icc_reg_t {
3444 PMR_EL1 = 0xc230,
3445 BPR0_EL1 = 0xc643,
3446 AP0R0_EL1 = 0xc644,
3447 AP1R0_EL1 = 0xc648,
3448 RPR_EL1 = 0xc65b,
3449 BPR1_EL1 = 0xc663,
3450 CTLR_EL1 = 0xc664,
3451 SRE_EL1 = 0xc665,
3452 IGRPEN0_EL1 = 0xc666,
3453 IGRPEN1_EL1 = 0xc667,
3454 SRE_EL2 = 0xe64d,
3455}
3456
3457/// Type of an ARM GIC virtualization control system register.
3458#[repr(C)]
3459#[cfg(feature = "macos-15-0")]
3460#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
3461pub enum hv_gic_ich_reg_t {
3462 AP0R0_EL2 = 0xe640,
3463 AP1R0_EL2 = 0xe648,
3464 HCR_EL2 = 0xe658,
3465 VTR_EL2 = 0xe659,
3466 MISR_EL2 = 0xe65a,
3467 EISR_EL2 = 0xe65b,
3468 ELRSR_EL2 = 0xe65d,
3469 VMCR_EL2 = 0xe65f,
3470 LR0_EL2 = 0xe660,
3471 LR1_EL2 = 0xe661,
3472 LR2_EL2 = 0xe662,
3473 LR3_EL2 = 0xe663,
3474 LR4_EL2 = 0xe664,
3475 LR5_EL2 = 0xe665,
3476 LR6_EL2 = 0xe666,
3477 LR7_EL2 = 0xe667,
3478 LR8_EL2 = 0xe668,
3479 LR9_EL2 = 0xe669,
3480 LR10_EL2 = 0xe66a,
3481 LR11_EL2 = 0xe66b,
3482 LR12_EL2 = 0xe66c,
3483 LR13_EL2 = 0xe66d,
3484 LR14_EL2 = 0xe66e,
3485 LR15_EL2 = 0xe66f,
3486}
3487
3488/// Type of an ARM GIC ICV system control register.
3489#[repr(C)]
3490#[cfg(feature = "macos-15-0")]
3491#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
3492pub enum hv_gic_icv_reg_t {
3493 PMR_EL1 = 0xc230,
3494 BPR0_EL1 = 0xc643,
3495 AP0R0_EL1 = 0xc644,
3496 AP1R0_EL1 = 0xc648,
3497 RPR_EL1 = 0xc65b,
3498 BPR1_EL1 = 0xc663,
3499 CTLR_EL1 = 0xc664,
3500 SRE_EL1 = 0xc665,
3501 IGRPEN0_EL1 = 0xc666,
3502 IGRPEN1_EL1 = 0xc667,
3503}
3504
3505/// Type of an ARM GIC Distributor message based interrupt register.
3506#[repr(C)]
3507#[cfg(feature = "macos-15-0")]
3508#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
3509pub enum hv_gic_msi_reg_t {
3510 TYPER = 0x0008,
3511 SET_SPI_NSR = 0x0040,
3512}
3513
3514// GIC configuration functions.
3515unsafe extern "C" {
3516 /// Create a GIC configuration object.
3517 ///
3518 /// # Discussion
3519 ///
3520 /// Create the GIC configuration after the virtual machine has been created.
3521 ///
3522 /// # Return Value
3523 ///
3524 /// A new GIC configuration object. Release with [`os_release`] when no longer needed.
3525 #[cfg(feature = "macos-15-0")]
3526 pub fn hv_gic_config_create() -> hv_gic_config_t;
3527
3528 /// Set the GIC distributor region base address.
3529 ///
3530 /// # Parameters
3531 ///
3532 /// * `config`: GIC configuration object.
3533 /// * `distributor_base_address`: Guest physical address for distributor.
3534 ///
3535 /// # Discussion
3536 ///
3537 /// Guest physical address for distributor base aligned to byte value
3538 /// returned by hv_gic_get_distributor_base_alignment.
3539 ///
3540 /// # Return Value
3541 ///
3542 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3543 /// [`hv_return_t`].
3544 #[cfg(feature = "macos-15-0")]
3545 pub fn hv_gic_config_set_distributor_base(
3546 config: hv_gic_config_t,
3547 distributor_base_address: hv_ipa_t,
3548 ) -> hv_return_t;
3549
3550 /// Set the GIC redistributor region base address.
3551 ///
3552 /// # Parameters
3553 ///
3554 /// * `config`: GIC configuration object.
3555 /// * `redistributor_base_address`: Guest physical address for redistributor.
3556 ///
3557 /// # Discussion
3558 ///
3559 /// Guest physical address for redistributor base aligned to byte value
3560 /// returned by hv_gic_get_redistributor_base_alignment. The redistributor
3561 /// region will contain redistributors for all vCPUs supported by the
3562 /// virtual machine.
3563 ///
3564 /// # Return Value
3565 ///
3566 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3567 /// [`hv_return_t`].
3568 #[cfg(feature = "macos-15-0")]
3569 pub fn hv_gic_config_set_redistributor_base(
3570 config: hv_gic_config_t,
3571 redistributor_base_address: hv_ipa_t,
3572 ) -> hv_return_t;
3573
3574 /// Set the GIC MSI region base address.
3575 ///
3576 /// # Parameters
3577 ///
3578 /// * `config`: GIC configuration object.
3579 /// * `msi_region_base_address`: Guest physical address for MSI region.
3580 ///
3581 /// # Discussion
3582 ///
3583 /// Guest physical address for MSI region base aligned to byte value
3584 /// returned by [`hv_gic_get_msi_region_base_alignment`].
3585 ///
3586 /// For MSI support, you also need to set the interrupt range with
3587 /// [`hv_gic_config_set_msi_interrupt_range`].
3588 ///
3589 /// # Return Value
3590 ///
3591 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3592 /// [`hv_return_t`].
3593 #[cfg(feature = "macos-15-0")]
3594 pub fn hv_gic_config_set_msi_region_base(
3595 config: hv_gic_config_t,
3596 msi_region_base_address: hv_ipa_t,
3597 ) -> hv_return_t;
3598
3599 /// Sets the range of MSIs supported.
3600 ///
3601 /// # Parameters
3602 ///
3603 /// * `config`: GIC configuration object.
3604 /// * `msi_intid_base`: Lowest MSI interrupt number.
3605 /// * `msi_intid_count`: Number of MSIs.
3606 ///
3607 /// # Discussion
3608 ///
3609 /// Configures the range of identifiers supported for MSIs. If it is outside of
3610 /// the range given by [`hv_gic_get_spi_interrupt_range`] an error will be
3611 /// returned.
3612 ///
3613 /// For MSI support, you also need to set the region base address with
3614 /// [`hv_gic_config_set_msi_region_base`].
3615 ///
3616 /// # Return Value
3617 ///
3618 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3619 /// [`hv_return_t`].
3620 #[cfg(feature = "macos-15-0")]
3621 pub fn hv_gic_config_set_msi_interrupt_range(
3622 config: hv_gic_config_t,
3623 msi_intid_base: u32,
3624 msi_intid_count: u32,
3625 ) -> hv_return_t;
3626}
3627
3628// GIC core functions.
3629unsafe extern "C" {
3630 /// Create a GIC v3 device for a VM configuration.
3631 ///
3632 /// # Parameters
3633 ///
3634 /// * `gic_config`: GIC configuration object.
3635 ///
3636 /// # Discussion
3637 ///
3638 /// This function can be used to create an ARM Generic Interrupt Controller
3639 /// (GIC) v3 device. There must only be a single instance of this device per
3640 /// virtual machine. The device supports a distributor, redistributors, msi and
3641 /// GIC CPU system registers. When EL2 is enabled, the device supports GIC
3642 /// hypervisor control registers which are used by the guest hypervisor for
3643 /// injecting interrupts to its guest. `hv_vcpu_{get/set}_interrupt` functions
3644 /// are unsupported for injecting interrupts to a nested guest.
3645 ///
3646 /// The [`hv_gic_create`] API must only be called after a virtual machine has
3647 /// been created. It must also be done before vCPU's have been created so that
3648 /// GIC CPU system resources can be allocated. If either of these conditions
3649 /// aren't met an error is returned.
3650 ///
3651 /// GIC v3 uses affinity based interrupt routing. vCPU's must set affinity
3652 /// values in their `MPIDR_EL1` register. Once the virtual machine vcpus are
3653 /// running, its topology is considered final. Destroy vcpus only when you are
3654 /// tearing down the virtual machine.
3655 ///
3656 /// GIC MSI support is only provided if both an MSI region base address is
3657 /// configured and an MSI interrupt range is set.
3658 ///
3659 /// # Return Value
3660 ///
3661 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3662 /// [`hv_return_t`].
3663 #[cfg(feature = "macos-15-0")]
3664 pub fn hv_gic_create(gic_config: hv_gic_config_t) -> hv_return_t;
3665
3666 /// Trigger a Shared Peripheral Interrupt (SPI).
3667 ///
3668 /// # Parameters
3669 ///
3670 /// * `intid`: Interrupt number of the SPI.
3671 /// * `level`: High or low level for an interrupt. Setting level also causes an edge on the
3672 /// line for an edge triggered interrupt.
3673 ///
3674 /// # Discussion
3675 ///
3676 /// Level interrupts can be caused by setting a level value. If you want to
3677 /// cause an edge interrupt, call with a level of true. A level of false, for
3678 /// an edge interrupt will be ignored.
3679 ///
3680 /// An interrupt identifier outside of [`hv_gic_get_spi_interrupt_range`] or in
3681 /// the MSI interrupt range will return a [`hv_error_t::HV_BAD_ARGUMENT`] error code.
3682 ///
3683 /// # Return Value
3684 ///
3685 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3686 /// [`hv_return_t`].
3687 #[cfg(feature = "macos-15-0")]
3688 pub fn hv_gic_set_spi(intid: u32, level: bool) -> hv_return_t;
3689
3690 /// Send a Message Signaled Interrupt (MSI).
3691 ///
3692 /// # Parameters
3693 ///
3694 /// * `address`: Guest physical address for message based SPI.
3695 /// * `intid`: Interrupt identifier for the message based SPI.
3696 ///
3697 /// # Discussion
3698 ///
3699 /// Use the address of the HV_GIC_REG_GICM_SET_SPI_NSR register in the MSI frame.
3700 ///
3701 /// # Return Value
3702 ///
3703 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3704 /// [`hv_return_t`].
3705 #[cfg(feature = "macos-15-0")]
3706 pub fn hv_gic_send_msi(address: hv_ipa_t, intid: u32) -> hv_return_t;
3707
3708 /// Read a GIC distributor register.
3709 ///
3710 /// # Parameters
3711 ///
3712 /// * `reg`: GIC distributor register enum.
3713 /// * `value`: Pointer to distributor register value (written on success).
3714 ///
3715 /// # Discussion
3716 ///
3717 /// GIC distributor register enum values are equal to the device register
3718 /// offsets defined in the ARM GIC v3 specification. The client can use the
3719 /// offset alternatively, while looping through large register arrays.
3720 ///
3721 /// # Return Value
3722 ///
3723 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3724 /// [`hv_return_t`].
3725 #[cfg(feature = "macos-15-0")]
3726 pub fn hv_gic_get_distributor_reg(
3727 reg: hv_gic_distributor_reg_t,
3728 value: *mut u64,
3729 ) -> hv_return_t;
3730
3731 /// Write a GIC distributor register.
3732 ///
3733 /// # Parameters
3734 ///
3735 /// * `reg`: GIC distributor register enum.
3736 /// * `value`: GIC distributor register value to be written.
3737 ///
3738 /// # Discussion
3739 ///
3740 /// GIC distributor register enum values are equal to the device register
3741 /// offsets defined in the ARM GIC v3 specification. The client can use the
3742 /// offset alternatively, while looping through large register arrays.
3743 ///
3744 /// # Return Value
3745 ///
3746 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3747 /// [`hv_return_t`].
3748 #[cfg(feature = "macos-15-0")]
3749 pub fn hv_gic_set_distributor_reg(reg: hv_gic_distributor_reg_t, value: u64) -> hv_return_t;
3750
3751 /// Gets the redistributor base guest physical address for the given vcpu.
3752 ///
3753 /// # Parameters
3754 ///
3755 /// * `vcpu`: Handle for the vcpu.
3756 /// * `redistributor_base_address`: Pointer to the redistributor base guest physical address
3757 /// (written on success).
3758 ///
3759 /// # Discussion
3760 ///
3761 /// Must be called after the affinity of the given vCPU has been set in its MPIDR_EL1 register.
3762 ///
3763 /// # Return Value
3764 ///
3765 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3766 /// [`hv_return_t`].
3767 #[cfg(feature = "macos-15-0")]
3768 pub fn hv_gic_get_redistributor_base(
3769 vcpu: hv_vcpu_t,
3770 redistributor_base_address: *mut hv_ipa_t,
3771 ) -> hv_return_t;
3772
3773 /// Read a GIC redistributor register.
3774 ///
3775 /// # Parameters
3776 ///
3777 /// * `vcpu`: Redistributor block for the vcpu.
3778 /// * `reg`: GIC redistributor register enum.
3779 /// * `value`: Pointer to redistributor register value (written on success).
3780 ///
3781 /// # Discussion
3782 ///
3783 /// Must be called by the owning thread.
3784 ///
3785 /// GIC redistributor register enum values are equal to the device register
3786 /// offsets defined in the ARM GIC v3 specification. The client can use the
3787 /// offset alternatively, while looping through large register arrays.
3788 ///
3789 /// # Return Value
3790 ///
3791 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3792 /// [`hv_return_t`].
3793 #[cfg(feature = "macos-15-0")]
3794 pub fn hv_gic_get_redistributor_reg(
3795 vcpu: hv_vcpu_t,
3796 reg: hv_gic_redistributor_reg_t,
3797 value: *mut u64,
3798 ) -> hv_return_t;
3799
3800 /// Write a GIC redistributor register.
3801 ///
3802 /// # Parameters
3803 ///
3804 /// * `vcpu`: Redistributor block for the vcpu.
3805 /// * `reg`: GIC redistributor register enum.
3806 /// * `value`: GIC redistributor register value to be written.
3807 ///
3808 /// # Discussion
3809 ///
3810 /// Must be called by the owning thread.
3811 ///
3812 /// GIC redistributor register enum values are equal to the device register
3813 /// offsets defined in the ARM GIC v3 specification. The client can use the
3814 /// offset alternatively, while looping through large register arrays.
3815 ///
3816 /// # Return Value
3817 ///
3818 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3819 /// [`hv_return_t`].
3820 #[cfg(feature = "macos-15-0")]
3821 pub fn hv_gic_set_redistributor_reg(
3822 vcpu: hv_vcpu_t,
3823 reg: hv_gic_redistributor_reg_t,
3824 value: u64,
3825 ) -> hv_return_t;
3826
3827 /// Read a GIC ICC cpu system register.
3828 ///
3829 /// # Parameters
3830 ///
3831 /// * `vcpu`: Handle for the vcpu.
3832 /// * `reg`: GIC ICC system register enum.
3833 /// * `value`: Pointer to ICC register value (written on success).
3834 ///
3835 /// # Discussion
3836 ///
3837 /// Must be called by the owning thread.
3838 ///
3839 /// # Return Value
3840 ///
3841 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3842 /// [`hv_return_t`].
3843 #[cfg(feature = "macos-15-0")]
3844 pub fn hv_gic_get_icc_reg(
3845 vcpu: hv_vcpu_t,
3846 reg: hv_gic_icc_reg_t,
3847 value: *mut u64,
3848 ) -> hv_return_t;
3849
3850 /// Write a GIC ICC cpu system register.
3851 ///
3852 /// # Parameters
3853 ///
3854 /// * `vcpu`: Handle for the vcpu.
3855 /// * `reg`: GIC ICC system register enum.
3856 /// * `value`: GIC ICC register value to be written.
3857 ///
3858 /// # Discussion
3859 ///
3860 /// Must be called by the owning thread.
3861 ///
3862 /// # Return Value
3863 ///
3864 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3865 /// [`hv_return_t`].
3866 #[cfg(feature = "macos-15-0")]
3867 pub fn hv_gic_set_icc_reg(vcpu: hv_vcpu_t, reg: hv_gic_icc_reg_t, value: u64) -> hv_return_t;
3868
3869 /// Read a GIC ICH virtualization control system register.
3870 ///
3871 /// # Parameters
3872 ///
3873 /// * `vcpu`: Handle for the vcpu.
3874 /// * `reg`: GIC ICH system register enum.
3875 /// * `value`: Pointer to ICH register value (written on success).
3876 ///
3877 /// # Discussion
3878 ///
3879 /// ICH registers are only available when EL2 is enabled, otherwise returns
3880 /// an error.
3881 ///
3882 /// Must be called by the owning thread.
3883 ///
3884 /// # Return Value
3885 ///
3886 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3887 /// [`hv_return_t`].
3888 #[cfg(feature = "macos-15-0")]
3889 pub fn hv_gic_get_ich_reg(
3890 vcpu: hv_vcpu_t,
3891 reg: hv_gic_ich_reg_t,
3892 value: *mut u64,
3893 ) -> hv_return_t;
3894
3895 /// Write a GIC ICH virtualization control system register.
3896 ///
3897 /// # Parameters
3898 ///
3899 /// * `vcpu`: Handle for the vcpu.
3900 /// * `reg`: GIC ICH system register enum.
3901 /// * `value`: GIC ICH register value to be written.
3902 ///
3903 /// # Discussion
3904 ///
3905 /// ICH registers are only available when EL2 is enabled, otherwise returns
3906 /// an error.
3907 ///
3908 /// Must be called by the owning thread.
3909 ///
3910 /// # Return Value
3911 ///
3912 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3913 /// [`hv_return_t`].
3914 #[cfg(feature = "macos-15-0")]
3915 pub fn hv_gic_set_ich_reg(vcpu: hv_vcpu_t, reg: hv_gic_ich_reg_t, value: u64) -> hv_return_t;
3916
3917 /// Read a GIC ICV system register.
3918 ///
3919 /// # Parameters
3920 ///
3921 /// * `vcpu`: Handle for the vcpu.
3922 /// * `reg`: GIC ICV system register enum.
3923 /// * `value`: Pointer to ICV register value (written on success).
3924 ///
3925 /// # Discussion
3926 ///
3927 /// ICV registers are only available when EL2 is enabled, otherwise returns
3928 /// an error.
3929 ///
3930 /// Must be called by the owning thread.
3931 ///
3932 /// # Return Value
3933 ///
3934 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3935 /// [`hv_return_t`].
3936 #[cfg(feature = "macos-15-0")]
3937 pub fn hv_gic_get_icv_reg(
3938 vcpu: hv_vcpu_t,
3939 reg: hv_gic_icv_reg_t,
3940 value: *mut u64,
3941 ) -> hv_return_t;
3942
3943 /// Write a GIC ICV system register.
3944 ///
3945 /// # Parameters
3946 ///
3947 /// * `vcpu`: Handle for the vcpu.
3948 /// * `reg`: GIC ICV system register enum.
3949 /// * `value`: GIC ICV register value to be written.
3950 ///
3951 /// # Discussion
3952 ///
3953 /// ICV registers are only available when EL2 is enabled, otherwise returns
3954 /// an error.
3955 ///
3956 /// Must be called by the owning thread.
3957 ///
3958 /// # Return Value
3959 ///
3960 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3961 /// [`hv_return_t`].
3962 #[cfg(feature = "macos-15-0")]
3963 pub fn hv_gic_set_icv_reg(vcpu: hv_vcpu_t, reg: hv_gic_icv_reg_t, value: u64) -> hv_return_t;
3964
3965 /// Read a GIC distributor MSI register.
3966 ///
3967 /// # Parameters
3968 ///
3969 /// * `reg`: GIC distributor MSI register enum.
3970 /// * `value`: Pointer to distributor MSI register value (written on success).
3971 ///
3972 /// # Return Value
3973 ///
3974 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3975 /// [`hv_return_t`].
3976 #[cfg(feature = "macos-15-0")]
3977 pub fn hv_gic_get_msi_reg(reg: hv_gic_msi_reg_t, value: *mut u64) -> hv_return_t;
3978
3979 /// Write a GIC distributor MSI register.
3980 ///
3981 /// # Parameters
3982 ///
3983 /// * `reg`: GIC distributor MSI register enum.
3984 /// * `value`: GIC distributor MSI register value to be written.
3985 ///
3986 /// # Return Value
3987 ///
3988 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
3989 /// [`hv_return_t`].
3990 #[cfg(feature = "macos-15-0")]
3991 pub fn hv_gic_set_msi_reg(reg: hv_gic_msi_reg_t, value: u64) -> hv_return_t;
3992
3993 /// Set state for GIC device to be restored.
3994 ///
3995 /// # Parameters
3996 ///
3997 /// * `gic_state_data`: Pointer to the state buffer to set GIC with.
3998 /// * `gic_state_size`: Size of GIC state buffer.
3999 ///
4000 /// # Discussion
4001 ///
4002 /// GIC state can only be restored after a GIC device and vcpus have been
4003 /// created and must be done before vcpu's are run. The rest of the virtual
4004 /// machine including GIC CPU registers must also be restored compatibly with
4005 /// the gic_state.
4006 ///
4007 /// In some cases [`hv_gic_set_state`] can fail if a software update has changed
4008 /// the host in a way that would be incompatible with the previous format.
4009 ///
4010 /// # Return Value
4011 ///
4012 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
4013 /// [`hv_return_t`].
4014 #[cfg(feature = "macos-15-0")]
4015 pub fn hv_gic_set_state(gic_state_data: *const c_void, gic_state_size: usize) -> hv_return_t;
4016
4017 /// Reset the GIC device.
4018 ///
4019 /// # Parameters
4020 ///
4021 /// * `gic_config`: GIC configuration object.
4022 ///
4023 /// # Discussion
4024 ///
4025 /// When the virtual machine is being reset, call this function to reset the
4026 /// GIC distributor, redistributor registers and the internal state of the
4027 /// device.
4028 ///
4029 /// # Return Value
4030 ///
4031 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
4032 /// [`hv_return_t`].
4033 #[cfg(feature = "macos-15-0")]
4034 pub fn hv_gic_reset() -> hv_return_t;
4035}
4036
4037// GIC parameters functions.
4038unsafe extern "C" {
4039 /// Gets the size in bytes of the GIC distributor region.
4040 ///
4041 /// # Parameters
4042 ///
4043 /// * `distributor_size`: Pointer to GIC distributor region size (written on success).
4044 ///
4045 /// # Return Value
4046 ///
4047 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
4048 /// [`hv_return_t`].
4049 #[cfg(feature = "macos-15-0")]
4050 pub fn hv_gic_get_distributor_size(distributor_size: *mut usize) -> hv_return_t;
4051
4052 /// Gets the alignment in bytes for the base address of the GIC distributor region.
4053 ///
4054 /// # Parameters
4055 ///
4056 /// * `distributor_base_alignment`: Pointer to GIC distributor base address alignment
4057 /// (written on success).
4058 ///
4059 /// # Return Value
4060 ///
4061 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
4062 /// [`hv_return_t`].
4063 #[cfg(feature = "macos-15-0")]
4064 pub fn hv_gic_get_distributor_base_alignment(
4065 distributor_base_alignment: *mut usize,
4066 ) -> hv_return_t;
4067
4068 /// Gets the total size in bytes of the GIC redistributor region.
4069 ///
4070 /// # Parameters
4071 ///
4072 /// * `redistributor_region_size`: Pointer to GIC redistributor region size
4073 /// (written on success).
4074 ///
4075 /// # Discussion
4076 ///
4077 /// Provides the total size of the GIC redistributor regions supported. Each
4078 /// redistributor is two 64 kilobyte frames per vCPU and is contiguously
4079 /// placed.
4080 ///
4081 /// # Return Value
4082 ///
4083 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
4084 /// [`hv_return_t`].
4085 #[cfg(feature = "macos-15-0")]
4086 pub fn hv_gic_get_redistributor_region_size(
4087 redistributor_region_size: *mut usize,
4088 ) -> hv_return_t;
4089
4090 /// Gets the size in bytes of a single GIC redistributor.
4091 ///
4092 /// # Parameters
4093 ///
4094 /// * `redistributor_size`: Pointer to GIC redistributor region size
4095 /// (written on success).
4096 ///
4097 /// # Return Value
4098 ///
4099 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
4100 /// [`hv_return_t`].
4101 #[cfg(feature = "macos-15-0")]
4102 pub fn hv_gic_get_redistributor_size(redistributor_size: *mut usize) -> hv_return_t;
4103
4104 /// Gets the alignment in bytes for the base address of the GIC redistributor region.
4105 ///
4106 /// # Parameters
4107 ///
4108 /// * `redistributor_base_alignment`: Pointer to GIC redistributor base address alignment
4109 /// (written on success).
4110 ///
4111 /// # Return Value
4112 ///
4113 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
4114 /// [`hv_return_t`].
4115 #[cfg(feature = "macos-15-0")]
4116 pub fn hv_gic_get_redistributor_base_alignment(
4117 redistributor_base_alignment: *mut usize,
4118 ) -> hv_return_t;
4119
4120 /// Gets the size in bytes of the GIC MSI region.
4121 ///
4122 /// # Parameters
4123 ///
4124 /// * `msi_region_size`: Pointer to GIC MSI region size (written on success).
4125 ///
4126 /// # Return Value
4127 ///
4128 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
4129 /// [`hv_return_t`].
4130 #[cfg(feature = "macos-15-0")]
4131 pub fn hv_gic_get_msi_region_size(msi_region_size: *mut usize) -> hv_return_t;
4132
4133 /// Gets the alignment in bytes for the base address of the GIC MSI region.
4134 ///
4135 /// # Parameters
4136 ///
4137 /// * `msi_region_base_alignment`: Pointer to GIC MSI region base address alignment
4138 /// (written on success).
4139 ///
4140 /// # Return Value
4141 ///
4142 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
4143 /// [`hv_return_t`].
4144 #[cfg(feature = "macos-15-0")]
4145 pub fn hv_gic_get_msi_region_base_alignment(
4146 msi_region_base_alignment: *mut usize,
4147 ) -> hv_return_t;
4148
4149 /// Gets the range of SPIs supported.
4150 ///
4151 /// # Parameters
4152 ///
4153 /// * `spi_intid_base`: Pointer to the lowest SPI number (written on success).
4154 /// * `spi_intid_count`: Pointer to the number of SPIs supported (written on success).
4155 ///
4156 /// # Return Value
4157 ///
4158 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
4159 /// [`hv_return_t`].
4160 #[cfg(feature = "macos-15-0")]
4161 pub fn hv_gic_get_spi_interrupt_range(
4162 spi_intid_base: *mut u32,
4163 spi_intid_count: *mut u32,
4164 ) -> hv_return_t;
4165
4166 /// Gets the interrupt id for reserved interrupts.
4167 ///
4168 /// # Parameters
4169 ///
4170 /// * `interrupt`: Enum value for reserved interrupts.
4171 /// * `intid`: Pointer to the interrupt number (written on success).
4172 ///
4173 /// # Discussion
4174 ///
4175 /// Provides the interrupt id for interrupts that are reserved by the
4176 /// hypervisor framework.
4177 ///
4178 /// # Return Value
4179 ///
4180 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
4181 /// [`hv_return_t`].
4182 #[cfg(feature = "macos-15-0")]
4183 pub fn hv_gic_get_intid(interrupt: hv_gic_intid_t, intid: *mut u32) -> hv_return_t;
4184}
4185
4186// GIC state functions.
4187unsafe extern "C" {
4188 /// Create a GIC state object.
4189 ///
4190 /// # Discussion
4191 ///
4192 /// The function returns no object if the current GIC state can not be represented in a GIC
4193 /// state object, or if there is no GIC present in the virtual machine.
4194 ///
4195 /// The virtual machine must be in a stopped state prior to calling this function.
4196 ///
4197 /// # Return Value
4198 ///
4199 /// A new GIC state object that is representative of the current GIC state.
4200 /// This should be released with [`os_release`] when no longer used.
4201 #[cfg(feature = "macos-15-0")]
4202 pub fn hv_gic_state_create() -> hv_gic_state_t;
4203
4204 /// Get size of buffer required for GIC state.
4205 ///
4206 /// # Parameters
4207 ///
4208 /// * `state`: GIC configuration object.
4209 /// * `gic_state_size`: Pointer to GIC data size (written on success).
4210 ///
4211 /// # Return Value
4212 ///
4213 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
4214 /// [`hv_return_t`].
4215 #[cfg(feature = "macos-15-0")]
4216 pub fn hv_gic_state_get_size(state: hv_gic_state_t, gic_state_size: *mut usize) -> hv_return_t;
4217
4218 /// Get the state data for GIC.
4219 ///
4220 /// # Parameters
4221 ///
4222 /// * `state`: GIC configuration object.
4223 /// * `gic_state_data`: Pointer to GIC state buffer (written on success).
4224 ///
4225 /// # Discussion
4226 ///
4227 /// The function returns an opaque data buffer that contains the complete
4228 /// serialized state of the device, except for the GIC cpu registers. The data
4229 /// can be written to a file and is stable. It is also versioned for detecting
4230 /// incompatibilities on restore of the state. The size of this GIC state buffer
4231 /// must be at least as large as the size returned by [`hv_gic_state_get_size`].
4232 ///
4233 /// GIC CPU system registers can be read separately, and saved to restore the
4234 /// cpu state for the virtual machine.
4235 ///
4236 /// # Return Value
4237 ///
4238 /// `HV_SUCCESS` if the operation was successful, otherwise an error code specified in
4239 /// [`hv_return_t`].
4240 #[cfg(feature = "macos-15-0")]
4241 pub fn hv_gic_state_get_data(state: hv_gic_state_t, gic_state_data: *mut c_void)
4242 -> hv_return_t;
4243}