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