2 * Copyright (c) 2020 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 #ifndef _KERN_HVG_HYPERCALL_H_
30 #define _KERN_HVG_HYPERCALL_H_
35 /* Architecture-independent definitions (exported to userland) */
38 * Apple Hypercall arguments
40 typedef struct hvg_hcall_args
{
46 * Apple Hypercall return output
48 typedef struct hvg_hcall_output
{
54 * Apple Hypercall return code
57 OS_CLOSED_ENUM(hvg_hcall_return
, uint32_t,
58 HVG_HCALL_SUCCESS
= 0x0000, /* The call succeeded */
59 HVG_HCALL_ACCESS_DENIED
= 0x0001, /* Invalid access right */
60 HVG_HCALL_INVALID_CODE
= 0x0002, /* Hypercall code not recognized */
61 HVG_HCALL_INVALID_PARAMETER
= 0x0003, /* Specified register value not valid */
62 HVG_HCALL_IO_FAILED
= 0x0004, /* Input/output error */
63 HVG_HCALL_FEAT_DISABLED
= 0x0005, /* Feature not available */
64 HVG_HCALL_UNSUPPORTED
= 0x0006, /* Hypercall not supported */
69 * Apple Hypercall call code
72 OS_CLOSED_ENUM(hvg_hcall_code
, uint32_t,
73 HVG_HCALL_TRIGGER_DUMP
= 0x0001, /* Collect guest dump */
77 * Options for collecting kernel vmcore
80 OS_CLOSED_OPTIONS(hvg_hcall_dump_option
, uint32_t,
81 HVG_HCALL_DUMP_OPTION_REGULAR
= 0x0001 /* Regular dump-guest-memory */
84 typedef struct hvg_hcall_vmcore_file
{
85 char tag
[57]; /* 7 64-bit registers plus 1 byte for '\0' */
86 } hvg_hcall_vmcore_file_t
;
88 extern hvg_hcall_return_t
89 hvg_hcall_trigger_dump(hvg_hcall_vmcore_file_t
*vmcore
,
90 const hvg_hcall_dump_option_t dump_option
);
93 #ifdef XNU_KERNEL_PRIVATE
96 * For XNU kernel use only (omitted from userland headers)
99 #if defined (__x86_64__)
100 #include <i386/cpuid.h>
101 #include <i386/x86_hypercall.h>
104 #endif /* XNU_KERNEL_PRIVATE */
106 #endif /* _KERN_HV_HYPERCALL_H_ */