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