xref: /onnv-gate/usr/src/uts/intel/sys/archsystm.h (revision 13134:8315ff49e22e)
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  */
219870SRoger.Faulkner@Sun.COM 
220Sstevel@tonic-gate /*
2313050Sfrank.van.der.linden@oracle.com  * Copyright (c) 1993, 2010, Oracle and/or its affiliates. All rights reserved.
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 /*
300Sstevel@tonic-gate  * A selection of ISA-dependent interfaces
310Sstevel@tonic-gate  */
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #include <vm/seg_enum.h>
340Sstevel@tonic-gate #include <vm/page.h>
350Sstevel@tonic-gate 
360Sstevel@tonic-gate #ifdef __cplusplus
370Sstevel@tonic-gate extern "C" {
380Sstevel@tonic-gate #endif
390Sstevel@tonic-gate 
400Sstevel@tonic-gate #ifdef _KERNEL
410Sstevel@tonic-gate 
420Sstevel@tonic-gate extern greg_t getfp(void);
430Sstevel@tonic-gate extern int getpil(void);
440Sstevel@tonic-gate 
450Sstevel@tonic-gate extern ulong_t getcr0(void);
460Sstevel@tonic-gate extern void setcr0(ulong_t);
4710080SJoe.Bonasera@sun.com extern ulong_t getcr8(void);
4810080SJoe.Bonasera@sun.com extern void setcr8(ulong_t);
490Sstevel@tonic-gate extern ulong_t getcr2(void);
507589SVikram.Hegde@Sun.COM extern void clflush_insn(caddr_t addr);
517589SVikram.Hegde@Sun.COM extern void mfence_insn(void);
520Sstevel@tonic-gate 
530Sstevel@tonic-gate #if defined(__i386)
540Sstevel@tonic-gate extern uint16_t getgs(void);
550Sstevel@tonic-gate extern void setgs(uint16_t);
563446Smrj 
573446Smrj extern void patch_sse(void);
583446Smrj extern void patch_sse2(void);
590Sstevel@tonic-gate #endif
600Sstevel@tonic-gate 
61*13134Skuriakose.kuruvilla@oracle.com extern void patch_xsave(void);
62*13134Skuriakose.kuruvilla@oracle.com 
633446Smrj extern void cli(void);
640Sstevel@tonic-gate extern void sti(void);
650Sstevel@tonic-gate 
660Sstevel@tonic-gate extern void tenmicrosec(void);
670Sstevel@tonic-gate 
683446Smrj extern void restore_int_flag(ulong_t);
693446Smrj extern void intr_restore(ulong_t);
703446Smrj extern ulong_t clear_int_flag(void);
713446Smrj extern ulong_t intr_clear(void);
723446Smrj extern ulong_t getflags(void);
733446Smrj extern int interrupts_enabled(void);
740Sstevel@tonic-gate 
751414Scindi extern void int3(void);
761414Scindi extern void int18(void);
770Sstevel@tonic-gate extern void int20(void);
787349SAdrian.Frost@Sun.COM extern void int_cmci(void);
790Sstevel@tonic-gate 
800Sstevel@tonic-gate #if defined(__amd64)
810Sstevel@tonic-gate extern void sys_syscall();
820Sstevel@tonic-gate extern void sys_syscall32();
830Sstevel@tonic-gate extern void sys_lcall32();
840Sstevel@tonic-gate extern void sys_syscall_int();
852712Snn35248 extern void brand_sys_syscall();
862712Snn35248 extern void brand_sys_syscall32();
872712Snn35248 extern void brand_sys_syscall_int();
883446Smrj extern int update_sregs();
895084Sjohnlev extern void reset_sregs();
900Sstevel@tonic-gate #elif defined(__i386)
910Sstevel@tonic-gate extern void sys_call();
922712Snn35248 extern void brand_sys_call();
930Sstevel@tonic-gate #endif
940Sstevel@tonic-gate extern void sys_sysenter();
950Sstevel@tonic-gate extern void _sys_sysenter_post_swapgs();
962712Snn35248 extern void brand_sys_sysenter();
972712Snn35248 extern void _brand_sys_sysenter_post_swapgs();
980Sstevel@tonic-gate 
990Sstevel@tonic-gate extern void dosyscall(void);
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate extern void bind_hwcap(void);
1020Sstevel@tonic-gate 
1030Sstevel@tonic-gate extern uint16_t inw(int port);
1040Sstevel@tonic-gate extern uint32_t inl(int port);
1050Sstevel@tonic-gate extern void outw(int port, uint16_t value);
1060Sstevel@tonic-gate extern void outl(int port, uint32_t value);
1070Sstevel@tonic-gate 
1080Sstevel@tonic-gate extern void pc_reset(void) __NORETURN;
1092866Sszhou extern void efi_reset(void) __NORETURN;
1100Sstevel@tonic-gate extern void reset(void) __NORETURN;
1110Sstevel@tonic-gate extern int goany(void);
1120Sstevel@tonic-gate 
1130Sstevel@tonic-gate extern void setgregs(klwp_t *, gregset_t);
1140Sstevel@tonic-gate extern void getgregs(klwp_t *, gregset_t);
1150Sstevel@tonic-gate extern void setfpregs(klwp_t *, fpregset_t *);
1160Sstevel@tonic-gate extern void getfpregs(klwp_t *, fpregset_t *);
1170Sstevel@tonic-gate 
1180Sstevel@tonic-gate #if defined(_SYSCALL32_IMPL)
1190Sstevel@tonic-gate extern void getgregs32(klwp_t *, gregset32_t);
1200Sstevel@tonic-gate extern void setfpregs32(klwp_t *, fpregset32_t *);
1210Sstevel@tonic-gate extern void getfpregs32(klwp_t *, fpregset32_t *);
1220Sstevel@tonic-gate #endif
1230Sstevel@tonic-gate 
1240Sstevel@tonic-gate struct fpu_ctx;
1250Sstevel@tonic-gate 
1260Sstevel@tonic-gate extern void fp_free(struct fpu_ctx *, int);
1270Sstevel@tonic-gate extern void fp_save(struct fpu_ctx *);
1280Sstevel@tonic-gate extern void fp_restore(struct fpu_ctx *);
1290Sstevel@tonic-gate 
1300Sstevel@tonic-gate extern int fpu_pentium_fdivbug;
1310Sstevel@tonic-gate 
1320Sstevel@tonic-gate extern void sep_save(void *);
1330Sstevel@tonic-gate extern void sep_restore(void *);
1340Sstevel@tonic-gate 
1352712Snn35248 extern void brand_interpositioning_enable(void);
1362712Snn35248 extern void brand_interpositioning_disable(void);
1372712Snn35248 
1380Sstevel@tonic-gate struct regs;
1390Sstevel@tonic-gate 
1400Sstevel@tonic-gate extern int instr_size(struct regs *, caddr_t *, enum seg_rw);
1410Sstevel@tonic-gate 
1420Sstevel@tonic-gate extern int enable_cbcp; /* patchable in /etc/system */
1430Sstevel@tonic-gate 
1440Sstevel@tonic-gate extern uint_t cpu_hwcap_flags;
1450Sstevel@tonic-gate extern uint_t cpu_freq;
1460Sstevel@tonic-gate extern uint64_t cpu_freq_hz;
1470Sstevel@tonic-gate 
1483446Smrj extern int use_sse_pagecopy;
1493446Smrj extern int use_sse_pagezero;
1503446Smrj extern int use_sse_copy;
1513446Smrj 
1520Sstevel@tonic-gate extern caddr_t i86devmap(pfn_t, pgcnt_t, uint_t);
1530Sstevel@tonic-gate extern page_t *page_numtopp_alloc(pfn_t pfnum);
1540Sstevel@tonic-gate 
1550Sstevel@tonic-gate extern void hwblkclr(void *, size_t);
1560Sstevel@tonic-gate extern void hwblkpagecopy(const void *, void *);
1573446Smrj extern void page_copy_no_xmm(void *dst, void *src);
1583446Smrj extern void block_zero_no_xmm(void *dst, int len);
1593446Smrj #define	BLOCKZEROALIGN (4 * sizeof (void *))
1600Sstevel@tonic-gate 
1610Sstevel@tonic-gate extern void (*kcpc_hw_enable_cpc_intr)(void);
1620Sstevel@tonic-gate 
1633446Smrj extern void init_desctbls(void);
1640Sstevel@tonic-gate 
1652712Snn35248 extern user_desc_t *cpu_get_gdt(void);
1662712Snn35248 
1673446Smrj extern void switch_sp_and_call(void *, void (*)(uint_t, uint_t), uint_t,
1683446Smrj 	uint_t);
1690Sstevel@tonic-gate extern hrtime_t (*gethrtimef)(void);
1700Sstevel@tonic-gate extern hrtime_t (*gethrtimeunscaledf)(void);
1710Sstevel@tonic-gate extern void (*scalehrtimef)(hrtime_t *);
17210797SEric.Saxe@Sun.COM extern uint64_t (*unscalehrtimef)(hrtime_t);
1730Sstevel@tonic-gate extern void (*gethrestimef)(timestruc_t *);
1740Sstevel@tonic-gate 
1753446Smrj extern void av_dispatch_softvect(uint_t);
1763446Smrj extern void av_dispatch_autovect(uint_t);
1773446Smrj extern uint_t atomic_btr32(uint32_t *, uint_t);
1783446Smrj extern uint_t bsrw_insn(uint16_t);
1793446Smrj extern int sys_rtt_common(struct regs *);
1803446Smrj extern void fakesoftint(void);
1813446Smrj 
1825084Sjohnlev extern void *plat_traceback(void *);
1833446Smrj 
1845084Sjohnlev #if defined(__xpv)
1855084Sjohnlev extern void xen_init_callbacks(void);
1865084Sjohnlev extern void xen_set_callback(void (*)(void), uint_t, uint_t);
1875084Sjohnlev extern void xen_printf(const char *, ...);
1885084Sjohnlev #define	cpr_dprintf xen_printf
1895084Sjohnlev extern int xpv_panicking;
1905084Sjohnlev #define	IN_XPV_PANIC() (xpv_panicking > 0)
1915084Sjohnlev #else
1923446Smrj extern void setup_mca(void);
1935159Sjohnlev extern void pat_sync(void);
1945322Ssudheer extern void patch_tsc_read(int);
1958377SBill.Holler@Sun.COM #if defined(__amd64) && !defined(__xpv)
1968377SBill.Holler@Sun.COM extern void patch_memops(uint_t);
1978377SBill.Holler@Sun.COM #endif	/* defined(__amd64) && !defined(__xpv) */
198*13134Skuriakose.kuruvilla@oracle.com extern void setup_xfem(void);
1993446Smrj #define	cpr_dprintf prom_printf
2005084Sjohnlev #define	IN_XPV_PANIC() (__lintzero)
2015084Sjohnlev #endif
2023446Smrj 
2030Sstevel@tonic-gate #endif /* _KERNEL */
2040Sstevel@tonic-gate 
2053446Smrj #if defined(_KERNEL) || defined(_BOOT)
2063446Smrj extern uint8_t inb(int port);
2073446Smrj extern void outb(int port, uint8_t value);
2083446Smrj #endif
2093446Smrj 
2100Sstevel@tonic-gate #ifdef __cplusplus
2110Sstevel@tonic-gate }
2120Sstevel@tonic-gate #endif
2130Sstevel@tonic-gate 
2140Sstevel@tonic-gate #endif	/* _SYS_ARCHSYSTM_H */
215