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