1 /* $NetBSD: sysarch.h,v 1.5 2006/01/07 18:22:25 dsl Exp $ */ 2 3 #ifndef _AMD64_SYSARCH_H_ 4 #define _AMD64_SYSARCH_H_ 5 6 /* 7 * Architecture specific syscalls (amd64) 8 */ 9 #define X86_64_GET_LDT 0 10 #define X86_64_SET_LDT 1 11 #define X86_64_IOPL 2 12 #define X86_64_GET_IOPERM 3 13 #define X86_64_SET_IOPERM 4 14 #define X86_64_VM86 5 15 #define X86_64_PMC_INFO 8 16 #define X86_64_PMC_STARTSTOP 9 17 #define X86_64_PMC_READ 10 18 #define X86_64_GET_MTRR 11 19 #define X86_64_SET_MTRR 12 20 21 /* 22 * XXXfvdl todo. 23 */ 24 25 struct x86_64_get_ldt_args { 26 void *desc; 27 unsigned len; 28 }; 29 30 struct x86_64_set_ldt_args { 31 void *desc; 32 unsigned len; 33 }; 34 35 struct x86_64_iopl_args { 36 int iopl; 37 }; 38 39 #if 0 40 41 struct x86_64_get_ioperm_args { 42 u_long *iomap; 43 }; 44 45 struct x86_64_set_ioperm_args { 46 u_long *iomap; 47 }; 48 49 struct x86_64_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 x86_64_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 x86_64_pmc_read_args { 77 int counter; 78 u_int64_t val; 79 u_int64_t time; 80 }; 81 82 #else 83 /* Silence the build */ 84 struct x86_64_pmc_info_args; 85 struct x86_64_pmc_startstop_args; 86 struct x86_64_pmc_read_args; 87 88 #endif /* todo */ 89 90 struct x86_64_get_mtrr_args { 91 struct mtrr *mtrrp; 92 int *n; 93 }; 94 95 struct x86_64_set_mtrr_args { 96 struct mtrr *mtrrp; 97 int *n; 98 }; 99 100 101 #ifdef _KERNEL 102 int x86_64_iopl(struct lwp *, void *, register_t *); 103 int x86_64_get_mtrr(struct lwp *, void *, register_t *); 104 int x86_64_set_mtrr(struct lwp *, void *, register_t *); 105 #else 106 #include <sys/cdefs.h> 107 108 __BEGIN_DECLS 109 int x86_64_get_ldt(void *, int); 110 int x86_64_set_ldt(void *, int); 111 int x86_64_iopl(int); 112 int x86_64_get_ioperm(u_long *); 113 int x86_64_set_ioperm(u_long *); 114 int x86_64_pmc_info(struct x86_64_pmc_info_args *); 115 int x86_64_pmc_startstop(struct x86_64_pmc_startstop_args *); 116 int x86_64_pmc_read(struct x86_64_pmc_read_args *); 117 int x86_64_set_mtrr(struct mtrr *, int *); 118 int x86_64_get_mtrr(struct mtrr *, int *); 119 int sysarch(int, void *); 120 __END_DECLS 121 #endif 122 123 #endif /* !_AMD64_SYSARCH_H_ */ 124