xref: /titanic_51/usr/src/uts/intel/sys/archsystm.h (revision 51223f1870532b39bc1f6770c7bfa1ee814957f9)
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 #elif defined(__i386)
73 extern void sys_call();
74 #endif
75 extern void sys_sysenter();
76 extern void _sys_sysenter_post_swapgs();
77 
78 extern void dosyscall(void);
79 
80 extern void bind_hwcap(void);
81 
82 extern uint8_t inb(int port);
83 extern uint16_t inw(int port);
84 extern uint32_t inl(int port);
85 extern void outb(int port, uint8_t value);
86 extern void outw(int port, uint16_t value);
87 extern void outl(int port, uint32_t value);
88 
89 extern void pc_reset(void) __NORETURN;
90 extern void reset(void) __NORETURN;
91 extern int goany(void);
92 
93 extern void setgregs(klwp_t *, gregset_t);
94 extern void getgregs(klwp_t *, gregset_t);
95 extern void setfpregs(klwp_t *, fpregset_t *);
96 extern void getfpregs(klwp_t *, fpregset_t *);
97 
98 #if defined(_SYSCALL32_IMPL)
99 extern void getgregs32(klwp_t *, gregset32_t);
100 extern void setfpregs32(klwp_t *, fpregset32_t *);
101 extern void getfpregs32(klwp_t *, fpregset32_t *);
102 #endif
103 
104 struct fpu_ctx;
105 
106 extern void fp_free(struct fpu_ctx *, int);
107 extern void fp_save(struct fpu_ctx *);
108 extern void fp_restore(struct fpu_ctx *);
109 
110 extern int fpu_pentium_fdivbug;
111 
112 extern void sep_save(void *);
113 extern void sep_restore(void *);
114 
115 struct regs;
116 
117 extern int instr_size(struct regs *, caddr_t *, enum seg_rw);
118 
119 extern void realsigprof(int, int);
120 
121 extern int enable_cbcp; /* patchable in /etc/system */
122 
123 extern uint_t cpu_hwcap_flags;
124 extern uint_t cpu_freq;
125 extern uint64_t cpu_freq_hz;
126 
127 extern caddr_t i86devmap(pfn_t, pgcnt_t, uint_t);
128 extern page_t *page_numtopp_alloc(pfn_t pfnum);
129 
130 extern void hwblkclr(void *, size_t);
131 extern void hwblkpagecopy(const void *, void *);
132 
133 extern void (*kcpc_hw_enable_cpc_intr)(void);
134 
135 extern void setup_mca(void);
136 extern void setup_mtrr(void);
137 extern void patch_tsc(void);
138 
139 /*
140  * Warning: these routines do -not- use normal calling conventions!
141  */
142 extern void setup_121_andcall(void (*)(ulong_t), ulong_t);
143 extern void enable_big_page_support(ulong_t);
144 extern void enable_pae(ulong_t);
145 
146 extern hrtime_t (*gethrtimef)(void);
147 extern hrtime_t (*gethrtimeunscaledf)(void);
148 extern void (*scalehrtimef)(hrtime_t *);
149 extern void (*gethrestimef)(timestruc_t *);
150 
151 #endif /* _KERNEL */
152 
153 #ifdef __cplusplus
154 }
155 #endif
156 
157 #endif	/* _SYS_ARCHSYSTM_H */
158