xref: /xnu-8796.121.2/osfmk/kdp/kdp_protocol.h (revision c54f35ca767986246321eb901baf8f5ff7923f6a)
1*c54f35caSApple OSS Distributions /*
2*c54f35caSApple OSS Distributions  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3*c54f35caSApple OSS Distributions  *
4*c54f35caSApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*c54f35caSApple OSS Distributions  *
6*c54f35caSApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*c54f35caSApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*c54f35caSApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*c54f35caSApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*c54f35caSApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*c54f35caSApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*c54f35caSApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*c54f35caSApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*c54f35caSApple OSS Distributions  *
15*c54f35caSApple OSS Distributions  * Please obtain a copy of the License at
16*c54f35caSApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*c54f35caSApple OSS Distributions  *
18*c54f35caSApple OSS Distributions  * The Original Code and all software distributed under the License are
19*c54f35caSApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*c54f35caSApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*c54f35caSApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*c54f35caSApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*c54f35caSApple OSS Distributions  * Please see the License for the specific language governing rights and
24*c54f35caSApple OSS Distributions  * limitations under the License.
25*c54f35caSApple OSS Distributions  *
26*c54f35caSApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*c54f35caSApple OSS Distributions  */
28*c54f35caSApple OSS Distributions 
29*c54f35caSApple OSS Distributions #ifndef _KDP_PROTOCOL_H_
30*c54f35caSApple OSS Distributions #define _KDP_PROTOCOL_H_
31*c54f35caSApple OSS Distributions 
32*c54f35caSApple OSS Distributions /*
33*c54f35caSApple OSS Distributions  * Definition of remote debugger protocol.
34*c54f35caSApple OSS Distributions  */
35*c54f35caSApple OSS Distributions 
36*c54f35caSApple OSS Distributions 
37*c54f35caSApple OSS Distributions #ifdef MACH_KERNEL_PRIVATE
38*c54f35caSApple OSS Distributions #include        <mach/vm_prot.h>
39*c54f35caSApple OSS Distributions #include    <mach/boolean.h>
40*c54f35caSApple OSS Distributions #include        <stdint.h>
41*c54f35caSApple OSS Distributions #endif
42*c54f35caSApple OSS Distributions 
43*c54f35caSApple OSS Distributions #ifdef KDP_PROXY_PACK_SUPPORT
44*c54f35caSApple OSS Distributions #pragma pack(1)
45*c54f35caSApple OSS Distributions #define KDP_PACKED
46*c54f35caSApple OSS Distributions #else
47*c54f35caSApple OSS Distributions #define KDP_PACKED __attribute__((packed))
48*c54f35caSApple OSS Distributions #endif
49*c54f35caSApple OSS Distributions 
50*c54f35caSApple OSS Distributions /*
51*c54f35caSApple OSS Distributions  * Retransmit parameters
52*c54f35caSApple OSS Distributions  */
53*c54f35caSApple OSS Distributions #if     DDEBUG_DEBUG || DEBUG_DEBUG
54*c54f35caSApple OSS Distributions #define KDP_REXMIT_SECS         20      /* rexmit if no ack in 3 secs */
55*c54f35caSApple OSS Distributions #else   /* DDEBUG_DEBUG || DEBUG_DEBUG */
56*c54f35caSApple OSS Distributions #define KDP_REXMIT_SECS         3       /* rexmit if no ack in 3 secs */
57*c54f35caSApple OSS Distributions #endif  /* DDEBUG_DEBUG || DEBUG_DEBUG */
58*c54f35caSApple OSS Distributions #define KDP_REXMIT_TRIES        8       /* xmit 8 times, then give up */
59*c54f35caSApple OSS Distributions 
60*c54f35caSApple OSS Distributions 
61*c54f35caSApple OSS Distributions /*
62*c54f35caSApple OSS Distributions  * (NMI) Attention Max Wait Time
63*c54f35caSApple OSS Distributions  * Remote will resume unless KDP requests is received within this
64*c54f35caSApple OSS Distributions  * many seconds after an attention (nmi) packet is sent.
65*c54f35caSApple OSS Distributions  */
66*c54f35caSApple OSS Distributions #define KDP_MAX_ATTN_WAIT       30      /* wait max of 30 seconds */
67*c54f35caSApple OSS Distributions 
68*c54f35caSApple OSS Distributions /*
69*c54f35caSApple OSS Distributions  * Well-known UDP port, debugger side.
70*c54f35caSApple OSS Distributions  * FIXME: This is what the 68K guys use, but beats me how they chose it...
71*c54f35caSApple OSS Distributions  */
72*c54f35caSApple OSS Distributions #define KDP_REMOTE_PORT         41139   /* pick one and register it */
73*c54f35caSApple OSS Distributions 
74*c54f35caSApple OSS Distributions /*
75*c54f35caSApple OSS Distributions  * UDP ports, KDB side. 5 port numbers are reserved for each port (request
76*c54f35caSApple OSS Distributions  * and exception). This allows multiple KDBs to run on one host.
77*c54f35caSApple OSS Distributions  */
78*c54f35caSApple OSS Distributions #define UDP_HOST_COMM_BASE      41140
79*c54f35caSApple OSS Distributions #define UDP_HOST_EXCEP_BASE     41145
80*c54f35caSApple OSS Distributions #define NUM_UDP_HOST_PORTS      5
81*c54f35caSApple OSS Distributions 
82*c54f35caSApple OSS Distributions /*
83*c54f35caSApple OSS Distributions  * Requests
84*c54f35caSApple OSS Distributions  */
85*c54f35caSApple OSS Distributions typedef enum {
86*c54f35caSApple OSS Distributions 	/* connection oriented requests */
87*c54f35caSApple OSS Distributions 	KDP_CONNECT, KDP_DISCONNECT,
88*c54f35caSApple OSS Distributions 
89*c54f35caSApple OSS Distributions 	/* obtaining client info */
90*c54f35caSApple OSS Distributions 	KDP_HOSTINFO, KDP_VERSION, KDP_MAXBYTES,
91*c54f35caSApple OSS Distributions 
92*c54f35caSApple OSS Distributions 	/* memory access */
93*c54f35caSApple OSS Distributions 	KDP_READMEM, KDP_WRITEMEM,
94*c54f35caSApple OSS Distributions 
95*c54f35caSApple OSS Distributions 	/* register access */
96*c54f35caSApple OSS Distributions 	KDP_READREGS, KDP_WRITEREGS,
97*c54f35caSApple OSS Distributions 
98*c54f35caSApple OSS Distributions 	/* executable image info */
99*c54f35caSApple OSS Distributions 	KDP_LOAD, KDP_IMAGEPATH,
100*c54f35caSApple OSS Distributions 
101*c54f35caSApple OSS Distributions 	/* execution control */
102*c54f35caSApple OSS Distributions 	KDP_SUSPEND, KDP_RESUMECPUS,
103*c54f35caSApple OSS Distributions 
104*c54f35caSApple OSS Distributions 	/* exception and termination notification, NOT true requests */
105*c54f35caSApple OSS Distributions 	KDP_EXCEPTION, KDP_TERMINATION,
106*c54f35caSApple OSS Distributions 
107*c54f35caSApple OSS Distributions 	/* breakpoint control */
108*c54f35caSApple OSS Distributions 	KDP_BREAKPOINT_SET, KDP_BREAKPOINT_REMOVE,
109*c54f35caSApple OSS Distributions 
110*c54f35caSApple OSS Distributions 	/* vm regions */
111*c54f35caSApple OSS Distributions 	KDP_REGIONS,
112*c54f35caSApple OSS Distributions 
113*c54f35caSApple OSS Distributions 	/* reattach to a connected host */
114*c54f35caSApple OSS Distributions 	KDP_REATTACH,
115*c54f35caSApple OSS Distributions 
116*c54f35caSApple OSS Distributions 	/* remote reboot request */
117*c54f35caSApple OSS Distributions 	KDP_HOSTREBOOT,
118*c54f35caSApple OSS Distributions 
119*c54f35caSApple OSS Distributions 	/* memory access (64-bit wide addresses). Version 11 protocol */
120*c54f35caSApple OSS Distributions 	KDP_READMEM64, KDP_WRITEMEM64,
121*c54f35caSApple OSS Distributions 
122*c54f35caSApple OSS Distributions 	/* breakpoint control (64-bit wide addresses). Version 11 protocol */
123*c54f35caSApple OSS Distributions 	KDP_BREAKPOINT64_SET, KDP_BREAKPOINT64_REMOVE,
124*c54f35caSApple OSS Distributions 
125*c54f35caSApple OSS Distributions 	/* kernel version string, like "xnu-1234.5~6". Version 11 protocol */
126*c54f35caSApple OSS Distributions 	KDP_KERNELVERSION,
127*c54f35caSApple OSS Distributions 
128*c54f35caSApple OSS Distributions 	/* physical memory access (64-bit wide addresses). Version 12 protocol */
129*c54f35caSApple OSS Distributions 	KDP_READPHYSMEM64, KDP_WRITEPHYSMEM64,
130*c54f35caSApple OSS Distributions 
131*c54f35caSApple OSS Distributions 	/* ioport access (8-, 16-, and 32-bit) */
132*c54f35caSApple OSS Distributions 	KDP_READIOPORT, KDP_WRITEIOPORT,
133*c54f35caSApple OSS Distributions 
134*c54f35caSApple OSS Distributions 	/* msr access (64-bit) */
135*c54f35caSApple OSS Distributions 	KDP_READMSR64, KDP_WRITEMSR64,
136*c54f35caSApple OSS Distributions 
137*c54f35caSApple OSS Distributions 	/* get/dump panic/corefile info */
138*c54f35caSApple OSS Distributions 	KDP_DUMPINFO,
139*c54f35caSApple OSS Distributions 
140*c54f35caSApple OSS Distributions 	/* keep this last */
141*c54f35caSApple OSS Distributions 	KDP_INVALID_REQUEST
142*c54f35caSApple OSS Distributions } kdp_req_t;
143*c54f35caSApple OSS Distributions 
144*c54f35caSApple OSS Distributions typedef enum {
145*c54f35caSApple OSS Distributions 	KDP_DUMPINFO_GETINFO    = 0x00000000,
146*c54f35caSApple OSS Distributions 	KDP_DUMPINFO_SETINFO    = 0x00000001,
147*c54f35caSApple OSS Distributions 	KDP_DUMPINFO_CORE       = 0x00000102,
148*c54f35caSApple OSS Distributions 	KDP_DUMPINFO_PANICLOG   = 0x00000103,
149*c54f35caSApple OSS Distributions 	KDP_DUMPINFO_SYSTEMLOG  = 0x00000104,
150*c54f35caSApple OSS Distributions 	KDP_DUMPINFO_DISABLE    = 0x00000105,
151*c54f35caSApple OSS Distributions 	KDP_DUMPINFO_MASK       = 0x00000FFF,
152*c54f35caSApple OSS Distributions 	KDP_DUMPINFO_DUMP       = 0x00000100,
153*c54f35caSApple OSS Distributions 
154*c54f35caSApple OSS Distributions 	KDP_DUMPINFO_REBOOT     = 0x10000000,
155*c54f35caSApple OSS Distributions 	KDP_DUMPINFO_NORESUME   = 0x20000000,
156*c54f35caSApple OSS Distributions 	KDP_DUMPINFO_RESUME     = 0x00000000, /* default behaviour */
157*c54f35caSApple OSS Distributions 	KDP_DUMPINFO_NOINTR     = 0x40000000, /* don't interrupt */
158*c54f35caSApple OSS Distributions 	KDP_DUMPINFO_INTR       = 0x00000000, /* default behaviour */
159*c54f35caSApple OSS Distributions } kdp_dumpinfo_t;
160*c54f35caSApple OSS Distributions 
161*c54f35caSApple OSS Distributions /*
162*c54f35caSApple OSS Distributions  * Common KDP packet header
163*c54f35caSApple OSS Distributions  * NOTE: kgmacros has a non-symboled version of kdp_hdr_t so that some basic information.
164*c54f35caSApple OSS Distributions  *       can be gathered from a kernel without any symbols. changes to this structure
165*c54f35caSApple OSS Distributions  *       need to be reflected in kgmacros as well.
166*c54f35caSApple OSS Distributions  */
167*c54f35caSApple OSS Distributions typedef struct {
168*c54f35caSApple OSS Distributions 	kdp_req_t       request:7;      /* kdp_req_t, request type */
169*c54f35caSApple OSS Distributions 	unsigned        is_reply:1;     /* 0 => request, 1 => reply */
170*c54f35caSApple OSS Distributions 	unsigned        seq:8;          /* sequence number within session */
171*c54f35caSApple OSS Distributions 	unsigned        len:16;         /* length of entire pkt including hdr */
172*c54f35caSApple OSS Distributions 	unsigned        key;            /* session key */
173*c54f35caSApple OSS Distributions } KDP_PACKED kdp_hdr_t;
174*c54f35caSApple OSS Distributions 
175*c54f35caSApple OSS Distributions /*
176*c54f35caSApple OSS Distributions  * KDP errors
177*c54f35caSApple OSS Distributions  */
178*c54f35caSApple OSS Distributions typedef enum {
179*c54f35caSApple OSS Distributions 	KDPERR_NO_ERROR = 0,
180*c54f35caSApple OSS Distributions 	KDPERR_ALREADY_CONNECTED,
181*c54f35caSApple OSS Distributions 	KDPERR_BAD_NBYTES,
182*c54f35caSApple OSS Distributions 	KDPERR_BADFLAVOR,               /* bad flavor in w/r regs */
183*c54f35caSApple OSS Distributions 	KDPERR_BAD_ACCESS,              /* memory reference failure */
184*c54f35caSApple OSS Distributions 
185*c54f35caSApple OSS Distributions 	KDPERR_MAX_BREAKPOINTS = 100,
186*c54f35caSApple OSS Distributions 	KDPERR_BREAKPOINT_NOT_FOUND = 101,
187*c54f35caSApple OSS Distributions 	KDPERR_BREAKPOINT_ALREADY_SET = 102
188*c54f35caSApple OSS Distributions } kdp_error_t;
189*c54f35caSApple OSS Distributions 
190*c54f35caSApple OSS Distributions #if defined(__x86_64__)
191*c54f35caSApple OSS Distributions #define KDPERR_ACCESS(_req, _ret)  \
192*c54f35caSApple OSS Distributions 	(((_req) == (uint32_t)(_ret)) ? KDPERR_NO_ERROR : KDPERR_BAD_ACCESS)
193*c54f35caSApple OSS Distributions #else
194*c54f35caSApple OSS Distributions #define KDPERR_ACCESS(req, cnt)  (KDPERR_NO_ERROR)
195*c54f35caSApple OSS Distributions #endif /* x86_64 */
196*c54f35caSApple OSS Distributions 
197*c54f35caSApple OSS Distributions 
198*c54f35caSApple OSS Distributions /*
199*c54f35caSApple OSS Distributions  * KDP requests and reply packet formats
200*c54f35caSApple OSS Distributions  */
201*c54f35caSApple OSS Distributions 
202*c54f35caSApple OSS Distributions /*
203*c54f35caSApple OSS Distributions  * KDP_CONNECT
204*c54f35caSApple OSS Distributions  */
205*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_CONNECT request */
206*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
207*c54f35caSApple OSS Distributions 	uint16_t        req_reply_port; /* udp port which to send replies */
208*c54f35caSApple OSS Distributions 	uint16_t        exc_note_port;  /* udp port which to send exc notes */
209*c54f35caSApple OSS Distributions 	char            greeting[0];    /* "greetings", nul-terminated */
210*c54f35caSApple OSS Distributions } KDP_PACKED kdp_connect_req_t;
211*c54f35caSApple OSS Distributions 
212*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_CONNECT reply */
213*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
214*c54f35caSApple OSS Distributions 	kdp_error_t     error;
215*c54f35caSApple OSS Distributions } KDP_PACKED kdp_connect_reply_t;
216*c54f35caSApple OSS Distributions 
217*c54f35caSApple OSS Distributions /*
218*c54f35caSApple OSS Distributions  * KDP_DISCONNECT
219*c54f35caSApple OSS Distributions  */
220*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_DISCONNECT request */
221*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
222*c54f35caSApple OSS Distributions } KDP_PACKED kdp_disconnect_req_t;
223*c54f35caSApple OSS Distributions 
224*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_DISCONNECT reply */
225*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
226*c54f35caSApple OSS Distributions } KDP_PACKED kdp_disconnect_reply_t;
227*c54f35caSApple OSS Distributions 
228*c54f35caSApple OSS Distributions /*
229*c54f35caSApple OSS Distributions  * KDP_REATTACH
230*c54f35caSApple OSS Distributions  */
231*c54f35caSApple OSS Distributions typedef struct {
232*c54f35caSApple OSS Distributions 	kdp_hdr_t hdr;
233*c54f35caSApple OSS Distributions 	uint16_t req_reply_port; /* udp port which to send replies */
234*c54f35caSApple OSS Distributions } KDP_PACKED kdp_reattach_req_t;
235*c54f35caSApple OSS Distributions 
236*c54f35caSApple OSS Distributions /*
237*c54f35caSApple OSS Distributions  * KDP_HOSTINFO
238*c54f35caSApple OSS Distributions  */
239*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_HOSTINFO request */
240*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
241*c54f35caSApple OSS Distributions } KDP_PACKED kdp_hostinfo_req_t;
242*c54f35caSApple OSS Distributions 
243*c54f35caSApple OSS Distributions typedef struct {
244*c54f35caSApple OSS Distributions 	uint32_t                cpus_mask;      /* bit is 1 if cpu present */
245*c54f35caSApple OSS Distributions 	uint32_t                cpu_type;
246*c54f35caSApple OSS Distributions 	uint32_t                cpu_subtype;
247*c54f35caSApple OSS Distributions } KDP_PACKED kdp_hostinfo_t;
248*c54f35caSApple OSS Distributions 
249*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_HOSTINFO reply */
250*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
251*c54f35caSApple OSS Distributions 	kdp_hostinfo_t  hostinfo;
252*c54f35caSApple OSS Distributions } KDP_PACKED kdp_hostinfo_reply_t;
253*c54f35caSApple OSS Distributions 
254*c54f35caSApple OSS Distributions /*
255*c54f35caSApple OSS Distributions  * KDP_VERSION
256*c54f35caSApple OSS Distributions  */
257*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_VERSION request */
258*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
259*c54f35caSApple OSS Distributions } KDP_PACKED kdp_version_req_t;
260*c54f35caSApple OSS Distributions 
261*c54f35caSApple OSS Distributions #define KDP_FEATURE_BP  0x1     /* local breakpoint support */
262*c54f35caSApple OSS Distributions 
263*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_VERSION reply */
264*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
265*c54f35caSApple OSS Distributions 	uint32_t        version;
266*c54f35caSApple OSS Distributions 	uint32_t        feature;
267*c54f35caSApple OSS Distributions 	uint32_t        pad0;
268*c54f35caSApple OSS Distributions 	uint32_t        pad1;
269*c54f35caSApple OSS Distributions } KDP_PACKED kdp_version_reply_t;
270*c54f35caSApple OSS Distributions 
271*c54f35caSApple OSS Distributions #define VM_PROT_VOLATILE        ((vm_prot_t) 0x08)      /* not cacheable */
272*c54f35caSApple OSS Distributions #define VM_PROT_SPARSE          ((vm_prot_t) 0x10)      /* sparse addr space */
273*c54f35caSApple OSS Distributions 
274*c54f35caSApple OSS Distributions /*
275*c54f35caSApple OSS Distributions  * KDP_REGIONS
276*c54f35caSApple OSS Distributions  */
277*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_REGIONS request */
278*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
279*c54f35caSApple OSS Distributions } KDP_PACKED kdp_regions_req_t;
280*c54f35caSApple OSS Distributions 
281*c54f35caSApple OSS Distributions typedef struct {
282*c54f35caSApple OSS Distributions 	uint32_t        address;
283*c54f35caSApple OSS Distributions 	uint32_t        nbytes;
284*c54f35caSApple OSS Distributions 	uint32_t        protection;     /* vm_prot_t */
285*c54f35caSApple OSS Distributions } KDP_PACKED kdp_region_t;
286*c54f35caSApple OSS Distributions 
287*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_REGIONS reply */
288*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
289*c54f35caSApple OSS Distributions 	uint32_t        nregions;
290*c54f35caSApple OSS Distributions 	kdp_region_t    regions[0];
291*c54f35caSApple OSS Distributions } KDP_PACKED kdp_regions_reply_t;
292*c54f35caSApple OSS Distributions 
293*c54f35caSApple OSS Distributions /*
294*c54f35caSApple OSS Distributions  * KDP_MAXBYTES
295*c54f35caSApple OSS Distributions  */
296*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_MAXBYTES request */
297*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
298*c54f35caSApple OSS Distributions } KDP_PACKED kdp_maxbytes_req_t;
299*c54f35caSApple OSS Distributions 
300*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_MAXBYTES reply */
301*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
302*c54f35caSApple OSS Distributions 	uint32_t        max_bytes;
303*c54f35caSApple OSS Distributions } KDP_PACKED kdp_maxbytes_reply_t;
304*c54f35caSApple OSS Distributions 
305*c54f35caSApple OSS Distributions /*
306*c54f35caSApple OSS Distributions  * KDP_READMEM
307*c54f35caSApple OSS Distributions  */
308*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_READMEM request */
309*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
310*c54f35caSApple OSS Distributions 	uint32_t        address;
311*c54f35caSApple OSS Distributions 	uint32_t        nbytes;
312*c54f35caSApple OSS Distributions } KDP_PACKED kdp_readmem_req_t;
313*c54f35caSApple OSS Distributions 
314*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_READMEM reply */
315*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
316*c54f35caSApple OSS Distributions 	kdp_error_t     error;
317*c54f35caSApple OSS Distributions 	char            data[0];
318*c54f35caSApple OSS Distributions } KDP_PACKED kdp_readmem_reply_t;
319*c54f35caSApple OSS Distributions 
320*c54f35caSApple OSS Distributions /*
321*c54f35caSApple OSS Distributions  * KDP_READMEM64
322*c54f35caSApple OSS Distributions  */
323*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_READMEM64 request */
324*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
325*c54f35caSApple OSS Distributions 	uint64_t        address;
326*c54f35caSApple OSS Distributions 	uint32_t        nbytes;
327*c54f35caSApple OSS Distributions } KDP_PACKED kdp_readmem64_req_t;
328*c54f35caSApple OSS Distributions 
329*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_READMEM64 reply */
330*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
331*c54f35caSApple OSS Distributions 	kdp_error_t     error;
332*c54f35caSApple OSS Distributions 	char            data[0];
333*c54f35caSApple OSS Distributions } KDP_PACKED kdp_readmem64_reply_t;
334*c54f35caSApple OSS Distributions 
335*c54f35caSApple OSS Distributions /*
336*c54f35caSApple OSS Distributions  * KDP_READPHYSMEM64
337*c54f35caSApple OSS Distributions  */
338*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_READPHYSMEM64 request */
339*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
340*c54f35caSApple OSS Distributions 	uint64_t        address;
341*c54f35caSApple OSS Distributions 	uint32_t        nbytes;
342*c54f35caSApple OSS Distributions 	uint16_t        lcpu;
343*c54f35caSApple OSS Distributions } KDP_PACKED kdp_readphysmem64_req_t;
344*c54f35caSApple OSS Distributions 
345*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_READPHYSMEM64 reply */
346*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
347*c54f35caSApple OSS Distributions 	kdp_error_t     error;
348*c54f35caSApple OSS Distributions 	char            data[0];
349*c54f35caSApple OSS Distributions } KDP_PACKED kdp_readphysmem64_reply_t;
350*c54f35caSApple OSS Distributions 
351*c54f35caSApple OSS Distributions /*
352*c54f35caSApple OSS Distributions  * KDP_WRITEMEM
353*c54f35caSApple OSS Distributions  */
354*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_WRITEMEM request */
355*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
356*c54f35caSApple OSS Distributions 	uint32_t        address;
357*c54f35caSApple OSS Distributions 	uint32_t        nbytes;
358*c54f35caSApple OSS Distributions 	char            data[0];
359*c54f35caSApple OSS Distributions } KDP_PACKED kdp_writemem_req_t;
360*c54f35caSApple OSS Distributions 
361*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_WRITEMEM reply */
362*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
363*c54f35caSApple OSS Distributions 	kdp_error_t     error;
364*c54f35caSApple OSS Distributions } KDP_PACKED kdp_writemem_reply_t;
365*c54f35caSApple OSS Distributions 
366*c54f35caSApple OSS Distributions /*
367*c54f35caSApple OSS Distributions  * KDP_WRITEMEM64
368*c54f35caSApple OSS Distributions  */
369*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_WRITEMEM64 request */
370*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
371*c54f35caSApple OSS Distributions 	uint64_t        address;
372*c54f35caSApple OSS Distributions 	uint32_t        nbytes;
373*c54f35caSApple OSS Distributions 	char            data[0];
374*c54f35caSApple OSS Distributions } KDP_PACKED kdp_writemem64_req_t;
375*c54f35caSApple OSS Distributions 
376*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_WRITEMEM64 reply */
377*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
378*c54f35caSApple OSS Distributions 	kdp_error_t     error;
379*c54f35caSApple OSS Distributions } KDP_PACKED kdp_writemem64_reply_t;
380*c54f35caSApple OSS Distributions 
381*c54f35caSApple OSS Distributions /*
382*c54f35caSApple OSS Distributions  * KDP_WRITEPHYSMEM64
383*c54f35caSApple OSS Distributions  */
384*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_WRITEPHYSMEM64 request */
385*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
386*c54f35caSApple OSS Distributions 	uint64_t        address;
387*c54f35caSApple OSS Distributions 	uint32_t        nbytes;
388*c54f35caSApple OSS Distributions 	uint16_t        lcpu;
389*c54f35caSApple OSS Distributions 	char            data[0];
390*c54f35caSApple OSS Distributions } KDP_PACKED kdp_writephysmem64_req_t;
391*c54f35caSApple OSS Distributions 
392*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_WRITEPHYSMEM64 reply */
393*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
394*c54f35caSApple OSS Distributions 	kdp_error_t     error;
395*c54f35caSApple OSS Distributions } KDP_PACKED kdp_writephysmem64_reply_t;
396*c54f35caSApple OSS Distributions 
397*c54f35caSApple OSS Distributions /*
398*c54f35caSApple OSS Distributions  * KDP_WRITEIOPORT
399*c54f35caSApple OSS Distributions  */
400*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_WRITEIOPORT request */
401*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
402*c54f35caSApple OSS Distributions 	uint16_t        lcpu;
403*c54f35caSApple OSS Distributions 	uint16_t        address;
404*c54f35caSApple OSS Distributions 	uint16_t        nbytes;
405*c54f35caSApple OSS Distributions 	char            data[0];
406*c54f35caSApple OSS Distributions } KDP_PACKED kdp_writeioport_req_t;
407*c54f35caSApple OSS Distributions 
408*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_WRITEIOPORT reply */
409*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
410*c54f35caSApple OSS Distributions 	kdp_error_t     error;
411*c54f35caSApple OSS Distributions } KDP_PACKED kdp_writeioport_reply_t;
412*c54f35caSApple OSS Distributions 
413*c54f35caSApple OSS Distributions /*
414*c54f35caSApple OSS Distributions  * KDP_READIOPORT
415*c54f35caSApple OSS Distributions  */
416*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_READIOPORT request */
417*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
418*c54f35caSApple OSS Distributions 	uint16_t        lcpu;
419*c54f35caSApple OSS Distributions 	uint16_t        address;
420*c54f35caSApple OSS Distributions 	uint16_t        nbytes;
421*c54f35caSApple OSS Distributions } KDP_PACKED kdp_readioport_req_t;
422*c54f35caSApple OSS Distributions 
423*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_READIOPORT reply */
424*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
425*c54f35caSApple OSS Distributions 	kdp_error_t     error;
426*c54f35caSApple OSS Distributions 	char            data[0];
427*c54f35caSApple OSS Distributions } KDP_PACKED kdp_readioport_reply_t;
428*c54f35caSApple OSS Distributions 
429*c54f35caSApple OSS Distributions 
430*c54f35caSApple OSS Distributions /*
431*c54f35caSApple OSS Distributions  * KDP_WRITEMSR64
432*c54f35caSApple OSS Distributions  */
433*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_WRITEMSR64 request */
434*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
435*c54f35caSApple OSS Distributions 	uint32_t        address;
436*c54f35caSApple OSS Distributions 	uint16_t        lcpu;
437*c54f35caSApple OSS Distributions 	char            data[0];
438*c54f35caSApple OSS Distributions } KDP_PACKED kdp_writemsr64_req_t;
439*c54f35caSApple OSS Distributions 
440*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_WRITEMSR64 reply */
441*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
442*c54f35caSApple OSS Distributions 	kdp_error_t     error;
443*c54f35caSApple OSS Distributions } KDP_PACKED kdp_writemsr64_reply_t;
444*c54f35caSApple OSS Distributions 
445*c54f35caSApple OSS Distributions /*
446*c54f35caSApple OSS Distributions  * KDP_READMSR64
447*c54f35caSApple OSS Distributions  */
448*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_READMSR64 request */
449*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
450*c54f35caSApple OSS Distributions 	uint32_t        address;
451*c54f35caSApple OSS Distributions 	uint16_t        lcpu;
452*c54f35caSApple OSS Distributions } KDP_PACKED kdp_readmsr64_req_t;
453*c54f35caSApple OSS Distributions 
454*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_READMSR64 reply */
455*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
456*c54f35caSApple OSS Distributions 	kdp_error_t     error;
457*c54f35caSApple OSS Distributions 	char            data[0];
458*c54f35caSApple OSS Distributions } KDP_PACKED kdp_readmsr64_reply_t;
459*c54f35caSApple OSS Distributions 
460*c54f35caSApple OSS Distributions 
461*c54f35caSApple OSS Distributions /*
462*c54f35caSApple OSS Distributions  * KDP_READREGS
463*c54f35caSApple OSS Distributions  */
464*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_READREGS request */
465*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
466*c54f35caSApple OSS Distributions 	uint32_t        cpu;
467*c54f35caSApple OSS Distributions 	uint32_t        flavor;
468*c54f35caSApple OSS Distributions } KDP_PACKED kdp_readregs_req_t;
469*c54f35caSApple OSS Distributions 
470*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_READREGS reply */
471*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
472*c54f35caSApple OSS Distributions 	kdp_error_t     error;          /* could be KDPERR_BADFLAVOR */
473*c54f35caSApple OSS Distributions 	char            data[0];
474*c54f35caSApple OSS Distributions } KDP_PACKED kdp_readregs_reply_t;
475*c54f35caSApple OSS Distributions 
476*c54f35caSApple OSS Distributions /*
477*c54f35caSApple OSS Distributions  * KDP_WRITEREGS
478*c54f35caSApple OSS Distributions  */
479*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_WRITEREGS request */
480*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
481*c54f35caSApple OSS Distributions 	uint32_t        cpu;
482*c54f35caSApple OSS Distributions 	uint32_t        flavor;
483*c54f35caSApple OSS Distributions 	char            data[0];
484*c54f35caSApple OSS Distributions } KDP_PACKED kdp_writeregs_req_t;
485*c54f35caSApple OSS Distributions 
486*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_WRITEREGS reply */
487*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
488*c54f35caSApple OSS Distributions 	kdp_error_t     error;
489*c54f35caSApple OSS Distributions } KDP_PACKED kdp_writeregs_reply_t;
490*c54f35caSApple OSS Distributions 
491*c54f35caSApple OSS Distributions /*
492*c54f35caSApple OSS Distributions  * KDP_LOAD
493*c54f35caSApple OSS Distributions  */
494*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_LOAD request */
495*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
496*c54f35caSApple OSS Distributions 	char            file_args[0];
497*c54f35caSApple OSS Distributions } KDP_PACKED kdp_load_req_t;
498*c54f35caSApple OSS Distributions 
499*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_LOAD reply */
500*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
501*c54f35caSApple OSS Distributions 	kdp_error_t     error;
502*c54f35caSApple OSS Distributions } KDP_PACKED kdp_load_reply_t;
503*c54f35caSApple OSS Distributions 
504*c54f35caSApple OSS Distributions /*
505*c54f35caSApple OSS Distributions  * KDP_IMAGEPATH
506*c54f35caSApple OSS Distributions  */
507*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_IMAGEPATH request */
508*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
509*c54f35caSApple OSS Distributions } KDP_PACKED kdp_imagepath_req_t;
510*c54f35caSApple OSS Distributions 
511*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_IMAGEPATH reply */
512*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
513*c54f35caSApple OSS Distributions 	char            path[0];
514*c54f35caSApple OSS Distributions } KDP_PACKED kdp_imagepath_reply_t;
515*c54f35caSApple OSS Distributions 
516*c54f35caSApple OSS Distributions /*
517*c54f35caSApple OSS Distributions  * KDP_SUSPEND
518*c54f35caSApple OSS Distributions  */
519*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_SUSPEND request */
520*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
521*c54f35caSApple OSS Distributions } KDP_PACKED kdp_suspend_req_t;
522*c54f35caSApple OSS Distributions 
523*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_SUSPEND reply */
524*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
525*c54f35caSApple OSS Distributions } KDP_PACKED kdp_suspend_reply_t;
526*c54f35caSApple OSS Distributions 
527*c54f35caSApple OSS Distributions /*
528*c54f35caSApple OSS Distributions  * KDP_RESUMECPUS
529*c54f35caSApple OSS Distributions  */
530*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_RESUMECPUS request */
531*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
532*c54f35caSApple OSS Distributions 	uint32_t        cpu_mask;
533*c54f35caSApple OSS Distributions } KDP_PACKED kdp_resumecpus_req_t;
534*c54f35caSApple OSS Distributions 
535*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_RESUMECPUS reply */
536*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
537*c54f35caSApple OSS Distributions } KDP_PACKED kdp_resumecpus_reply_t;
538*c54f35caSApple OSS Distributions 
539*c54f35caSApple OSS Distributions /*
540*c54f35caSApple OSS Distributions  * KDP_BREAKPOINT_SET and KDP_BREAKPOINT_REMOVE
541*c54f35caSApple OSS Distributions  */
542*c54f35caSApple OSS Distributions 
543*c54f35caSApple OSS Distributions typedef struct {
544*c54f35caSApple OSS Distributions 	kdp_hdr_t hdr;
545*c54f35caSApple OSS Distributions 	uint32_t      address;
546*c54f35caSApple OSS Distributions } KDP_PACKED kdp_breakpoint_req_t;
547*c54f35caSApple OSS Distributions 
548*c54f35caSApple OSS Distributions typedef struct {
549*c54f35caSApple OSS Distributions 	kdp_hdr_t hdr;
550*c54f35caSApple OSS Distributions 	kdp_error_t error;
551*c54f35caSApple OSS Distributions } KDP_PACKED kdp_breakpoint_reply_t;
552*c54f35caSApple OSS Distributions 
553*c54f35caSApple OSS Distributions /*
554*c54f35caSApple OSS Distributions  * KDP_BREAKPOINT64_SET and KDP_BREAKPOINT64_REMOVE
555*c54f35caSApple OSS Distributions  */
556*c54f35caSApple OSS Distributions 
557*c54f35caSApple OSS Distributions typedef struct {
558*c54f35caSApple OSS Distributions 	kdp_hdr_t hdr;
559*c54f35caSApple OSS Distributions 	uint64_t        address;
560*c54f35caSApple OSS Distributions } KDP_PACKED kdp_breakpoint64_req_t;
561*c54f35caSApple OSS Distributions 
562*c54f35caSApple OSS Distributions typedef struct {
563*c54f35caSApple OSS Distributions 	kdp_hdr_t hdr;
564*c54f35caSApple OSS Distributions 	kdp_error_t error;
565*c54f35caSApple OSS Distributions } KDP_PACKED kdp_breakpoint64_reply_t;
566*c54f35caSApple OSS Distributions 
567*c54f35caSApple OSS Distributions /*
568*c54f35caSApple OSS Distributions  * Exception notifications
569*c54f35caSApple OSS Distributions  * (Exception notifications are not requests, and in fact travel from
570*c54f35caSApple OSS Distributions  * the remote debugger to the gdb agent KDB.)
571*c54f35caSApple OSS Distributions  */
572*c54f35caSApple OSS Distributions typedef struct {                        /* exc. info for one cpu */
573*c54f35caSApple OSS Distributions 	uint32_t        cpu;
574*c54f35caSApple OSS Distributions 	/*
575*c54f35caSApple OSS Distributions 	 * Following info is defined as
576*c54f35caSApple OSS Distributions 	 * per <mach/exception.h>
577*c54f35caSApple OSS Distributions 	 */
578*c54f35caSApple OSS Distributions 	uint32_t        exception;
579*c54f35caSApple OSS Distributions 	uint32_t        code;
580*c54f35caSApple OSS Distributions 	uint32_t        subcode;
581*c54f35caSApple OSS Distributions } KDP_PACKED kdp_exc_info_t;
582*c54f35caSApple OSS Distributions 
583*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_EXCEPTION notification */
584*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
585*c54f35caSApple OSS Distributions 	uint32_t        n_exc_info;
586*c54f35caSApple OSS Distributions 	kdp_exc_info_t  exc_info[0];
587*c54f35caSApple OSS Distributions } KDP_PACKED kdp_exception_t;
588*c54f35caSApple OSS Distributions 
589*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_EXCEPTION acknowledgement */
590*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
591*c54f35caSApple OSS Distributions } KDP_PACKED kdp_exception_ack_t;
592*c54f35caSApple OSS Distributions 
593*c54f35caSApple OSS Distributions /*
594*c54f35caSApple OSS Distributions  * KDP_KERNELVERSION
595*c54f35caSApple OSS Distributions  */
596*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_KERNELVERSION request */
597*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
598*c54f35caSApple OSS Distributions } KDP_PACKED kdp_kernelversion_req_t;
599*c54f35caSApple OSS Distributions 
600*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_KERNELVERSION reply */
601*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
602*c54f35caSApple OSS Distributions 	char            version[0];
603*c54f35caSApple OSS Distributions } KDP_PACKED kdp_kernelversion_reply_t;
604*c54f35caSApple OSS Distributions 
605*c54f35caSApple OSS Distributions 
606*c54f35caSApple OSS Distributions /*
607*c54f35caSApple OSS Distributions  * Child termination messages
608*c54f35caSApple OSS Distributions  */
609*c54f35caSApple OSS Distributions typedef enum {
610*c54f35caSApple OSS Distributions 	KDP_FAULT = 0,          /* child took fault (internal use) */
611*c54f35caSApple OSS Distributions 	KDP_EXIT,               /* child exited */
612*c54f35caSApple OSS Distributions 	KDP_POWEROFF,           /* child power-off */
613*c54f35caSApple OSS Distributions 	KDP_REBOOT,             /* child reboot */
614*c54f35caSApple OSS Distributions 	KDP_COMMAND_MODE        /* child exit to mon command_mode */
615*c54f35caSApple OSS Distributions } kdp_termination_code_t;
616*c54f35caSApple OSS Distributions 
617*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_TERMINATION notification */
618*c54f35caSApple OSS Distributions 	kdp_hdr_t               hdr;
619*c54f35caSApple OSS Distributions 	uint32_t                term_code;      /* kdp_termination_code_t */
620*c54f35caSApple OSS Distributions 	uint32_t                exit_code;
621*c54f35caSApple OSS Distributions } KDP_PACKED kdp_termination_t;
622*c54f35caSApple OSS Distributions 
623*c54f35caSApple OSS Distributions typedef struct {
624*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
625*c54f35caSApple OSS Distributions } KDP_PACKED kdp_termination_ack_t;
626*c54f35caSApple OSS Distributions 
627*c54f35caSApple OSS Distributions /*
628*c54f35caSApple OSS Distributions  * KDP_DUMPINFO
629*c54f35caSApple OSS Distributions  */
630*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_DUMPINFO request */
631*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
632*c54f35caSApple OSS Distributions 	char            name[50];
633*c54f35caSApple OSS Distributions 	char            destip[16];
634*c54f35caSApple OSS Distributions 	char            routerip[16];
635*c54f35caSApple OSS Distributions 	uint32_t        port;
636*c54f35caSApple OSS Distributions 	kdp_dumpinfo_t  type;
637*c54f35caSApple OSS Distributions } KDP_PACKED kdp_dumpinfo_req_t;
638*c54f35caSApple OSS Distributions 
639*c54f35caSApple OSS Distributions typedef struct {                        /* KDP_DUMPINFO reply */
640*c54f35caSApple OSS Distributions 	kdp_hdr_t       hdr;
641*c54f35caSApple OSS Distributions 	char            name[50];
642*c54f35caSApple OSS Distributions 	char            destip[16];
643*c54f35caSApple OSS Distributions 	char            routerip[16];
644*c54f35caSApple OSS Distributions 	uint32_t        port;
645*c54f35caSApple OSS Distributions 	kdp_dumpinfo_t  type;
646*c54f35caSApple OSS Distributions } KDP_PACKED kdp_dumpinfo_reply_t;
647*c54f35caSApple OSS Distributions 
648*c54f35caSApple OSS Distributions 
649*c54f35caSApple OSS Distributions typedef union {
650*c54f35caSApple OSS Distributions 	kdp_hdr_t               hdr;
651*c54f35caSApple OSS Distributions 	kdp_connect_req_t       connect_req;
652*c54f35caSApple OSS Distributions 	kdp_connect_reply_t     connect_reply;
653*c54f35caSApple OSS Distributions 	kdp_disconnect_req_t    disconnect_req;
654*c54f35caSApple OSS Distributions 	kdp_disconnect_reply_t  disconnect_reply;
655*c54f35caSApple OSS Distributions 	kdp_hostinfo_req_t      hostinfo_req;
656*c54f35caSApple OSS Distributions 	kdp_hostinfo_reply_t    hostinfo_reply;
657*c54f35caSApple OSS Distributions 	kdp_version_req_t       version_req;
658*c54f35caSApple OSS Distributions 	kdp_version_reply_t     version_reply;
659*c54f35caSApple OSS Distributions 	kdp_maxbytes_req_t      maxbytes_req;
660*c54f35caSApple OSS Distributions 	kdp_maxbytes_reply_t    maxbytes_reply;
661*c54f35caSApple OSS Distributions 	kdp_readmem_req_t       readmem_req;
662*c54f35caSApple OSS Distributions 	kdp_readmem_reply_t     readmem_reply;
663*c54f35caSApple OSS Distributions 	kdp_readmem64_req_t     readmem64_req;
664*c54f35caSApple OSS Distributions 	kdp_readmem64_reply_t   readmem64_reply;
665*c54f35caSApple OSS Distributions 	kdp_readphysmem64_req_t readphysmem64_req;
666*c54f35caSApple OSS Distributions 	kdp_readphysmem64_reply_t       readphysmem64_reply;
667*c54f35caSApple OSS Distributions 	kdp_writemem_req_t      writemem_req;
668*c54f35caSApple OSS Distributions 	kdp_writemem_reply_t    writemem_reply;
669*c54f35caSApple OSS Distributions 	kdp_writemem64_req_t    writemem64_req;
670*c54f35caSApple OSS Distributions 	kdp_writemem64_reply_t  writemem64_reply;
671*c54f35caSApple OSS Distributions 	kdp_writephysmem64_req_t        writephysmem64_req;
672*c54f35caSApple OSS Distributions 	kdp_writephysmem64_reply_t      writephysmem64_reply;
673*c54f35caSApple OSS Distributions 	kdp_readregs_req_t      readregs_req;
674*c54f35caSApple OSS Distributions 	kdp_readregs_reply_t    readregs_reply;
675*c54f35caSApple OSS Distributions 	kdp_writeregs_req_t     writeregs_req;
676*c54f35caSApple OSS Distributions 	kdp_writeregs_reply_t   writeregs_reply;
677*c54f35caSApple OSS Distributions 	kdp_load_req_t          load_req;
678*c54f35caSApple OSS Distributions 	kdp_load_reply_t        load_reply;
679*c54f35caSApple OSS Distributions 	kdp_imagepath_req_t     imagepath_req;
680*c54f35caSApple OSS Distributions 	kdp_imagepath_reply_t   imagepath_reply;
681*c54f35caSApple OSS Distributions 	kdp_suspend_req_t       suspend_req;
682*c54f35caSApple OSS Distributions 	kdp_suspend_reply_t     suspend_reply;
683*c54f35caSApple OSS Distributions 	kdp_resumecpus_req_t    resumecpus_req;
684*c54f35caSApple OSS Distributions 	kdp_resumecpus_reply_t  resumecpus_reply;
685*c54f35caSApple OSS Distributions 	kdp_exception_t         exception;
686*c54f35caSApple OSS Distributions 	kdp_exception_ack_t     exception_ack;
687*c54f35caSApple OSS Distributions 	kdp_termination_t       termination;
688*c54f35caSApple OSS Distributions 	kdp_termination_ack_t   termination_ack;
689*c54f35caSApple OSS Distributions 	kdp_breakpoint_req_t    breakpoint_req;
690*c54f35caSApple OSS Distributions 	kdp_breakpoint_reply_t  breakpoint_reply;
691*c54f35caSApple OSS Distributions 	kdp_breakpoint64_req_t  breakpoint64_req;
692*c54f35caSApple OSS Distributions 	kdp_breakpoint64_reply_t        breakpoint64_reply;
693*c54f35caSApple OSS Distributions 	kdp_reattach_req_t      reattach_req;
694*c54f35caSApple OSS Distributions 	kdp_regions_req_t       regions_req;
695*c54f35caSApple OSS Distributions 	kdp_regions_reply_t     regions_reply;
696*c54f35caSApple OSS Distributions 	kdp_kernelversion_req_t kernelversion_req;
697*c54f35caSApple OSS Distributions 	kdp_kernelversion_reply_t       kernelversion_reply;
698*c54f35caSApple OSS Distributions 	kdp_readioport_req_t    readioport_req;
699*c54f35caSApple OSS Distributions 	kdp_readioport_reply_t  readioport_reply;
700*c54f35caSApple OSS Distributions 	kdp_writeioport_req_t   writeioport_req;
701*c54f35caSApple OSS Distributions 	kdp_writeioport_reply_t writeioport_reply;
702*c54f35caSApple OSS Distributions 	kdp_readmsr64_req_t     readmsr64_req;
703*c54f35caSApple OSS Distributions 	kdp_readmsr64_reply_t   readmsr64_reply;
704*c54f35caSApple OSS Distributions 	kdp_writemsr64_req_t    writemsr64_req;
705*c54f35caSApple OSS Distributions 	kdp_writemsr64_reply_t  writemsr64_reply;
706*c54f35caSApple OSS Distributions 	kdp_dumpinfo_req_t      dumpinfo_req;
707*c54f35caSApple OSS Distributions 	kdp_dumpinfo_reply_t    dumpinfo_reply;
708*c54f35caSApple OSS Distributions } kdp_pkt_t;
709*c54f35caSApple OSS Distributions 
710*c54f35caSApple OSS Distributions #define MAX_KDP_PKT_SIZE        1200    /* max packet size */
711*c54f35caSApple OSS Distributions #define MAX_KDP_DATA_SIZE       1024    /* max r/w data per packet */
712*c54f35caSApple OSS Distributions 
713*c54f35caSApple OSS Distributions /*
714*c54f35caSApple OSS Distributions  * Support relatively small request/responses here.
715*c54f35caSApple OSS Distributions  * If kgmacros needs to make a larger request, increase
716*c54f35caSApple OSS Distributions  * this buffer size
717*c54f35caSApple OSS Distributions  */
718*c54f35caSApple OSS Distributions #define KDP_MANUAL_PACKET_SIZE 128
719*c54f35caSApple OSS Distributions struct kdp_manual_pkt {
720*c54f35caSApple OSS Distributions 	unsigned char       data[KDP_MANUAL_PACKET_SIZE];
721*c54f35caSApple OSS Distributions 	unsigned int        len;
722*c54f35caSApple OSS Distributions 	boolean_t           input;
723*c54f35caSApple OSS Distributions } KDP_PACKED;
724*c54f35caSApple OSS Distributions 
725*c54f35caSApple OSS Distributions #ifdef KDP_PROXY_PACK_SUPPORT
726*c54f35caSApple OSS Distributions #pragma pack()
727*c54f35caSApple OSS Distributions #endif
728*c54f35caSApple OSS Distributions 
729*c54f35caSApple OSS Distributions #endif // _KDP_PROTOCOL_H_
730