]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/sfi.h
385b57cf01e522fcd923c6f7224cceb8954a8fbe
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@
33 #include <mach/mach_types.h>
34 #include <mach/kern_return.h>
35 #include <mach/sfi_class.h>
37 #include <kern/kern_types.h>
38 #include <kern/ledger.h>
40 extern void sfi_init(void);
41 extern void sfi_early_init(void);
42 extern sfi_class_id_t
sfi_get_ledger_alias_for_class(sfi_class_id_t class_id
);
43 extern int sfi_ledger_entry_add(ledger_template_t
template, sfi_class_id_t class_id
);
45 kern_return_t
sfi_set_window(uint64_t window_usecs
);
46 kern_return_t
sfi_window_cancel(void);
47 kern_return_t
sfi_get_window(uint64_t *window_usecs
);
49 kern_return_t
sfi_set_class_offtime(sfi_class_id_t class_id
, uint64_t offtime_usecs
);
50 kern_return_t
sfi_class_offtime_cancel(sfi_class_id_t class_id
);
51 kern_return_t
sfi_get_class_offtime(sfi_class_id_t class_id
, uint64_t *offtime_usecs
);
53 #ifdef MACH_KERNEL_PRIVATE
55 * Classifying a thread requires no special locks to be held (although attribute
56 * changes that cause an inconsistent snapshot may cause a spurious AST). Final
57 * evaluation will happen at the AST boundary with the thread locked. If possible,
60 sfi_class_id_t
sfi_thread_classify(thread_t thread
);
61 sfi_class_id_t
sfi_processor_active_thread_classify(processor_t processor
);
62 ast_t
sfi_thread_needs_ast(thread_t thread
, sfi_class_id_t
*out_class
/* optional */);
63 ast_t
sfi_processor_needs_ast(processor_t processor
);
65 void sfi_ast(thread_t thread
);
66 void sfi_reevaluate(thread_t thread
);
67 #endif /* MACH_KERNEL_PRIVATE */
69 #endif /* _KERN_SFI_H_ */