]> git.saurik.com Git - apple/xnu.git/blame_incremental - osfmk/kdp/kdp_internal.h
xnu-1699.32.7.tar.gz
[apple/xnu.git] / osfmk / kdp / kdp_internal.h
... / ...
CommitLineData
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
38typedef 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
52extern kdp_glob_t kdp;
53
54extern volatile int kdp_flag;
55extern 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
67typedef boolean_t
68(*kdp_dispatch_t) (
69 kdp_pkt_t *,
70 int *,
71 unsigned short *
72);
73
74extern
75boolean_t
76kdp_packet(
77 unsigned char *,
78 int *,
79 unsigned short *
80);
81
82extern
83boolean_t
84kdp_remove_all_breakpoints (void);
85
86extern
87void
88kdp_exception(
89 unsigned char *,
90 int *,
91 unsigned short *,
92 unsigned int,
93 unsigned int,
94 unsigned int
95);
96
97extern
98boolean_t
99kdp_exception_ack(
100 unsigned char *,
101 int
102);
103
104extern
105void
106kdp_panic(
107 const char *msg
108);
109
110extern
111void
112kdp_machine_reboot(
113 void
114);
115
116extern
117void
118kdp_us_spin(
119 int usec
120);
121
122extern
123int
124kdp_intr_disbl(
125 void
126);
127
128extern
129void
130kdp_intr_enbl(
131 int s
132);
133
134extern
135kdp_error_t
136kdp_machine_read_regs(
137 unsigned int cpu,
138 unsigned int flavor,
139 char *data,
140 int *size
141);
142
143extern
144kdp_error_t
145kdp_machine_write_regs(
146 unsigned int cpu,
147 unsigned int flavor,
148 char *data,
149 int *size
150);
151
152extern
153void
154kdp_machine_hostinfo(
155 kdp_hostinfo_t *hostinfo
156);
157
158extern
159void
160kdp_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
170void
171kdp_machine_get_breakinsn(
172 uint8_t *bytes,
173 uint32_t *size
174);
175
176extern void
177kdp_ml_enter_debugger(
178 void
179);
180
181mach_vm_size_t
182kdp_machine_vm_read( mach_vm_address_t, caddr_t, mach_vm_size_t);
183
184mach_vm_size_t
185kdp_machine_vm_write( caddr_t, mach_vm_address_t, mach_vm_size_t);
186
187mach_vm_size_t
188kdp_machine_phys_read(kdp_readphysmem64_req_t *rq, caddr_t /* data */,
189 uint16_t /* lcpu */);
190
191mach_vm_size_t
192kdp_machine_phys_write(kdp_writephysmem64_req_t *rq, caddr_t /* data */,
193 uint16_t /* lcpu */);
194
195int
196kdp_machine_ioport_read(kdp_readioport_req_t *, caddr_t /* data */, uint16_t /* lcpu */);
197
198int
199kdp_machine_ioport_write(kdp_writeioport_req_t *, caddr_t /* data */, uint16_t /* lcpu */);
200
201int
202kdp_machine_msr64_read(kdp_readmsr64_req_t *, caddr_t /* data */, uint16_t /* lcpu */);
203
204int
205kdp_machine_msr64_write(kdp_writemsr64_req_t *, caddr_t /* data */, uint16_t /* lcpu */);