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