1/*
2 * Copyright (c) 2009 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
44static inline
45void 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#define pal_switch_pmap(t,u,v)
58
59#define	panic_display_pal_info() do { } while(0)
60#define	pal_kernel_announce() do { } while(0)
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 {
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;
79};
80
81
82#ifdef MACH_KERNEL_PRIVATE
83
84struct pal_cpu_data {
85
86};
87
88struct pal_pcb {
89
90};
91
92struct pal_apic_table {
93
94};
95
96#endif /* MACH_KERNEL_PRIVATE */
97
98#endif /* XNU_KERNEL_PRIVATE */
99
100#endif /* _I386_PAL_I386_H */
101