xref: /openbsd-src/sys/arch/amd64/include/sysarch.h (revision d13be5d47e4149db2549a9828e244d59dbc43f15)
1 /*	$OpenBSD: sysarch.h,v 1.10 2011/04/13 02:49:12 guenther 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_get_ioperm_args {
25 	u_long *iomap;
26 };
27 
28 struct amd64_set_ioperm_args {
29 	u_long *iomap;
30 };
31 
32 struct amd64_pmc_info_args {
33 	int	type;
34 	int	flags;
35 };
36 
37 #define	PMC_TYPE_NONE		0
38 #define	PMC_TYPE_I586		1
39 #define	PMC_TYPE_I686		2
40 
41 #define	PMC_INFO_HASTSC		0x01
42 
43 #define	PMC_NCOUNTERS		2
44 
45 struct amd64_pmc_startstop_args {
46 	int counter;
47 	u_int64_t val;
48 	u_int8_t event;
49 	u_int8_t unit;
50 	u_int8_t compare;
51 	u_int8_t flags;
52 };
53 
54 #define	PMC_SETUP_KERNEL	0x01
55 #define	PMC_SETUP_USER		0x02
56 #define	PMC_SETUP_EDGE		0x04
57 #define	PMC_SETUP_INV		0x08
58 
59 struct amd64_pmc_read_args {
60 	int counter;
61 	u_int64_t val;
62 	u_int64_t time;
63 };
64 
65 
66 #ifdef _KERNEL
67 int amd64_iopl(struct proc *, void *, register_t *);
68 int amd64_set_fsbase(struct proc *, void *);
69 int amd64_get_fsbase(struct proc *, void *);
70 #else
71 int amd64_iopl(int);
72 int amd64_get_ioperm(u_long *);
73 int amd64_set_ioperm(u_long *);
74 int amd64_pmc_info(struct amd64_pmc_info_args *);
75 int amd64_pmc_startstop(struct amd64_pmc_startstop_args *);
76 int amd64_pmc_read(struct amd64_pmc_read_args *);
77 int amd64_set_fsbase(void *);
78 int amd64_get_fsbase(void **);
79 int sysarch(int, void *);
80 #endif
81 
82 #endif /* !_MACHINE_SYSARCH_H_ */
83