xref: /titanic_52/usr/src/uts/intel/sys/kdi_machimpl.h (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_KDI_MACHIMPL_H
28 #define	_SYS_KDI_MACHIMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * The Kernel/Debugger interface.  The operations provided by the kdi_t,
34  * defined below, comprise the Debugger -> Kernel portion of the interface,
35  * and are to be used only when the system has been stopped.
36  */
37 
38 /* The VA range reserved for the debugger. */
39 
40 #include <sys/modctl.h>
41 #include <sys/types.h>
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 typedef struct kdi_mach {
48 	int (*mkdi_get_cpuinfo)(uint_t *, uint_t *, uint_t *);
49 
50 	int (*mkdi_xc_initialized)(void);
51 	void (*mkdi_xc_others)(int, void (*)());
52 
53 	uintptr_t (*mkdi_get_userlimit)(void);
54 
55 	void (*mkdi_idt_init_gate)(struct gate_desc *, void (*)(void), uint_t,
56 	    int);
57 	void (*mkdi_idt_read)(struct gate_desc *, struct gate_desc *, uint_t);
58 	void (*mkdi_idt_write)(struct gate_desc *, struct gate_desc *, uint_t);
59 	struct gate_desc *(*mkdi_cpu2idt)(struct cpu *);
60 
61 	void (**mkdi_shutdownp)(int, int);
62 
63 #if defined(__amd64)
64 	uintptr_t (*mkdi_gdt2gsbase)(uintptr_t);
65 #endif
66 
67 	/* for use only when the kernel is running */
68 	void (*mkdi_cpu_iter)(void (*)(struct cpu *, uint_t),
69 	    uint_t);
70 } kdi_mach_t;
71 
72 #define	mkdi_get_cpuinfo		kdi_mach.mkdi_get_cpuinfo
73 #define	mkdi_xc_initialized		kdi_mach.mkdi_xc_initialized
74 #define	mkdi_xc_others			kdi_mach.mkdi_xc_others
75 #define	mkdi_get_userlimit		kdi_mach.mkdi_get_userlimit
76 #define	mkdi_idt_init_gate		kdi_mach.mkdi_idt_init_gate
77 #define	mkdi_idt_read			kdi_mach.mkdi_idt_read
78 #define	mkdi_idt_write			kdi_mach.mkdi_idt_write
79 #define	mkdi_cpu2idt			kdi_mach.mkdi_cpu2idt
80 #define	mkdi_shutdownp			kdi_mach.mkdi_shutdownp
81 #if defined(__amd64)
82 #define	mkdi_gdt2gsbase			kdi_mach.mkdi_gdt2gsbase
83 #endif
84 #define	mkdi_cpu_iter			kdi_mach.mkdi_cpu_iter
85 
86 extern int kdi_xc_initialized(void);
87 extern void kdi_xc_others(int, void (*)());
88 
89 extern void hat_kdi_init(void);
90 extern void hat_kdi_fini(void);
91 
92 extern uintptr_t kdi_get_userlimit(void);
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif /* _SYS_KDI_MACHIMPL_H */
99