2 * Copyright (c) 2013 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_HV_SUPPORT_H_
30 #define _KERN_HV_SUPPORT_H_
32 #if defined(__cplusplus)
37 #include <mach/kern_return.h>
41 } hv_volatile_state_t
;
48 typedef kern_return_t (*hv_trap_t
) (void *thread_target
, uint64_t arg
);
49 typedef void (*hv_callback_0_t
)(void *target
);
50 typedef void (*hv_callback_1_t
)(void *target
, int argument
);
53 const hv_trap_t
*traps
;
58 hv_callback_0_t dispatch
;
59 hv_callback_0_t preempt
;
60 hv_callback_0_t thread_destroy
;
61 hv_callback_0_t task_destroy
;
62 hv_callback_1_t volatile_state
;
63 hv_callback_0_t memory_pressure
;
66 extern hv_callbacks_t hv_callbacks
;
67 extern int hv_support_available
;
69 extern void hv_support_init(void);
70 extern int hv_get_support(void);
71 extern void hv_set_task_target(void *target
);
72 extern void hv_set_thread_target(void *target
);
73 extern void *hv_get_task_target(void);
74 extern void *hv_get_thread_target(void);
75 extern int hv_get_volatile_state(hv_volatile_state_t state
);
76 extern kern_return_t
hv_set_mp_notify(void);
77 extern void hv_release_mp_notify(void);
78 extern kern_return_t
hv_set_traps(hv_trap_type_t trap_type
,
79 const hv_trap_t
*traps
, unsigned trap_count
);
80 extern void hv_release_traps(hv_trap_type_t trap_type
);
81 extern kern_return_t
hv_set_callbacks(hv_callbacks_t callbacks
);
82 extern void hv_release_callbacks(void) ;
83 extern kern_return_t
hv_task_trap(uint64_t index
, uint64_t arg
);
84 extern kern_return_t
hv_thread_trap(uint64_t index
, uint64_t arg
);
86 #if defined(__cplusplus)
90 #endif /* _KERN_HV_SUPPORT_H_ */