X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/6d2010ae8f7a6078e10b361c6962983bab233e0f..f427ee49d309d8fc33ebf3042c3a775f2f530ded:/osfmk/i386/pal_routines.h?ds=sidebyside diff --git a/osfmk/i386/pal_routines.h b/osfmk/i386/pal_routines.h index dc59735b9..35d58108f 100644 --- a/osfmk/i386/pal_routines.h +++ b/osfmk/i386/pal_routines.h @@ -1,8 +1,8 @@ /* - * Copyright (c) 2009 Apple Inc. All rights reserved. + * Copyright (c) 2009-2012 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ - * + * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in @@ -11,10 +11,10 @@ * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. - * + * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. - * + * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, @@ -22,7 +22,7 @@ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. - * + * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef _I386_PAL_ROUTINES_H @@ -43,11 +43,11 @@ extern "C" { * only the low-order half is loaded (if applicable) */ struct pal_efi_registers { - uint64_t rcx; - uint64_t rdx; - uint64_t r8; - uint64_t r9; - uint64_t rax; + uint64_t rcx; + uint64_t rdx; + uint64_t r8; + uint64_t r9; + uint64_t rax; }; /* @@ -56,35 +56,31 @@ struct pal_efi_registers { */ kern_return_t pal_efi_call_in_64bit_mode(uint64_t func, - struct pal_efi_registers *efi_reg, - void *stack_contents, - size_t stack_contents_size, /* 16-byte multiple */ - uint64_t *efi_status); + struct pal_efi_registers *efi_reg, + void *stack_contents, + size_t stack_contents_size, /* 16-byte multiple */ + uint64_t *efi_status); kern_return_t pal_efi_call_in_32bit_mode(uint32_t func, - struct pal_efi_registers *efi_reg, - void *stack_contents, - size_t stack_contents_size, /* 16-byte multiple */ - uint32_t *efi_status); + struct pal_efi_registers *efi_reg, + void *stack_contents, + size_t stack_contents_size, /* 16-byte multiple */ + uint32_t *efi_status); /* Go into ACPI sleep */ -boolean_t pal_machine_sleep(uint8_t type_a, - uint8_t type_b, - uint32_t bit_position, - uint32_t disable_mask, - uint32_t enable_mask); +boolean_t pal_machine_sleep(uint8_t type_a, + uint8_t type_b, + uint32_t bit_position, + uint32_t disable_mask, + uint32_t enable_mask); /* xnu internal PAL routines */ #ifdef XNU_KERNEL_PRIVATE /* Define any PAL-specific types for x86 */ -#ifdef __i386__ -typedef uint32_t pal_cr_t; -#else typedef uint64_t pal_cr_t; -#endif struct pal_cpu_data; /* Defined per-platform */ struct pal_pcb; /* Defined per-platform */ @@ -92,10 +88,11 @@ struct pal_apic_table; /* Defined per-platform */ /* For use by APIC kext */ extern struct pal_apic_table *apic_table; - + /* serial / debug output routines */ extern int pal_serial_init(void); extern void pal_serial_putc(char); +extern void pal_serial_putc_nocr(char); extern int pal_serial_getc(void); /* Generic I386 PAL functions go here */ @@ -103,12 +100,12 @@ extern void pal_i386_init(void); extern void pal_set_signal_delivery(thread_t); /* Get values for cr0..4 */ -extern void pal_get_control_registers( pal_cr_t *cr0, pal_cr_t *cr2, - pal_cr_t *cr3, pal_cr_t *cr4 ); +extern void pal_get_control_registers( pal_cr_t *cr0, pal_cr_t *cr2, + pal_cr_t *cr3, pal_cr_t *cr4 ); /* Debug hook invoked in the page-fault path */ -extern void pal_dbg_page_fault( thread_t thread, user_addr_t vadddr, - kern_return_t kr ); +extern void pal_dbg_page_fault( thread_t thread, user_addr_t vadddr, + kern_return_t kr ); /* Set a task's name in the platform kernel debugger */ extern void pal_dbg_set_task_name( task_t task ); @@ -126,14 +123,11 @@ void pal_thread_terminate_self(thread_t thread); void pal_ast_check(thread_t thread); /* Called by sync_iss_to_iks */ -extern void pal_get_kern_regs( x86_saved_state_t *state ); - -/* Called by load_machfile */ -void pal_switch_pmap(thread_t, pmap_t, boolean_t); +extern void pal_get_kern_regs( x86_saved_state_t *state ) __dead2; /* * Platform-specific hlt/sti. - */ + */ extern void pal_hlt(void); extern void pal_sti(void); extern void pal_cli(void); @@ -148,29 +142,33 @@ void pal_register_cache_state(thread_t thread, pal_cache_state_t state); /* Catch code running on the except thread that shouldn't be */ void pal_preemption_assert(void); -void hibernate_pal_prepare(void); -void pal_efi_hibernate_prepare(void); - /* Include a PAL-specific header, too, for xnu-internal overrides */ #include +#define PAL_XCPM_PROPERTY_VALUE 3 + +extern boolean_t virtualized; +#define PAL_VIRTUALIZED_PROPERTY_VALUE 4 /* Allow for tricky IOKit property matching */ #define PAL_AICPM_PROPERTY_NAME "intel_cpupm_matching" -static inline void +static inline void pal_get_resource_property(const char **property_name, int *property_value) { *property_name = PAL_AICPM_PROPERTY_NAME; - *property_value = PAL_AICPM_PROPERTY_VALUE; + *property_value = PAL_XCPM_PROPERTY_VALUE; + if (virtualized) { + *property_value = PAL_VIRTUALIZED_PROPERTY_VALUE; + } } /* assembly function to update TSC / timebase info */ extern void _pal_rtc_nanotime_store( - uint64_t tsc, - uint64_t nsec, - uint32_t scale, - uint32_t shift, - struct pal_rtc_nanotime *dst); + uint64_t tsc, + uint64_t nsec, + uint32_t scale, + uint32_t shift, + struct pal_rtc_nanotime *dst); /* global nanotime info */ extern struct pal_rtc_nanotime pal_rtc_nanotime_info;