1 /* 2 * Copyright (c) 2000-2012 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 50 extern void machine_startup(void); 51 52 extern void get_root_device(void); 53 extern void picinit(void); 54 extern void interrupt_processor( 55 int cpu); 56 extern void mp_probe_cpus(void); 57 58 extern void remote_kdb(void); 59 extern void clear_kdb_intr(void); 60 extern void cpu_init(void); 61 extern void fix_desc( 62 void * desc, 63 int num_desc); 64 extern void fix_desc64( 65 void * desc, 66 int num_desc); 67 extern void cnpollc( 68 boolean_t on); 69 extern void form_pic_mask(void); 70 extern void intnull( 71 int unit); 72 extern char * i386_boot_info( 73 char *buf, 74 vm_size_t buf_len); 75 76 extern void blkclr( 77 const char *from, 78 int nbytes); 79 80 extern void memset_word( 81 int *dst, 82 int pattern, 83 int nwords); 84 85 86 /* Move arbitrarily-aligned data from one physical address to another */ 87 extern void bcopy_phys(addr64_t from, addr64_t to, vm_size_t nbytes); 88 89 /* allow a function to get a quick virtual mapping of a physical page */ 90 extern int apply_func_phys(addr64_t src64, vm_size_t bytes, int (*func)(void * buffer, vm_size_t bytes, void * arg), void * arg); 91 92 extern int ml_copy_phys(addr64_t, addr64_t, vm_size_t); 93 94 /* Flush all cachelines for a page. */ 95 extern void cache_flush_page_phys(ppnum_t pa); 96 97 /* Flushing for incoherent I/O */ 98 extern void dcache_incoherent_io_flush64(addr64_t pa, unsigned int count); 99 extern void dcache_incoherent_io_store64(addr64_t pa, unsigned int count); 100 101 extern void sysclk_gettime_interrupts_disabled( 102 mach_timespec_t *cur_time); 103 104 extern void rtc_nanotime_init_commpage(void); 105 106 extern void rtc_sleep_wakeup(uint64_t base); 107 108 extern void rtc_timer_start(void); 109 110 extern void rtc_clock_napped(uint64_t, uint64_t); 111 extern void rtc_clock_adjust(uint64_t); 112 113 extern void pmap_lowmem_finalize(void); 114 115 thread_t Switch_context(thread_t, thread_continue_t, thread_t); 116 117 __not_tail_called thread_t 118 Shutdown_context(thread_t thread, void (*doshutdown)(processor_t), processor_t processor); 119 120 #ifdef __x86_64__ 121 uint64_t x86_64_pre_sleep(void); 122 void x86_64_post_sleep(uint64_t new_cr3); 123 #endif 124 125 boolean_t 126 debug_state_is_valid32(x86_debug_state32_t *ds); 127 128 boolean_t 129 debug_state_is_valid64(x86_debug_state64_t *ds); 130 131 void 132 copy_debug_state32(x86_debug_state32_t *src, x86_debug_state32_t *target, boolean_t all); 133 134 void 135 copy_debug_state64(x86_debug_state64_t *src, x86_debug_state64_t *target, boolean_t all); 136 137 extern void act_machine_switch_pcb(thread_t old, thread_t new); 138 139 extern void Idle_PTs_release(vm_offset_t start, vm_offset_t end); 140 extern ppnum_t released_PT_ppn; 141 extern uint32_t released_PT_cnt; 142 143 /* Fast-restart parameters */ 144 #define FULL_SLAVE_INIT (NULL) 145 #define FAST_SLAVE_INIT ((void *)(uintptr_t)1) 146 147 void cpu_pmc_control(void *); 148 149 extern void pstate_trace(void); 150 151 extern void mp_interrupt_watchdog(void); 152 153 extern kern_return_t i386_slide_individual_kext(kernel_mach_header_t *mh, uintptr_t slide); 154 155 extern kern_return_t i386_slide_kext_collection_mh_addrs(kernel_mach_header_t *mh, uintptr_t slide, bool adjust_mach_headers); 156 157 #endif /* _I386_MISC_PROTOS_H_ */ 158