1 | /* |
2 | * Copyright (c) 2007 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 _ARM_MISC_PROTOS_H_ |
33 | #define _ARM_MISC_PROTOS_H_ |
34 | |
35 | #include <kern/kern_types.h> |
36 | |
37 | extern processor_t cpu_processor_alloc(boolean_t is_boot_cpu); |
38 | extern void cpu_processor_free(processor_t proc); |
39 | |
40 | extern void machine_startup(__unused boot_args *args) __attribute__((noinline)); |
41 | extern void machine_lockdown_preflight(void); |
42 | extern void machine_lockdown(void); |
43 | extern void arm_vm_init(uint64_t memory_size, boot_args *args); |
44 | extern void arm_vm_prot_init(boot_args *args); |
45 | extern void arm_vm_prot_finalize(boot_args *args); |
46 | |
47 | |
48 | extern kern_return_t DebuggerXCallEnter(boolean_t); |
49 | extern void DebuggerXCallReturn(void); |
50 | |
51 | #if __arm64__ && DEBUG |
52 | extern void dump_kva_space(void); |
53 | #endif |
54 | |
55 | extern void Load_context(thread_t); |
56 | extern void Idle_load_context(void) __attribute__((noreturn)); |
57 | extern thread_t Switch_context(thread_t, thread_continue_t, thread_t); |
58 | extern thread_t Shutdown_context(void (*doshutdown)(processor_t), processor_t processor); |
59 | extern void Call_continuation(thread_continue_t, void *, wait_result_t, boolean_t enable_interrupts); |
60 | |
61 | extern void DebuggerCall(unsigned int reason, void *ctx); |
62 | extern void DebuggerXCall(void *ctx); |
63 | |
64 | extern int _copyinstr(const user_addr_t user_addr, char *kernel_addr, vm_size_t max, vm_size_t *actual); |
65 | extern int copyout_kern(const char *kernel_addr, user_addr_t user_addr, vm_size_t nbytes); |
66 | extern int copyin_kern(const user_addr_t user_addr, char *kernel_addr, vm_size_t nbytes); |
67 | |
68 | extern void bcopy_phys(addr64_t from, addr64_t to, vm_size_t nbytes); |
69 | |
70 | extern void dcache_incoherent_io_flush64(addr64_t pa, unsigned int count, unsigned int remaining, unsigned int *res); |
71 | extern void dcache_incoherent_io_store64(addr64_t pa, unsigned int count, unsigned int remaining, unsigned int *res); |
72 | |
73 | #if defined(__arm__) |
74 | extern void copy_debug_state(arm_debug_state_t *src, arm_debug_state_t *target, __unused boolean_t all); |
75 | #elif defined(__arm64__) |
76 | extern void copy_legacy_debug_state(arm_legacy_debug_state_t *src, arm_legacy_debug_state_t *target, __unused boolean_t all); |
77 | extern void copy_debug_state32(arm_debug_state32_t *src, arm_debug_state32_t *target, __unused boolean_t all); |
78 | extern void copy_debug_state64(arm_debug_state64_t *src, arm_debug_state64_t *target, __unused boolean_t all); |
79 | |
80 | extern boolean_t debug_legacy_state_is_valid(arm_legacy_debug_state_t *ds); |
81 | extern boolean_t debug_state_is_valid32(arm_debug_state32_t *ds); |
82 | extern boolean_t debug_state_is_valid64(arm_debug_state64_t *ds); |
83 | |
84 | extern int copyio_check_user_addr(user_addr_t user_addr, vm_size_t nbytes); |
85 | |
86 | /* Top-Byte-Ignore */ |
87 | extern boolean_t user_tbi; |
88 | #define TBI_MASK 0xff00000000000000 |
89 | #define user_tbi_enabled() (user_tbi) |
90 | #define tbi_clear(addr) ((addr) & ~(TBI_MASK)) |
91 | |
92 | #else |
93 | #error Unknown architecture. |
94 | #endif |
95 | |
96 | #endif /* _ARM_MISC_PROTOS_H_ */ |
97 | |