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