xref: /onnv-gate/usr/src/cmd/mdb/intel/kmdb/kaif.h (revision 2712:f74a135872bc)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*2712Snn35248  * Common Development and Distribution License (the "License").
6*2712Snn35248  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*2712Snn35248  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _KAIF_H
270Sstevel@tonic-gate #define	_KAIF_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifndef _ASM
320Sstevel@tonic-gate #include <sys/kdi.h>
330Sstevel@tonic-gate #include <sys/types.h>
340Sstevel@tonic-gate #include <sys/segments.h>
350Sstevel@tonic-gate #include <kmdb/kaif_regs.h>
360Sstevel@tonic-gate #endif
370Sstevel@tonic-gate 
380Sstevel@tonic-gate #ifdef __cplusplus
390Sstevel@tonic-gate extern "C" {
400Sstevel@tonic-gate #endif
410Sstevel@tonic-gate 
420Sstevel@tonic-gate #define	KAIF_MASTER_CPUID_UNSET		-1
430Sstevel@tonic-gate 
440Sstevel@tonic-gate #define	KAIF_CPU_CMD_RESUME		0
450Sstevel@tonic-gate #define	KAIF_CPU_CMD_RESUME_MASTER	1
460Sstevel@tonic-gate #define	KAIF_CPU_CMD_SWITCH		2
470Sstevel@tonic-gate #define	KAIF_CPU_CMD_PASS_TO_KERNEL	3
480Sstevel@tonic-gate #define	KAIF_CPU_CMD_REBOOT		4
490Sstevel@tonic-gate 
500Sstevel@tonic-gate #define	KAIF_CPU_STATE_NONE		0
510Sstevel@tonic-gate #define	KAIF_CPU_STATE_MASTER		1
520Sstevel@tonic-gate #define	KAIF_CPU_STATE_SLAVE		2
530Sstevel@tonic-gate 
540Sstevel@tonic-gate #ifndef _ASM
550Sstevel@tonic-gate 
560Sstevel@tonic-gate typedef struct kaif_memrange {
570Sstevel@tonic-gate 	caddr_t mr_base;
580Sstevel@tonic-gate 	caddr_t mr_lim;
590Sstevel@tonic-gate } kaif_memrange_t;
600Sstevel@tonic-gate 
610Sstevel@tonic-gate extern kaif_memrange_t kaif_memranges[];
620Sstevel@tonic-gate extern int kaif_nmemranges;
630Sstevel@tonic-gate 
640Sstevel@tonic-gate extern kaif_cpusave_t *kaif_cpusave;
650Sstevel@tonic-gate extern int kaif_ncpusave;
660Sstevel@tonic-gate extern int kaif_master_cpuid;
670Sstevel@tonic-gate 
680Sstevel@tonic-gate extern uint32_t kaif_cs;
690Sstevel@tonic-gate extern uint32_t	kaif_ds;
700Sstevel@tonic-gate extern uint32_t	kaif_fs;
710Sstevel@tonic-gate extern uint32_t	kaif_gs;
720Sstevel@tonic-gate 
730Sstevel@tonic-gate extern char kaif_slave_entry_patch;
740Sstevel@tonic-gate 
750Sstevel@tonic-gate extern struct gate_desc kaif_idt[];
760Sstevel@tonic-gate extern desctbr_t kaif_idtr;
770Sstevel@tonic-gate extern size_t kaif_ivct_size;
780Sstevel@tonic-gate extern int kaif_trap_switch;
790Sstevel@tonic-gate 
800Sstevel@tonic-gate extern uintptr_t kaif_kernel_handler;
810Sstevel@tonic-gate extern uintptr_t kaif_sys_sysenter;
82*2712Snn35248 extern uintptr_t kaif_brand_sys_sysenter;
830Sstevel@tonic-gate 
840Sstevel@tonic-gate extern void kaif_trap_set_debugger(void);
850Sstevel@tonic-gate extern void kaif_trap_set_saved(kaif_cpusave_t *);
860Sstevel@tonic-gate 
870Sstevel@tonic-gate extern uintptr_t kaif_invoke(uintptr_t, uint_t, const uintptr_t[]);
880Sstevel@tonic-gate 
890Sstevel@tonic-gate extern void kaif_nmiint(void);
900Sstevel@tonic-gate extern void kaif_cmnint(void);
910Sstevel@tonic-gate extern void kaif_enter(void);
920Sstevel@tonic-gate extern void kaif_slave_entry(void);
930Sstevel@tonic-gate extern int kaif_debugger_entry(kaif_cpusave_t *);
940Sstevel@tonic-gate 
950Sstevel@tonic-gate extern void kaif_mod_loaded(struct modctl *);
960Sstevel@tonic-gate extern void kaif_mod_unloading(struct modctl *);
970Sstevel@tonic-gate 
980Sstevel@tonic-gate extern void kaif_cpu_debug_init(kaif_cpusave_t *);
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate extern void kaif_idt_init(void);
1010Sstevel@tonic-gate extern void kaif_idt_write(gate_desc_t *, uint_t);
1020Sstevel@tonic-gate extern void kaif_idt_patch(caddr_t, size_t);
1030Sstevel@tonic-gate extern uintptr_t kaif_kernel_trap2hdlr(int);
1040Sstevel@tonic-gate 
1050Sstevel@tonic-gate extern void kaif_activate(kdi_debugvec_t **, uint_t);
1060Sstevel@tonic-gate extern void kaif_deactivate(void);
1070Sstevel@tonic-gate 
1080Sstevel@tonic-gate extern int kaif_memrange_add(caddr_t, size_t);
1090Sstevel@tonic-gate 
1100Sstevel@tonic-gate extern void get_idt(desctbr_t *);
1110Sstevel@tonic-gate extern void set_idt(desctbr_t *);
1120Sstevel@tonic-gate 
1130Sstevel@tonic-gate #endif
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate #ifdef __cplusplus
1160Sstevel@tonic-gate }
1170Sstevel@tonic-gate #endif
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate #endif /* _KAIF_H */
120