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 5*1106Smrj * Common Development and Distribution License (the "License"). 6*1106Smrj * 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 /* 220Sstevel@tonic-gate * Copyright 2005 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 630Sstevel@tonic-gate extern void int20(void); 640Sstevel@tonic-gate 650Sstevel@tonic-gate #if defined(__amd64) 660Sstevel@tonic-gate extern void sys_syscall(); 670Sstevel@tonic-gate extern void sys_syscall32(); 680Sstevel@tonic-gate extern void sys_lcall32(); 690Sstevel@tonic-gate extern void sys_syscall_int(); 700Sstevel@tonic-gate #elif defined(__i386) 710Sstevel@tonic-gate extern void sys_call(); 720Sstevel@tonic-gate #endif 730Sstevel@tonic-gate extern void sys_sysenter(); 740Sstevel@tonic-gate extern void _sys_sysenter_post_swapgs(); 750Sstevel@tonic-gate 760Sstevel@tonic-gate extern void dosyscall(void); 770Sstevel@tonic-gate 780Sstevel@tonic-gate extern void bind_hwcap(void); 790Sstevel@tonic-gate 800Sstevel@tonic-gate extern uint8_t inb(int port); 810Sstevel@tonic-gate extern uint16_t inw(int port); 820Sstevel@tonic-gate extern uint32_t inl(int port); 830Sstevel@tonic-gate extern void outb(int port, uint8_t value); 840Sstevel@tonic-gate extern void outw(int port, uint16_t value); 850Sstevel@tonic-gate extern void outl(int port, uint32_t value); 860Sstevel@tonic-gate 870Sstevel@tonic-gate extern void pc_reset(void) __NORETURN; 880Sstevel@tonic-gate extern void reset(void) __NORETURN; 890Sstevel@tonic-gate extern int goany(void); 900Sstevel@tonic-gate 910Sstevel@tonic-gate extern void setgregs(klwp_t *, gregset_t); 920Sstevel@tonic-gate extern void getgregs(klwp_t *, gregset_t); 930Sstevel@tonic-gate extern void setfpregs(klwp_t *, fpregset_t *); 940Sstevel@tonic-gate extern void getfpregs(klwp_t *, fpregset_t *); 950Sstevel@tonic-gate 960Sstevel@tonic-gate #if defined(_SYSCALL32_IMPL) 970Sstevel@tonic-gate extern void getgregs32(klwp_t *, gregset32_t); 980Sstevel@tonic-gate extern void setfpregs32(klwp_t *, fpregset32_t *); 990Sstevel@tonic-gate extern void getfpregs32(klwp_t *, fpregset32_t *); 1000Sstevel@tonic-gate #endif 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate struct fpu_ctx; 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate extern void fp_free(struct fpu_ctx *, int); 1050Sstevel@tonic-gate extern void fp_save(struct fpu_ctx *); 1060Sstevel@tonic-gate extern void fp_restore(struct fpu_ctx *); 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate extern int fpu_pentium_fdivbug; 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate extern void sep_save(void *); 1110Sstevel@tonic-gate extern void sep_restore(void *); 1120Sstevel@tonic-gate 1130Sstevel@tonic-gate struct regs; 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate extern int instr_size(struct regs *, caddr_t *, enum seg_rw); 1160Sstevel@tonic-gate 1170Sstevel@tonic-gate extern void realsigprof(int, int); 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate extern int enable_cbcp; /* patchable in /etc/system */ 1200Sstevel@tonic-gate 1210Sstevel@tonic-gate extern uint_t cpu_hwcap_flags; 1220Sstevel@tonic-gate extern uint_t cpu_freq; 1230Sstevel@tonic-gate extern uint64_t cpu_freq_hz; 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate extern caddr_t i86devmap(pfn_t, pgcnt_t, uint_t); 1260Sstevel@tonic-gate extern page_t *page_numtopp_alloc(pfn_t pfnum); 1270Sstevel@tonic-gate 1280Sstevel@tonic-gate extern void hwblkclr(void *, size_t); 1290Sstevel@tonic-gate extern void hwblkpagecopy(const void *, void *); 1300Sstevel@tonic-gate 1310Sstevel@tonic-gate extern void (*kcpc_hw_enable_cpc_intr)(void); 1320Sstevel@tonic-gate 1330Sstevel@tonic-gate extern void setup_mca(void); 1340Sstevel@tonic-gate extern void setup_mtrr(void); 1350Sstevel@tonic-gate extern void patch_tsc(void); 1360Sstevel@tonic-gate 1370Sstevel@tonic-gate /* 1380Sstevel@tonic-gate * Warning: these routines do -not- use normal calling conventions! 1390Sstevel@tonic-gate */ 1400Sstevel@tonic-gate extern void setup_121_andcall(void (*)(ulong_t), ulong_t); 1410Sstevel@tonic-gate extern void enable_big_page_support(ulong_t); 1420Sstevel@tonic-gate extern void enable_pae(ulong_t); 1430Sstevel@tonic-gate 1440Sstevel@tonic-gate extern hrtime_t (*gethrtimef)(void); 1450Sstevel@tonic-gate extern hrtime_t (*gethrtimeunscaledf)(void); 1460Sstevel@tonic-gate extern void (*scalehrtimef)(hrtime_t *); 1470Sstevel@tonic-gate extern void (*gethrestimef)(timestruc_t *); 1480Sstevel@tonic-gate 1490Sstevel@tonic-gate #endif /* _KERNEL */ 1500Sstevel@tonic-gate 1510Sstevel@tonic-gate #ifdef __cplusplus 1520Sstevel@tonic-gate } 1530Sstevel@tonic-gate #endif 1540Sstevel@tonic-gate 1550Sstevel@tonic-gate #endif /* _SYS_ARCHSYSTM_H */ 156