xref: /titanic_50/usr/src/uts/intel/sys/archsystm.h (revision 672986541be54a7a471bb088e60780c37e371d7e)
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 2007 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 
55 extern void patch_sse(void);
56 extern void patch_sse2(void);
57 #endif
58 
59 extern void cli(void);
60 extern void sti(void);
61 
62 extern void tenmicrosec(void);
63 
64 extern void restore_int_flag(ulong_t);
65 extern void intr_restore(ulong_t);
66 extern ulong_t clear_int_flag(void);
67 extern ulong_t intr_clear(void);
68 extern ulong_t getflags(void);
69 extern int interrupts_enabled(void);
70 
71 extern void int3(void);
72 extern void int18(void);
73 extern void int20(void);
74 
75 #if defined(__amd64)
76 extern void sys_syscall();
77 extern void sys_syscall32();
78 extern void sys_lcall32();
79 extern void sys_syscall_int();
80 extern void brand_sys_syscall();
81 extern void brand_sys_syscall32();
82 extern void brand_sys_syscall_int();
83 extern int update_sregs();
84 #elif defined(__i386)
85 extern void sys_call();
86 extern void brand_sys_call();
87 #endif
88 extern void sys_sysenter();
89 extern void _sys_sysenter_post_swapgs();
90 extern void brand_sys_sysenter();
91 extern void _brand_sys_sysenter_post_swapgs();
92 
93 extern void dosyscall(void);
94 
95 extern void bind_hwcap(void);
96 
97 extern uint16_t inw(int port);
98 extern uint32_t inl(int port);
99 extern void outw(int port, uint16_t value);
100 extern void outl(int port, uint32_t value);
101 
102 extern void pc_reset(void) __NORETURN;
103 extern void efi_reset(void) __NORETURN;
104 extern void reset(void) __NORETURN;
105 extern int goany(void);
106 
107 extern void setgregs(klwp_t *, gregset_t);
108 extern void getgregs(klwp_t *, gregset_t);
109 extern void setfpregs(klwp_t *, fpregset_t *);
110 extern void getfpregs(klwp_t *, fpregset_t *);
111 
112 #if defined(_SYSCALL32_IMPL)
113 extern void getgregs32(klwp_t *, gregset32_t);
114 extern void setfpregs32(klwp_t *, fpregset32_t *);
115 extern void getfpregs32(klwp_t *, fpregset32_t *);
116 #endif
117 
118 struct fpu_ctx;
119 
120 extern void fp_free(struct fpu_ctx *, int);
121 extern void fp_save(struct fpu_ctx *);
122 extern void fp_restore(struct fpu_ctx *);
123 
124 extern int fpu_pentium_fdivbug;
125 
126 extern void sep_save(void *);
127 extern void sep_restore(void *);
128 
129 extern void brand_interpositioning_enable(void);
130 extern void brand_interpositioning_disable(void);
131 
132 struct regs;
133 
134 extern int instr_size(struct regs *, caddr_t *, enum seg_rw);
135 
136 extern void realsigprof(int, int);
137 
138 extern int enable_cbcp; /* patchable in /etc/system */
139 
140 extern uint_t cpu_hwcap_flags;
141 extern uint_t cpu_freq;
142 extern uint64_t cpu_freq_hz;
143 
144 extern int use_sse_pagecopy;
145 extern int use_sse_pagezero;
146 extern int use_sse_copy;
147 
148 extern caddr_t i86devmap(pfn_t, pgcnt_t, uint_t);
149 extern page_t *page_numtopp_alloc(pfn_t pfnum);
150 
151 extern void hwblkclr(void *, size_t);
152 extern void hwblkpagecopy(const void *, void *);
153 extern void page_copy_no_xmm(void *dst, void *src);
154 extern void block_zero_no_xmm(void *dst, int len);
155 #define	BLOCKZEROALIGN (4 * sizeof (void *))
156 
157 extern void (*kcpc_hw_enable_cpc_intr)(void);
158 
159 extern void patch_tsc(void);
160 extern void init_desctbls(void);
161 
162 extern user_desc_t *cpu_get_gdt(void);
163 
164 extern void switch_sp_and_call(void *, void (*)(uint_t, uint_t), uint_t,
165 	uint_t);
166 extern hrtime_t (*gethrtimef)(void);
167 extern hrtime_t (*gethrtimeunscaledf)(void);
168 extern void (*scalehrtimef)(hrtime_t *);
169 extern void (*gethrestimef)(timestruc_t *);
170 
171 extern void av_dispatch_softvect(uint_t);
172 extern void av_dispatch_autovect(uint_t);
173 extern uint_t atomic_btr32(uint32_t *, uint_t);
174 extern uint_t bsrw_insn(uint16_t);
175 extern int sys_rtt_common(struct regs *);
176 extern void fakesoftint(void);
177 
178 
179 extern void setup_mca(void);
180 extern void setup_mtrr(void);
181 #define	cpr_dprintf prom_printf
182 
183 #endif /* _KERNEL */
184 
185 #if defined(_KERNEL) || defined(_BOOT)
186 extern uint8_t inb(int port);
187 extern void outb(int port, uint8_t value);
188 #endif
189 
190 #ifdef __cplusplus
191 }
192 #endif
193 
194 #endif	/* _SYS_ARCHSYSTM_H */
195