1 | /* |
2 | * Copyright (c) 2009-2016 Apple Inc. All rights reserved. |
3 | * |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
5 | * |
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. |
14 | * |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. |
17 | * |
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. |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
27 | */ |
28 | #ifndef _I386_PAL_I386_H |
29 | #define _I386_PAL_I386_H |
30 | |
31 | #ifdef XNU_KERNEL_PRIVATE |
32 | |
33 | /* No-op on bare-metal */ |
34 | #define pal_dbg_page_fault(x, y, z) |
35 | #define pal_dbg_set_task_name( x ) |
36 | #define pal_set_signal_delivery( x ) |
37 | |
38 | #define pal_is_usable_memory(b, t) (TRUE) |
39 | |
40 | #define pal_hlt() __asm__ volatile ("sti; hlt") |
41 | #define pal_sti() __asm__ volatile ("sti") |
42 | #define pal_cli() __asm__ volatile ("cli") |
43 | |
44 | static inline void |
45 | pal_stop_cpu(boolean_t cli) |
46 | { |
47 | if (cli) |
48 | __asm__ volatile ( "cli" ); |
49 | __asm__ volatile ( "wbinvd; hlt" ); |
50 | } |
51 | |
52 | #define pal_register_cache_state(t, v) |
53 | |
54 | #define pal_execve_return(t) |
55 | #define pal_thread_terminate_self(t) |
56 | #define pal_ast_check(t) |
57 | |
58 | #define panic_display_pal_info() do { } while(0) |
59 | #define pal_kernel_announce() do { } while(0) |
60 | |
61 | #define PAL_AICPM_PROPERTY_VALUE 0 |
62 | |
63 | #define pal_pmc_swi() __asm__ __volatile__("int %0"::"i"(LAPIC_PMC_SWI_VECTOR):"memory") |
64 | |
65 | /* Macro used by non-native xnus for access to low globals when it may |
66 | * have moved. |
67 | */ |
68 | #define PAL_KDP_ADDR(x) (x) |
69 | |
70 | struct pal_rtc_nanotime { |
71 | volatile uint64_t tsc_base; /* timestamp */ |
72 | volatile uint64_t ns_base; /* nanoseconds */ |
73 | uint32_t scale; /* tsc -> nanosec multiplier */ |
74 | uint32_t shift; /* shift is nonzero only on "slow" machines, */ |
75 | /* ie where tscFreq <= SLOW_TSC_THRESHOLD */ |
76 | volatile uint32_t generation; /* 0 == being updated */ |
77 | uint32_t spare1; |
78 | }; |
79 | |
80 | |
81 | #ifdef MACH_KERNEL_PRIVATE |
82 | |
83 | struct pal_cpu_data { |
84 | |
85 | }; |
86 | |
87 | struct pal_pcb { |
88 | |
89 | }; |
90 | |
91 | struct pal_apic_table { |
92 | |
93 | }; |
94 | |
95 | #endif /* MACH_KERNEL_PRIVATE */ |
96 | |
97 | #endif /* XNU_KERNEL_PRIVATE */ |
98 | |
99 | #endif /* _I386_PAL_I386_H */ |
100 | |