X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0a7de7458d150b5d4dffc935ba399be265ef0a1a..refs/heads/master:/osfmk/arm/misc_protos.h diff --git a/osfmk/arm/misc_protos.h b/osfmk/arm/misc_protos.h index ca995fb37..76308798b 100644 --- a/osfmk/arm/misc_protos.h +++ b/osfmk/arm/misc_protos.h @@ -34,34 +34,61 @@ #include -extern processor_t cpu_processor_alloc(boolean_t is_boot_cpu); -extern void cpu_processor_free(processor_t proc); +typedef struct boot_args boot_args; +/* The address of the end of the kernelcache. */ +extern vm_offset_t end_kern; +/* The lowest address in the kernelcache. */ +extern vm_offset_t segLOWEST; extern void machine_startup(__unused boot_args *args) __attribute__((noinline)); -extern void machine_lockdown_preflight(void); -extern void machine_lockdown(void); + + +extern void arm_auxkc_init(void *mh, void *base); + extern void arm_vm_init(uint64_t memory_size, boot_args *args); extern void arm_vm_prot_init(boot_args *args); extern void arm_vm_prot_finalize(boot_args *args); - extern kern_return_t DebuggerXCallEnter(boolean_t); extern void DebuggerXCallReturn(void); #if __arm64__ && DEBUG extern void dump_kva_space(void); -#endif +#endif /* __arm64__ && DEBUG */ extern void Load_context(thread_t); extern void Idle_load_context(void) __attribute__((noreturn)); extern thread_t Switch_context(thread_t, thread_continue_t, thread_t); extern thread_t Shutdown_context(void (*doshutdown)(processor_t), processor_t processor); -extern void Call_continuation(thread_continue_t, void *, wait_result_t, boolean_t enable_interrupts); +extern void __dead2 Call_continuation(thread_continue_t, void *, wait_result_t, boolean_t enable_interrupts); + + +/** + * Indicate during a context-switch event that we have updated some CPU + * state which requires a later context-sync event. + * + * On ARMv8.5 and later CPUs, this function sets a flag that will trigger an + * explicit isb instruction sometime before the upcoming eret instruction. + * + * Prior to ARMv8.5, the eret instruction itself is always synchronizing, and + * this function is an empty stub which serves only as documentation. + */ +#if __ARM_ARCH_8_5__ +extern void arm_context_switch_requires_sync(void); +#else +static inline void +arm_context_switch_requires_sync(void) +{ +} +#endif /* __ARM_ARCH_8_5__ */ + +#if __has_feature(ptrauth_calls) +extern boolean_t arm_user_jop_disabled(void); +#endif /* __has_feature(ptrauth_calls) */ extern void DebuggerCall(unsigned int reason, void *ctx); extern void DebuggerXCall(void *ctx); -extern int _copyinstr(const user_addr_t user_addr, char *kernel_addr, vm_size_t max, vm_size_t *actual); extern int copyout_kern(const char *kernel_addr, user_addr_t user_addr, vm_size_t nbytes); extern int copyin_kern(const user_addr_t user_addr, char *kernel_addr, vm_size_t nbytes); @@ -83,14 +110,18 @@ extern boolean_t debug_state_is_valid64(arm_debug_state64_t *ds); extern int copyio_check_user_addr(user_addr_t user_addr, vm_size_t nbytes); +/* + * Get a quick virtual mapping of a physical page and run a callback on that + * page's virtual address. + */ +extern int apply_func_phys(addr64_t src64, vm_size_t bytes, int (*func)(void * buffer, vm_size_t bytes, void * arg), void * arg); + /* Top-Byte-Ignore */ -extern boolean_t user_tbi; -#define TBI_MASK 0xff00000000000000 -#define user_tbi_enabled() (user_tbi) -#define tbi_clear(addr) ((addr) & ~(TBI_MASK)) +#define TBI_MASK 0xff00000000000000 +#define tbi_clear(addr) ((addr) & ~(TBI_MASK)) -#else +#else /* !defined(__arm__) && !defined(__arm64__) */ #error Unknown architecture. -#endif +#endif /* defined(__arm__) */ #endif /* _ARM_MISC_PROTOS_H_ */