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