xref: /onnv-gate/usr/src/uts/intel/sys/archsystm.h (revision 2712:f74a135872bc)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51106Smrj  * Common Development and Distribution License (the "License").
61106Smrj  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
221414Scindi  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _SYS_ARCHSYSTM_H
270Sstevel@tonic-gate #define	_SYS_ARCHSYSTM_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate /*
320Sstevel@tonic-gate  * A selection of ISA-dependent interfaces
330Sstevel@tonic-gate  */
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #include <vm/seg_enum.h>
360Sstevel@tonic-gate #include <vm/page.h>
370Sstevel@tonic-gate 
380Sstevel@tonic-gate #ifdef __cplusplus
390Sstevel@tonic-gate extern "C" {
400Sstevel@tonic-gate #endif
410Sstevel@tonic-gate 
420Sstevel@tonic-gate #ifdef _KERNEL
430Sstevel@tonic-gate 
440Sstevel@tonic-gate extern greg_t getfp(void);
450Sstevel@tonic-gate extern int getpil(void);
460Sstevel@tonic-gate 
470Sstevel@tonic-gate extern ulong_t getcr0(void);
480Sstevel@tonic-gate extern void setcr0(ulong_t);
490Sstevel@tonic-gate extern ulong_t getcr2(void);
500Sstevel@tonic-gate 
510Sstevel@tonic-gate #if defined(__i386)
520Sstevel@tonic-gate extern uint16_t getgs(void);
530Sstevel@tonic-gate extern void setgs(uint16_t);
540Sstevel@tonic-gate #endif
550Sstevel@tonic-gate 
560Sstevel@tonic-gate extern void sti(void);
570Sstevel@tonic-gate 
580Sstevel@tonic-gate extern void tenmicrosec(void);
590Sstevel@tonic-gate 
600Sstevel@tonic-gate extern void restore_int_flag(int);
610Sstevel@tonic-gate extern int clear_int_flag(void);
620Sstevel@tonic-gate 
631414Scindi extern void int3(void);
641414Scindi extern void int18(void);
650Sstevel@tonic-gate extern void int20(void);
660Sstevel@tonic-gate 
670Sstevel@tonic-gate #if defined(__amd64)
680Sstevel@tonic-gate extern void sys_syscall();
690Sstevel@tonic-gate extern void sys_syscall32();
700Sstevel@tonic-gate extern void sys_lcall32();
710Sstevel@tonic-gate extern void sys_syscall_int();
72*2712Snn35248 extern void brand_sys_syscall();
73*2712Snn35248 extern void brand_sys_syscall32();
74*2712Snn35248 extern void brand_sys_syscall_int();
750Sstevel@tonic-gate #elif defined(__i386)
760Sstevel@tonic-gate extern void sys_call();
77*2712Snn35248 extern void brand_sys_call();
780Sstevel@tonic-gate #endif
790Sstevel@tonic-gate extern void sys_sysenter();
800Sstevel@tonic-gate extern void _sys_sysenter_post_swapgs();
81*2712Snn35248 extern void brand_sys_sysenter();
82*2712Snn35248 extern void _brand_sys_sysenter_post_swapgs();
830Sstevel@tonic-gate 
840Sstevel@tonic-gate extern void dosyscall(void);
850Sstevel@tonic-gate 
860Sstevel@tonic-gate extern void bind_hwcap(void);
870Sstevel@tonic-gate 
880Sstevel@tonic-gate extern uint8_t inb(int port);
890Sstevel@tonic-gate extern uint16_t inw(int port);
900Sstevel@tonic-gate extern uint32_t inl(int port);
910Sstevel@tonic-gate extern void outb(int port, uint8_t value);
920Sstevel@tonic-gate extern void outw(int port, uint16_t value);
930Sstevel@tonic-gate extern void outl(int port, uint32_t value);
940Sstevel@tonic-gate 
950Sstevel@tonic-gate extern void pc_reset(void) __NORETURN;
960Sstevel@tonic-gate extern void reset(void) __NORETURN;
970Sstevel@tonic-gate extern int goany(void);
980Sstevel@tonic-gate 
990Sstevel@tonic-gate extern void setgregs(klwp_t *, gregset_t);
1000Sstevel@tonic-gate extern void getgregs(klwp_t *, gregset_t);
1010Sstevel@tonic-gate extern void setfpregs(klwp_t *, fpregset_t *);
1020Sstevel@tonic-gate extern void getfpregs(klwp_t *, fpregset_t *);
1030Sstevel@tonic-gate 
1040Sstevel@tonic-gate #if defined(_SYSCALL32_IMPL)
1050Sstevel@tonic-gate extern void getgregs32(klwp_t *, gregset32_t);
1060Sstevel@tonic-gate extern void setfpregs32(klwp_t *, fpregset32_t *);
1070Sstevel@tonic-gate extern void getfpregs32(klwp_t *, fpregset32_t *);
1080Sstevel@tonic-gate #endif
1090Sstevel@tonic-gate 
1100Sstevel@tonic-gate struct fpu_ctx;
1110Sstevel@tonic-gate 
1120Sstevel@tonic-gate extern void fp_free(struct fpu_ctx *, int);
1130Sstevel@tonic-gate extern void fp_save(struct fpu_ctx *);
1140Sstevel@tonic-gate extern void fp_restore(struct fpu_ctx *);
1150Sstevel@tonic-gate 
1160Sstevel@tonic-gate extern int fpu_pentium_fdivbug;
1170Sstevel@tonic-gate 
1180Sstevel@tonic-gate extern void sep_save(void *);
1190Sstevel@tonic-gate extern void sep_restore(void *);
1200Sstevel@tonic-gate 
121*2712Snn35248 extern void brand_interpositioning_enable(void);
122*2712Snn35248 extern void brand_interpositioning_disable(void);
123*2712Snn35248 
1240Sstevel@tonic-gate struct regs;
1250Sstevel@tonic-gate 
1260Sstevel@tonic-gate extern int instr_size(struct regs *, caddr_t *, enum seg_rw);
1270Sstevel@tonic-gate 
1280Sstevel@tonic-gate extern void realsigprof(int, int);
1290Sstevel@tonic-gate 
1300Sstevel@tonic-gate extern int enable_cbcp; /* patchable in /etc/system */
1310Sstevel@tonic-gate 
1320Sstevel@tonic-gate extern uint_t cpu_hwcap_flags;
1330Sstevel@tonic-gate extern uint_t cpu_freq;
1340Sstevel@tonic-gate extern uint64_t cpu_freq_hz;
1350Sstevel@tonic-gate 
1360Sstevel@tonic-gate extern caddr_t i86devmap(pfn_t, pgcnt_t, uint_t);
1370Sstevel@tonic-gate extern page_t *page_numtopp_alloc(pfn_t pfnum);
1380Sstevel@tonic-gate 
1390Sstevel@tonic-gate extern void hwblkclr(void *, size_t);
1400Sstevel@tonic-gate extern void hwblkpagecopy(const void *, void *);
1410Sstevel@tonic-gate 
1420Sstevel@tonic-gate extern void (*kcpc_hw_enable_cpc_intr)(void);
1430Sstevel@tonic-gate 
1440Sstevel@tonic-gate extern void setup_mca(void);
1450Sstevel@tonic-gate extern void setup_mtrr(void);
1460Sstevel@tonic-gate extern void patch_tsc(void);
1470Sstevel@tonic-gate 
148*2712Snn35248 extern user_desc_t *cpu_get_gdt(void);
149*2712Snn35248 
1500Sstevel@tonic-gate /*
1510Sstevel@tonic-gate  * Warning: these routines do -not- use normal calling conventions!
1520Sstevel@tonic-gate  */
1530Sstevel@tonic-gate extern void setup_121_andcall(void (*)(ulong_t), ulong_t);
1540Sstevel@tonic-gate extern void enable_big_page_support(ulong_t);
1550Sstevel@tonic-gate extern void enable_pae(ulong_t);
1560Sstevel@tonic-gate 
1570Sstevel@tonic-gate extern hrtime_t (*gethrtimef)(void);
1580Sstevel@tonic-gate extern hrtime_t (*gethrtimeunscaledf)(void);
1590Sstevel@tonic-gate extern void (*scalehrtimef)(hrtime_t *);
1600Sstevel@tonic-gate extern void (*gethrestimef)(timestruc_t *);
1610Sstevel@tonic-gate 
1620Sstevel@tonic-gate #endif /* _KERNEL */
1630Sstevel@tonic-gate 
1640Sstevel@tonic-gate #ifdef __cplusplus
1650Sstevel@tonic-gate }
1660Sstevel@tonic-gate #endif
1670Sstevel@tonic-gate 
1680Sstevel@tonic-gate #endif	/* _SYS_ARCHSYSTM_H */
169