xref: /illumos-gate/usr/src/uts/intel/sys/archsystm.h (revision 60405de4d8688d96dd05157c28db3ade5c9bc234)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_ARCHSYSTM_H
27 #define	_SYS_ARCHSYSTM_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * A selection of ISA-dependent interfaces
33  */
34 
35 #include <vm/seg_enum.h>
36 #include <vm/page.h>
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 #ifdef _KERNEL
43 
44 extern greg_t getfp(void);
45 extern int getpil(void);
46 
47 extern ulong_t getcr0(void);
48 extern void setcr0(ulong_t);
49 extern ulong_t getcr2(void);
50 
51 #if defined(__i386)
52 extern uint16_t getgs(void);
53 extern void setgs(uint16_t);
54 #endif
55 
56 extern void sti(void);
57 
58 extern void tenmicrosec(void);
59 
60 extern void restore_int_flag(int);
61 extern int clear_int_flag(void);
62 
63 extern void int3(void);
64 extern void int18(void);
65 extern void int20(void);
66 
67 #if defined(__amd64)
68 extern void sys_syscall();
69 extern void sys_syscall32();
70 extern void sys_lcall32();
71 extern void sys_syscall_int();
72 extern void brand_sys_syscall();
73 extern void brand_sys_syscall32();
74 extern void brand_sys_syscall_int();
75 #elif defined(__i386)
76 extern void sys_call();
77 extern void brand_sys_call();
78 #endif
79 extern void sys_sysenter();
80 extern void _sys_sysenter_post_swapgs();
81 extern void brand_sys_sysenter();
82 extern void _brand_sys_sysenter_post_swapgs();
83 
84 extern void dosyscall(void);
85 
86 extern void bind_hwcap(void);
87 
88 extern uint8_t inb(int port);
89 extern uint16_t inw(int port);
90 extern uint32_t inl(int port);
91 extern void outb(int port, uint8_t value);
92 extern void outw(int port, uint16_t value);
93 extern void outl(int port, uint32_t value);
94 
95 extern void pc_reset(void) __NORETURN;
96 extern void reset(void) __NORETURN;
97 extern int goany(void);
98 
99 extern void setgregs(klwp_t *, gregset_t);
100 extern void getgregs(klwp_t *, gregset_t);
101 extern void setfpregs(klwp_t *, fpregset_t *);
102 extern void getfpregs(klwp_t *, fpregset_t *);
103 
104 #if defined(_SYSCALL32_IMPL)
105 extern void getgregs32(klwp_t *, gregset32_t);
106 extern void setfpregs32(klwp_t *, fpregset32_t *);
107 extern void getfpregs32(klwp_t *, fpregset32_t *);
108 #endif
109 
110 struct fpu_ctx;
111 
112 extern void fp_free(struct fpu_ctx *, int);
113 extern void fp_save(struct fpu_ctx *);
114 extern void fp_restore(struct fpu_ctx *);
115 
116 extern int fpu_pentium_fdivbug;
117 
118 extern void sep_save(void *);
119 extern void sep_restore(void *);
120 
121 extern void brand_interpositioning_enable(void);
122 extern void brand_interpositioning_disable(void);
123 
124 struct regs;
125 
126 extern int instr_size(struct regs *, caddr_t *, enum seg_rw);
127 
128 extern void realsigprof(int, int);
129 
130 extern int enable_cbcp; /* patchable in /etc/system */
131 
132 extern uint_t cpu_hwcap_flags;
133 extern uint_t cpu_freq;
134 extern uint64_t cpu_freq_hz;
135 
136 extern caddr_t i86devmap(pfn_t, pgcnt_t, uint_t);
137 extern page_t *page_numtopp_alloc(pfn_t pfnum);
138 
139 extern void hwblkclr(void *, size_t);
140 extern void hwblkpagecopy(const void *, void *);
141 
142 extern void (*kcpc_hw_enable_cpc_intr)(void);
143 
144 extern void setup_mca(void);
145 extern void setup_mtrr(void);
146 extern void patch_tsc(void);
147 
148 extern user_desc_t *cpu_get_gdt(void);
149 
150 /*
151  * Warning: these routines do -not- use normal calling conventions!
152  */
153 extern void setup_121_andcall(void (*)(ulong_t), ulong_t);
154 extern void enable_big_page_support(ulong_t);
155 extern void enable_pae(ulong_t);
156 
157 extern hrtime_t (*gethrtimef)(void);
158 extern hrtime_t (*gethrtimeunscaledf)(void);
159 extern void (*scalehrtimef)(hrtime_t *);
160 extern void (*gethrestimef)(timestruc_t *);
161 
162 #endif /* _KERNEL */
163 
164 #ifdef __cplusplus
165 }
166 #endif
167 
168 #endif	/* _SYS_ARCHSYSTM_H */
169