]> git.saurik.com Git - apple/xnu.git/blob - osfmk/i386/misc_protos.h
xnu-2050.9.2.tar.gz
[apple/xnu.git] / osfmk / i386 / misc_protos.h
1 /*
2 * Copyright (c) 2000-2010 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 /*
29 * @OSF_COPYRIGHT@
30 */
31
32 #ifndef _I386_MISC_PROTOS_H_
33 #define _I386_MISC_PROTOS_H_
34
35 #include <machine/thread.h>
36
37 struct boot_args;
38 struct cpu_data;
39
40 extern boolean_t virtualized;
41
42 extern void vstart(vm_offset_t);
43 extern void i386_init(void);
44 extern void x86_init_wrapper(uintptr_t, uintptr_t) __attribute__((noreturn));
45 extern void i386_vm_init(
46 uint64_t,
47 boolean_t,
48 struct boot_args *);
49 #ifdef __i386__
50 extern void cpu_IA32e_enable(struct cpu_data *);
51 extern void cpu_IA32e_disable(struct cpu_data *);
52 extern void ml_load_desc64(void);
53 extern void ml_64bit_lldt(int);
54 #endif
55
56 #if NCOPY_WINDOWS > 0
57 extern void cpu_userwindow_init(int);
58 extern void cpu_physwindow_init(int);
59 #endif
60
61 extern void machine_startup(void);
62
63 extern void get_root_device(void);
64 extern void picinit(void);
65 extern void interrupt_processor(
66 int cpu);
67 extern void mp_probe_cpus(void);
68 extern void panic_io_port_read(void);
69
70 extern void remote_kdb(void);
71 extern void clear_kdb_intr(void);
72 extern void draw_panic_dialog(void);
73 extern void cpu_init(void);
74 #ifdef __i386__
75 extern void cpu_shutdown(void);
76 #endif
77 extern void fix_desc(
78 void * desc,
79 int num_desc);
80 extern void fix_desc64(
81 void * desc,
82 int num_desc);
83 extern void cnpollc(
84 boolean_t on);
85 extern void form_pic_mask(void);
86 extern void intnull(
87 int unit);
88 extern char * i386_boot_info(
89 char *buf,
90 vm_size_t buf_len);
91
92 extern void blkclr(
93 const char *from,
94 int nbytes);
95
96 #ifdef __i386__
97 extern unsigned int div_scale(
98 unsigned int dividend,
99 unsigned int divisor,
100 unsigned int *scale);
101
102 extern unsigned int mul_scale(
103 unsigned int multiplicand,
104 unsigned int multiplier,
105 unsigned int *scale);
106 #endif
107
108 /* Move arbitrarily-aligned data from one physical address to another */
109 extern void bcopy_phys(addr64_t from, addr64_t to, vm_size_t nbytes);
110
111 /* allow a function to get a quick virtual mapping of a physical page */
112 extern int apply_func_phys(addr64_t src64, vm_size_t bytes, int (*func)(void * buffer, vm_size_t bytes, void * arg), void * arg);
113
114 extern void ml_copy_phys(addr64_t, addr64_t, vm_size_t);
115
116 /* Flush all cachelines for a page. */
117 extern void cache_flush_page_phys(ppnum_t pa);
118
119 /* Flushing for incoherent I/O */
120 extern void dcache_incoherent_io_flush64(addr64_t pa, unsigned int count);
121 extern void dcache_incoherent_io_store64(addr64_t pa, unsigned int count);
122
123
124 extern processor_t cpu_processor_alloc(boolean_t is_boot_cpu);
125 extern void cpu_processor_free(processor_t proc);
126
127 extern void *chudxnu_cpu_alloc(boolean_t is_boot_cpu);
128 extern void chudxnu_cpu_free(void *);
129
130 extern void sysclk_gettime_interrupts_disabled(
131 mach_timespec_t *cur_time);
132
133 extern void rtc_nanotime_init_commpage(void);
134
135 extern void rtc_sleep_wakeup(uint64_t base);
136
137 extern void rtc_timer_start(void);
138
139 extern void rtc_clock_stepping(
140 uint32_t new_frequency,
141 uint32_t old_frequency);
142 extern void rtc_clock_stepped(
143 uint32_t new_frequency,
144 uint32_t old_frequency);
145 extern void rtc_clock_napped(uint64_t, uint64_t);
146 extern void rtc_clock_adjust(uint64_t);
147
148 extern void pmap_lowmem_finalize(void);
149
150 thread_t Switch_context(thread_t, thread_continue_t, thread_t);
151 thread_t Shutdown_context(thread_t thread, void (*doshutdown)(processor_t),processor_t processor);
152
153 #ifdef __x86_64__
154 uint64_t x86_64_pre_sleep(void);
155 void x86_64_post_sleep(uint64_t new_cr3);
156 #endif
157
158 boolean_t
159 debug_state_is_valid32(x86_debug_state32_t *ds);
160
161 boolean_t
162 debug_state_is_valid64(x86_debug_state64_t *ds);
163
164 void
165 copy_debug_state32(x86_debug_state32_t *src, x86_debug_state32_t *target, boolean_t all);
166
167 void
168 copy_debug_state64(x86_debug_state64_t *src, x86_debug_state64_t *target, boolean_t all);
169
170 extern void act_machine_switch_pcb(thread_t old, thread_t new);
171
172 /* Fast-restart parameters */
173 #define FULL_SLAVE_INIT (NULL)
174 #define FAST_SLAVE_INIT ((void *)(uintptr_t)1)
175
176 uint64_t ml_early_random(void);
177 #endif /* _I386_MISC_PROTOS_H_ */