xref: /titanic_50/usr/src/uts/intel/sys/archsystm.h (revision 9acbbeaf2a1ffe5c14b244867d427714fab43c5c)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
54ab75253Smrj  * Common Development and Distribution License (the "License").
64ab75253Smrj  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
227aec1d6eScindi  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _SYS_ARCHSYSTM_H
277c478bd9Sstevel@tonic-gate #define	_SYS_ARCHSYSTM_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate /*
327c478bd9Sstevel@tonic-gate  * A selection of ISA-dependent interfaces
337c478bd9Sstevel@tonic-gate  */
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #include <vm/seg_enum.h>
367c478bd9Sstevel@tonic-gate #include <vm/page.h>
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #ifdef __cplusplus
397c478bd9Sstevel@tonic-gate extern "C" {
407c478bd9Sstevel@tonic-gate #endif
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate #ifdef _KERNEL
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate extern greg_t getfp(void);
457c478bd9Sstevel@tonic-gate extern int getpil(void);
467c478bd9Sstevel@tonic-gate 
477c478bd9Sstevel@tonic-gate extern ulong_t getcr0(void);
487c478bd9Sstevel@tonic-gate extern void setcr0(ulong_t);
497c478bd9Sstevel@tonic-gate extern ulong_t getcr2(void);
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #if defined(__i386)
527c478bd9Sstevel@tonic-gate extern uint16_t getgs(void);
537c478bd9Sstevel@tonic-gate extern void setgs(uint16_t);
547c478bd9Sstevel@tonic-gate #endif
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate extern void sti(void);
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate extern void tenmicrosec(void);
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate extern void restore_int_flag(int);
617c478bd9Sstevel@tonic-gate extern int clear_int_flag(void);
627c478bd9Sstevel@tonic-gate 
637aec1d6eScindi extern void int3(void);
647aec1d6eScindi extern void int18(void);
657c478bd9Sstevel@tonic-gate extern void int20(void);
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate #if defined(__amd64)
687c478bd9Sstevel@tonic-gate extern void sys_syscall();
697c478bd9Sstevel@tonic-gate extern void sys_syscall32();
707c478bd9Sstevel@tonic-gate extern void sys_lcall32();
717c478bd9Sstevel@tonic-gate extern void sys_syscall_int();
72*9acbbeafSnn35248 extern void brand_sys_syscall();
73*9acbbeafSnn35248 extern void brand_sys_syscall32();
74*9acbbeafSnn35248 extern void brand_sys_syscall_int();
757c478bd9Sstevel@tonic-gate #elif defined(__i386)
767c478bd9Sstevel@tonic-gate extern void sys_call();
77*9acbbeafSnn35248 extern void brand_sys_call();
787c478bd9Sstevel@tonic-gate #endif
797c478bd9Sstevel@tonic-gate extern void sys_sysenter();
807c478bd9Sstevel@tonic-gate extern void _sys_sysenter_post_swapgs();
81*9acbbeafSnn35248 extern void brand_sys_sysenter();
82*9acbbeafSnn35248 extern void _brand_sys_sysenter_post_swapgs();
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate extern void dosyscall(void);
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate extern void bind_hwcap(void);
877c478bd9Sstevel@tonic-gate 
887c478bd9Sstevel@tonic-gate extern uint8_t inb(int port);
897c478bd9Sstevel@tonic-gate extern uint16_t inw(int port);
907c478bd9Sstevel@tonic-gate extern uint32_t inl(int port);
917c478bd9Sstevel@tonic-gate extern void outb(int port, uint8_t value);
927c478bd9Sstevel@tonic-gate extern void outw(int port, uint16_t value);
937c478bd9Sstevel@tonic-gate extern void outl(int port, uint32_t value);
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate extern void pc_reset(void) __NORETURN;
967c478bd9Sstevel@tonic-gate extern void reset(void) __NORETURN;
977c478bd9Sstevel@tonic-gate extern int goany(void);
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate extern void setgregs(klwp_t *, gregset_t);
1007c478bd9Sstevel@tonic-gate extern void getgregs(klwp_t *, gregset_t);
1017c478bd9Sstevel@tonic-gate extern void setfpregs(klwp_t *, fpregset_t *);
1027c478bd9Sstevel@tonic-gate extern void getfpregs(klwp_t *, fpregset_t *);
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32_IMPL)
1057c478bd9Sstevel@tonic-gate extern void getgregs32(klwp_t *, gregset32_t);
1067c478bd9Sstevel@tonic-gate extern void setfpregs32(klwp_t *, fpregset32_t *);
1077c478bd9Sstevel@tonic-gate extern void getfpregs32(klwp_t *, fpregset32_t *);
1087c478bd9Sstevel@tonic-gate #endif
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate struct fpu_ctx;
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate extern void fp_free(struct fpu_ctx *, int);
1137c478bd9Sstevel@tonic-gate extern void fp_save(struct fpu_ctx *);
1147c478bd9Sstevel@tonic-gate extern void fp_restore(struct fpu_ctx *);
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate extern int fpu_pentium_fdivbug;
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate extern void sep_save(void *);
1197c478bd9Sstevel@tonic-gate extern void sep_restore(void *);
1207c478bd9Sstevel@tonic-gate 
121*9acbbeafSnn35248 extern void brand_interpositioning_enable(void);
122*9acbbeafSnn35248 extern void brand_interpositioning_disable(void);
123*9acbbeafSnn35248 
1247c478bd9Sstevel@tonic-gate struct regs;
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate extern int instr_size(struct regs *, caddr_t *, enum seg_rw);
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate extern void realsigprof(int, int);
1297c478bd9Sstevel@tonic-gate 
1307c478bd9Sstevel@tonic-gate extern int enable_cbcp; /* patchable in /etc/system */
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate extern uint_t cpu_hwcap_flags;
1337c478bd9Sstevel@tonic-gate extern uint_t cpu_freq;
1347c478bd9Sstevel@tonic-gate extern uint64_t cpu_freq_hz;
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate extern caddr_t i86devmap(pfn_t, pgcnt_t, uint_t);
1377c478bd9Sstevel@tonic-gate extern page_t *page_numtopp_alloc(pfn_t pfnum);
1387c478bd9Sstevel@tonic-gate 
1397c478bd9Sstevel@tonic-gate extern void hwblkclr(void *, size_t);
1407c478bd9Sstevel@tonic-gate extern void hwblkpagecopy(const void *, void *);
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate extern void (*kcpc_hw_enable_cpc_intr)(void);
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate extern void setup_mca(void);
1457c478bd9Sstevel@tonic-gate extern void setup_mtrr(void);
1467c478bd9Sstevel@tonic-gate extern void patch_tsc(void);
1477c478bd9Sstevel@tonic-gate 
148*9acbbeafSnn35248 extern user_desc_t *cpu_get_gdt(void);
149*9acbbeafSnn35248 
1507c478bd9Sstevel@tonic-gate /*
1517c478bd9Sstevel@tonic-gate  * Warning: these routines do -not- use normal calling conventions!
1527c478bd9Sstevel@tonic-gate  */
1537c478bd9Sstevel@tonic-gate extern void setup_121_andcall(void (*)(ulong_t), ulong_t);
1547c478bd9Sstevel@tonic-gate extern void enable_big_page_support(ulong_t);
1557c478bd9Sstevel@tonic-gate extern void enable_pae(ulong_t);
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate extern hrtime_t (*gethrtimef)(void);
1587c478bd9Sstevel@tonic-gate extern hrtime_t (*gethrtimeunscaledf)(void);
1597c478bd9Sstevel@tonic-gate extern void (*scalehrtimef)(hrtime_t *);
1607c478bd9Sstevel@tonic-gate extern void (*gethrestimef)(timestruc_t *);
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
1637c478bd9Sstevel@tonic-gate 
1647c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1657c478bd9Sstevel@tonic-gate }
1667c478bd9Sstevel@tonic-gate #endif
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate #endif	/* _SYS_ARCHSYSTM_H */
169