]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kdp/kdp_internal.h
xnu-1699.32.7.tar.gz
[apple/xnu.git] / osfmk / kdp / kdp_internal.h
1 /*
2 * Copyright (c) 2000-2004 Apple Computer, 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 /*
30 * Internal definitions for kdp module
31 */
32
33 #include <kdp/kdp.h>
34 #include <kdp/kdp_protocol.h>
35 #include <mach/vm_types.h>
36 #include <libsa/types.h>
37
38 typedef struct {
39 void *saved_state;
40 thread_t kdp_thread;
41 int kdp_cpu;
42 uint32_t session_key;
43 unsigned int conn_seq;
44 unsigned short reply_port;
45 unsigned short exception_port;
46 boolean_t is_conn;
47 boolean_t is_halted;
48 unsigned char exception_seq;
49 boolean_t exception_ack_needed;
50 } kdp_glob_t;
51
52 extern kdp_glob_t kdp;
53
54 extern volatile int kdp_flag;
55 extern int noresume_on_disconnect;
56
57 #define KDP_READY 0x1
58 #define KDP_ARP 0x2
59 #define KDP_BP_DIS 0x4
60 #define KDP_GETC_ENA 0x8
61 #define KDP_PANIC_DUMP_ENABLED 0x10
62 #define PANIC_CORE_ON_NMI 0x20
63 #define DBG_POST_CORE 0x40
64 #define PANIC_LOG_DUMP 0x80
65 #define REBOOT_POST_CORE 0x100
66 #define SYSTEM_LOG_DUMP 0x200
67 typedef boolean_t
68 (*kdp_dispatch_t) (
69 kdp_pkt_t *,
70 int *,
71 unsigned short *
72 );
73
74 extern
75 boolean_t
76 kdp_packet(
77 unsigned char *,
78 int *,
79 unsigned short *
80 );
81
82 extern
83 boolean_t
84 kdp_remove_all_breakpoints (void);
85
86 extern
87 void
88 kdp_exception(
89 unsigned char *,
90 int *,
91 unsigned short *,
92 unsigned int,
93 unsigned int,
94 unsigned int
95 );
96
97 extern
98 boolean_t
99 kdp_exception_ack(
100 unsigned char *,
101 int
102 );
103
104 extern
105 void
106 kdp_panic(
107 const char *msg
108 );
109
110 extern
111 void
112 kdp_machine_reboot(
113 void
114 );
115
116 extern
117 void
118 kdp_us_spin(
119 int usec
120 );
121
122 extern
123 int
124 kdp_intr_disbl(
125 void
126 );
127
128 extern
129 void
130 kdp_intr_enbl(
131 int s
132 );
133
134 extern
135 kdp_error_t
136 kdp_machine_read_regs(
137 unsigned int cpu,
138 unsigned int flavor,
139 char *data,
140 int *size
141 );
142
143 extern
144 kdp_error_t
145 kdp_machine_write_regs(
146 unsigned int cpu,
147 unsigned int flavor,
148 char *data,
149 int *size
150 );
151
152 extern
153 void
154 kdp_machine_hostinfo(
155 kdp_hostinfo_t *hostinfo
156 );
157
158 extern
159 void
160 kdp_sync_cache(
161 void
162 );
163
164 /* Return a byte array that can be byte-copied to a memory address
165 * to trap into the debugger. Must be 4 bytes or less in the current
166 * implementation
167 */
168 #define MAX_BREAKINSN_BYTES 4
169
170 void
171 kdp_machine_get_breakinsn(
172 uint8_t *bytes,
173 uint32_t *size
174 );
175
176 extern void
177 kdp_ml_enter_debugger(
178 void
179 );
180
181 mach_vm_size_t
182 kdp_machine_vm_read( mach_vm_address_t, caddr_t, mach_vm_size_t);
183
184 mach_vm_size_t
185 kdp_machine_vm_write( caddr_t, mach_vm_address_t, mach_vm_size_t);
186
187 mach_vm_size_t
188 kdp_machine_phys_read(kdp_readphysmem64_req_t *rq, caddr_t /* data */,
189 uint16_t /* lcpu */);
190
191 mach_vm_size_t
192 kdp_machine_phys_write(kdp_writephysmem64_req_t *rq, caddr_t /* data */,
193 uint16_t /* lcpu */);
194
195 int
196 kdp_machine_ioport_read(kdp_readioport_req_t *, caddr_t /* data */, uint16_t /* lcpu */);
197
198 int
199 kdp_machine_ioport_write(kdp_writeioport_req_t *, caddr_t /* data */, uint16_t /* lcpu */);
200
201 int
202 kdp_machine_msr64_read(kdp_readmsr64_req_t *, caddr_t /* data */, uint16_t /* lcpu */);
203
204 int
205 kdp_machine_msr64_write(kdp_writemsr64_req_t *, caddr_t /* data */, uint16_t /* lcpu */);