xref: /openbsd-src/sys/arch/amd64/include/sysarch.h (revision 2b0358df1d88d06ef4139321dd05bd5e05d91eaf)
1 /*	$OpenBSD: sysarch.h,v 1.3 2004/02/27 23:45:55 deraadt Exp $	*/
2 /*	$NetBSD: sysarch.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $	*/
3 
4 #ifndef _AMD64_SYSARCH_H_
5 #define _AMD64_SYSARCH_H_
6 
7 /*
8  * Architecture specific syscalls (amd64)
9  */
10 #define AMD64_GET_LDT	0
11 #define AMD64_SET_LDT	1
12 #define	AMD64_IOPL	2
13 #define	AMD64_GET_IOPERM	3
14 #define	AMD64_SET_IOPERM	4
15 #define	AMD64_VM86	5
16 #define	AMD64_PMC_INFO	8
17 #define	AMD64_PMC_STARTSTOP 9
18 #define	AMD64_PMC_READ	10
19 #define AMD64_GET_MTRR   11
20 #define AMD64_SET_MTRR   12
21 
22 /*
23  * XXX todo.
24  */
25 struct amd64_get_ldt_args {
26 	int start;
27 	union descriptor *desc;
28 	int num;
29 };
30 
31 struct amd64_set_ldt_args {
32 	int start;
33 	union descriptor *desc;
34 	int num;
35 };
36 
37 struct amd64_iopl_args {
38 	int iopl;
39 };
40 
41 struct amd64_get_ioperm_args {
42 	u_long *iomap;
43 };
44 
45 struct amd64_set_ioperm_args {
46 	u_long *iomap;
47 };
48 
49 struct amd64_pmc_info_args {
50 	int	type;
51 	int	flags;
52 };
53 
54 #define	PMC_TYPE_NONE		0
55 #define	PMC_TYPE_I586		1
56 #define	PMC_TYPE_I686		2
57 
58 #define	PMC_INFO_HASTSC		0x01
59 
60 #define	PMC_NCOUNTERS		2
61 
62 struct amd64_pmc_startstop_args {
63 	int counter;
64 	u_int64_t val;
65 	u_int8_t event;
66 	u_int8_t unit;
67 	u_int8_t compare;
68 	u_int8_t flags;
69 };
70 
71 #define	PMC_SETUP_KERNEL	0x01
72 #define	PMC_SETUP_USER		0x02
73 #define	PMC_SETUP_EDGE		0x04
74 #define	PMC_SETUP_INV		0x08
75 
76 struct amd64_pmc_read_args {
77 	int counter;
78 	u_int64_t val;
79 	u_int64_t time;
80 };
81 
82 struct amd64_get_mtrr_args {
83 	struct mtrr *mtrrp;
84 	int *n;
85 };
86 
87 struct amd64_set_mtrr_args {
88 	struct mtrr *mtrrp;
89 	int *n;
90 };
91 
92 
93 #ifdef _KERNEL
94 int amd64_iopl(struct proc *, void *, register_t *);
95 int amd64_get_mtrr(struct proc *, void *, register_t *);
96 int amd64_set_mtrr(struct proc *, void *, register_t *);
97 #else
98 int amd64_get_ldt(int, union descriptor *, int);
99 int amd64_set_ldt(int, union descriptor *, int);
100 int amd64_iopl(int);
101 int amd64_get_ioperm(u_long *);
102 int amd64_set_ioperm(u_long *);
103 int amd64_pmc_info(struct amd64_pmc_info_args *);
104 int amd64_pmc_startstop(struct amd64_pmc_startstop_args *);
105 int amd64_pmc_read(struct amd64_pmc_read_args *);
106 int amd64_set_mtrr(struct mtrr *, int *);
107 int amd64_get_mtrr(struct mtrr *, int *);
108 int sysarch(int, void *);
109 #endif
110 
111 #endif /* !_AMD64_SYSARCH_H_ */
112