]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
91447636 | 2 | * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. |
1c79356b | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
2d21ac55 A |
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. | |
8f6c56a5 | 14 | * |
2d21ac55 A |
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 | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
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. | |
8f6c56a5 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b | 27 | */ |
9bccf70c | 28 | |
1c79356b | 29 | /* |
9bccf70c | 30 | * Internal definitions for kdp module |
1c79356b A |
31 | */ |
32 | ||
33 | #include <kdp/kdp.h> | |
34 | #include <kdp/kdp_protocol.h> | |
b0d623f7 A |
35 | #include <mach/vm_types.h> |
36 | #include <libsa/types.h> | |
1c79356b A |
37 | |
38 | typedef struct { | |
7e4a7d39 A |
39 | void *saved_state; |
40 | thread_t kdp_thread; | |
41 | int kdp_cpu; | |
42 | uint32_t session_key; | |
1c79356b | 43 | unsigned int conn_seq; |
7e4a7d39 A |
44 | unsigned short reply_port; |
45 | unsigned short exception_port; | |
1c79356b | 46 | boolean_t is_conn; |
1c79356b | 47 | boolean_t is_halted; |
1c79356b A |
48 | unsigned char exception_seq; |
49 | boolean_t exception_ack_needed; | |
50 | } kdp_glob_t; | |
51 | ||
52 | extern kdp_glob_t kdp; | |
9bccf70c | 53 | |
0c530ab8 | 54 | extern volatile int kdp_flag; |
7e4a7d39 | 55 | extern int noresume_on_disconnect; |
0c530ab8 | 56 | |
9bccf70c A |
57 | #define KDP_READY 0x1 |
58 | #define KDP_ARP 0x2 | |
59 | #define KDP_BP_DIS 0x4 | |
55e303ae A |
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 | |
b0d623f7 | 65 | #define REBOOT_POST_CORE 0x100 |
7e4a7d39 | 66 | #define SYSTEM_LOG_DUMP 0x200 |
1c79356b A |
67 | typedef boolean_t |
68 | (*kdp_dispatch_t) ( | |
69 | kdp_pkt_t *, | |
70 | int *, | |
71 | unsigned short * | |
72 | ); | |
73 | ||
91447636 | 74 | extern |
1c79356b A |
75 | boolean_t |
76 | kdp_packet( | |
77 | unsigned char *, | |
78 | int *, | |
79 | unsigned short * | |
80 | ); | |
81 | ||
91447636 | 82 | extern |
9bccf70c | 83 | boolean_t |
91447636 | 84 | kdp_remove_all_breakpoints (void); |
9bccf70c | 85 | |
91447636 | 86 | extern |
1c79356b A |
87 | void |
88 | kdp_exception( | |
89 | unsigned char *, | |
90 | int *, | |
91 | unsigned short *, | |
92 | unsigned int, | |
93 | unsigned int, | |
94 | unsigned int | |
95 | ); | |
96 | ||
91447636 | 97 | extern |
1c79356b A |
98 | boolean_t |
99 | kdp_exception_ack( | |
100 | unsigned char *, | |
101 | int | |
102 | ); | |
103 | ||
91447636 | 104 | extern |
1c79356b A |
105 | void |
106 | kdp_panic( | |
107 | const char *msg | |
108 | ); | |
109 | ||
91447636 | 110 | extern |
1c79356b | 111 | void |
b0d623f7 | 112 | kdp_machine_reboot( |
1c79356b A |
113 | void |
114 | ); | |
115 | ||
91447636 | 116 | extern |
1c79356b A |
117 | void |
118 | kdp_us_spin( | |
119 | int usec | |
120 | ); | |
121 | ||
91447636 | 122 | extern |
1c79356b A |
123 | int |
124 | kdp_intr_disbl( | |
125 | void | |
126 | ); | |
127 | ||
91447636 | 128 | extern |
1c79356b A |
129 | void |
130 | kdp_intr_enbl( | |
131 | int s | |
132 | ); | |
133 | ||
91447636 | 134 | extern |
1c79356b A |
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 | ||
91447636 | 143 | extern |
1c79356b A |
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 | ||
91447636 | 152 | extern |
1c79356b A |
153 | void |
154 | kdp_machine_hostinfo( | |
155 | kdp_hostinfo_t *hostinfo | |
156 | ); | |
157 | ||
91447636 | 158 | extern |
1c79356b A |
159 | void |
160 | kdp_sync_cache( | |
161 | void | |
162 | ); | |
163 | ||
b0d623f7 A |
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 | |
91447636 | 174 | ); |
2d21ac55 A |
175 | |
176 | extern void | |
177 | kdp_ml_enter_debugger( | |
178 | void | |
179 | ); | |
b0d623f7 A |
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 */); |