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