]> git.saurik.com Git - apple/xnu.git/blame - osfmk/kdp/kdp_internal.h
xnu-1699.32.7.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@
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
38typedef 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
52extern kdp_glob_t kdp;
9bccf70c 53
0c530ab8 54extern volatile int kdp_flag;
7e4a7d39 55extern 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
67typedef boolean_t
68(*kdp_dispatch_t) (
69 kdp_pkt_t *,
70 int *,
71 unsigned short *
72);
73
91447636 74extern
1c79356b
A
75boolean_t
76kdp_packet(
77 unsigned char *,
78 int *,
79 unsigned short *
80);
81
91447636 82extern
9bccf70c 83boolean_t
91447636 84kdp_remove_all_breakpoints (void);
9bccf70c 85
91447636 86extern
1c79356b
A
87void
88kdp_exception(
89 unsigned char *,
90 int *,
91 unsigned short *,
92 unsigned int,
93 unsigned int,
94 unsigned int
95);
96
91447636 97extern
1c79356b
A
98boolean_t
99kdp_exception_ack(
100 unsigned char *,
101 int
102);
103
91447636 104extern
1c79356b
A
105void
106kdp_panic(
107 const char *msg
108);
109
91447636 110extern
1c79356b 111void
b0d623f7 112kdp_machine_reboot(
1c79356b
A
113 void
114);
115
91447636 116extern
1c79356b
A
117void
118kdp_us_spin(
119 int usec
120);
121
91447636 122extern
1c79356b
A
123int
124kdp_intr_disbl(
125 void
126);
127
91447636 128extern
1c79356b
A
129void
130kdp_intr_enbl(
131 int s
132);
133
91447636 134extern
1c79356b
A
135kdp_error_t
136kdp_machine_read_regs(
137 unsigned int cpu,
138 unsigned int flavor,
139 char *data,
140 int *size
141);
142
91447636 143extern
1c79356b
A
144kdp_error_t
145kdp_machine_write_regs(
146 unsigned int cpu,
147 unsigned int flavor,
148 char *data,
149 int *size
150);
151
91447636 152extern
1c79356b
A
153void
154kdp_machine_hostinfo(
155 kdp_hostinfo_t *hostinfo
156);
157
91447636 158extern
1c79356b
A
159void
160kdp_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
170void
171kdp_machine_get_breakinsn(
172 uint8_t *bytes,
173 uint32_t *size
91447636 174);
2d21ac55
A
175
176extern void
177kdp_ml_enter_debugger(
178 void
179);
b0d623f7
A
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 */);