xref: /illumos-gate/usr/src/cmd/mdb/intel/mdb/proc_x86util.h (revision ed093b41a93e8563e6e1e5dae0768dda2a7bcc27)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2023 Oxide Computer Company
14  */
15 
16 #ifndef _PROC_X86UTIL_H
17 #define	_PROC_X86UTIL_H
18 
19 #include <mdb/mdb.h>
20 
21 #include <procfs.h>
22 #include <sys/frame.h>
23 #include <sys/ucontext.h>
24 #include <sys/fp.h>
25 #include <ieeefp.h>
26 
27 /*
28  * Common routines used for x86 proc targets.
29  */
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 typedef enum {
36 	XMM,
37 	YMM,
38 	ZMM
39 } x86_vector_type_t;
40 
41 typedef struct x86_xregs_info {
42 	x86_vector_type_t xri_type;
43 	const prxregset_xcr_t *xri_xcr;
44 	const prxregset_xsave_t *xri_xsave;
45 	const prxregset_ymm_t *xri_ymm;
46 	const prxregset_opmask_t *xri_opmask;
47 	const prxregset_zmm_t *xri_zmm;
48 	const prxregset_hi_zmm_t *xri_hi_zmm;
49 } x86_xregs_info_t;
50 
51 extern int x86_pt_fpregs_common(uintptr_t, uint_t, int, fpregset_t *);
52 extern void x86_pt_fpregs_sse_ctl(uint32_t, uint32_t, char *, size_t);
53 
54 /*
55  * Utility functions for printing x87 / SSE state.
56  */
57 extern const char *fpcw2str(uint32_t, char *, size_t);
58 extern const char *fpsw2str(uint32_t, char *, size_t);
59 extern const char *fpmxcsr2str(uint32_t, char *, size_t);
60 extern const char *fptag2str(uint32_t);
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #endif /* _PROC_X86UTIL_H */
67