xref: /openbsd/sys/arch/amd64/include/sysarch.h (revision 91f110e0)
1 /*	$OpenBSD: sysarch.h,v 1.13 2013/05/05 19:25:57 tedu Exp $	*/
2 /*	$NetBSD: sysarch.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $	*/
3 
4 #ifndef _MACHINE_SYSARCH_H_
5 #define _MACHINE_SYSARCH_H_
6 
7 /*
8  * Architecture specific syscalls (amd64)
9  */
10 #define	AMD64_IOPL		2
11 #define	AMD64_GET_IOPERM	3
12 #define	AMD64_SET_IOPERM	4
13 #define	AMD64_VM86		5
14 #define	AMD64_PMC_INFO		8
15 #define	AMD64_PMC_STARTSTOP	9
16 #define	AMD64_PMC_READ		10
17 #define	AMD64_GET_FSBASE	11
18 #define	AMD64_SET_FSBASE	12
19 
20 struct amd64_iopl_args {
21 	int iopl;
22 };
23 
24 struct amd64_pmc_info_args {
25 	int	type;
26 	int	flags;
27 };
28 
29 #define	PMC_TYPE_NONE		0
30 #define	PMC_TYPE_I586		1
31 #define	PMC_TYPE_I686		2
32 
33 #define	PMC_INFO_HASTSC		0x01
34 
35 #define	PMC_NCOUNTERS		2
36 
37 struct amd64_pmc_startstop_args {
38 	int counter;
39 	u_int64_t val;
40 	u_int8_t event;
41 	u_int8_t unit;
42 	u_int8_t compare;
43 	u_int8_t flags;
44 };
45 
46 #define	PMC_SETUP_KERNEL	0x01
47 #define	PMC_SETUP_USER		0x02
48 #define	PMC_SETUP_EDGE		0x04
49 #define	PMC_SETUP_INV		0x08
50 
51 struct amd64_pmc_read_args {
52 	int counter;
53 	u_int64_t val;
54 	u_int64_t time;
55 };
56 
57 
58 #ifdef _KERNEL
59 int amd64_iopl(struct proc *, void *, register_t *);
60 int amd64_set_fsbase(struct proc *, void *);
61 int amd64_get_fsbase(struct proc *, void *);
62 #else
63 
64 #include <sys/cdefs.h>
65 
66 __BEGIN_DECLS
67 int amd64_iopl(int);
68 int amd64_pmc_info(struct amd64_pmc_info_args *);
69 int amd64_pmc_startstop(struct amd64_pmc_startstop_args *);
70 int amd64_pmc_read(struct amd64_pmc_read_args *);
71 int amd64_set_fsbase(void *);
72 int amd64_get_fsbase(void **);
73 int sysarch(int, void *);
74 __END_DECLS
75 #endif
76 
77 #endif /* !_MACHINE_SYSARCH_H_ */
78