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 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 23*1414Scindi * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _SYS_CONTROLREGS_H 280Sstevel@tonic-gate #define _SYS_CONTROLREGS_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate #ifndef _ASM 330Sstevel@tonic-gate #include <sys/types.h> 340Sstevel@tonic-gate #endif 350Sstevel@tonic-gate 360Sstevel@tonic-gate #ifdef __cplusplus 370Sstevel@tonic-gate extern "C" { 380Sstevel@tonic-gate #endif 390Sstevel@tonic-gate 400Sstevel@tonic-gate /* 410Sstevel@tonic-gate * This file describes the x86 architecture control registers which 420Sstevel@tonic-gate * are part of the privileged architecture. 430Sstevel@tonic-gate * 440Sstevel@tonic-gate * Many of these definitions are shared between IA-32-style and 450Sstevel@tonic-gate * AMD64-style processors. 460Sstevel@tonic-gate */ 470Sstevel@tonic-gate 480Sstevel@tonic-gate /* CR0 Register */ 490Sstevel@tonic-gate 500Sstevel@tonic-gate #define CR0_PG 0x80000000 /* paging enabled */ 510Sstevel@tonic-gate #define CR0_CD 0x40000000 /* cache disable */ 520Sstevel@tonic-gate #define CR0_NW 0x20000000 /* not writethrough */ 530Sstevel@tonic-gate #define CR0_AM 0x00040000 /* alignment mask */ 540Sstevel@tonic-gate #define CR0_WP 0x00010000 /* write protect */ 550Sstevel@tonic-gate #define CR0_NE 0x00000020 /* numeric error */ 560Sstevel@tonic-gate #define CR0_ET 0x00000010 /* extension type */ 570Sstevel@tonic-gate #define CR0_TS 0x00000008 /* task switch */ 580Sstevel@tonic-gate #define CR0_EM 0x00000004 /* emulation */ 590Sstevel@tonic-gate #define CR0_MP 0x00000002 /* monitor coprocessor */ 600Sstevel@tonic-gate #define CR0_PE 0x00000001 /* protection enabled */ 610Sstevel@tonic-gate 620Sstevel@tonic-gate /* XX64 eliminate these compatibility defines */ 630Sstevel@tonic-gate 640Sstevel@tonic-gate #define CR0_CE CR0_CD 650Sstevel@tonic-gate #define CR0_WT CR0_NW 660Sstevel@tonic-gate 670Sstevel@tonic-gate #define FMT_CR0 \ 680Sstevel@tonic-gate "\20\40pg\37cd\36nw\35am\21wp\6ne\5et\4ts\3em\2mp\1pe" 690Sstevel@tonic-gate 700Sstevel@tonic-gate /* CR3 Register */ 710Sstevel@tonic-gate 720Sstevel@tonic-gate #define CR3_PCD 0x00000010 /* cache disable */ 730Sstevel@tonic-gate #define CR3_PWT 0x00000008 /* write through */ 740Sstevel@tonic-gate 750Sstevel@tonic-gate #define FMT_CR3 "\20\5pcd\4pwt" 760Sstevel@tonic-gate 770Sstevel@tonic-gate /* CR4 Register */ 780Sstevel@tonic-gate 790Sstevel@tonic-gate #define CR4_VME 0x0001 /* virtual-8086 mode extensions */ 800Sstevel@tonic-gate #define CR4_PVI 0x0002 /* protected-mode virtual interrupts */ 810Sstevel@tonic-gate #define CR4_TSD 0x0004 /* time stamp disable */ 820Sstevel@tonic-gate #define CR4_DE 0x0008 /* debugging extensions */ 830Sstevel@tonic-gate #define CR4_PSE 0x0010 /* page size extensions */ 840Sstevel@tonic-gate #define CR4_PAE 0x0020 /* physical address extension */ 850Sstevel@tonic-gate #define CR4_MCE 0x0040 /* machine check enable */ 860Sstevel@tonic-gate #define CR4_PGE 0x0080 /* page global enable */ 870Sstevel@tonic-gate #define CR4_PCE 0x0100 /* perf-monitoring counter enable */ 880Sstevel@tonic-gate #define CR4_OSFXSR 0x0200 /* OS fxsave/fxrstor support */ 890Sstevel@tonic-gate #define CR4_OSXMMEXCPT 0x0400 /* OS unmasked exception support */ 900Sstevel@tonic-gate 910Sstevel@tonic-gate #define FMT_CR4 \ 920Sstevel@tonic-gate "\20\13xmme\12fxsr\11pce\10pge\7mce\6pae\5pse\4de\3tsd\2pvi\1vme" 930Sstevel@tonic-gate 940Sstevel@tonic-gate /* Intel's SYSENTER configuration registers */ 950Sstevel@tonic-gate 960Sstevel@tonic-gate #define MSR_INTC_SEP_CS 0x174 /* kernel code selector MSR */ 970Sstevel@tonic-gate #define MSR_INTC_SEP_ESP 0x175 /* kernel esp MSR */ 980Sstevel@tonic-gate #define MSR_INTC_SEP_EIP 0x176 /* kernel eip MSR */ 990Sstevel@tonic-gate 1000Sstevel@tonic-gate /* AMD's EFER register */ 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate #define MSR_AMD_EFER 0xc0000080 /* extended feature enable MSR */ 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate #define AMD_EFER_NXE 0x800 /* no-execute enable */ 1050Sstevel@tonic-gate #define AMD_EFER_LMA 0x400 /* long mode active (read-only) */ 1060Sstevel@tonic-gate #define AMD_EFER_LME 0x100 /* long mode enable */ 1070Sstevel@tonic-gate #define AMD_EFER_SCE 0x001 /* system call extensions */ 1080Sstevel@tonic-gate 1090Sstevel@tonic-gate #define FMT_AMD_EFER \ 1100Sstevel@tonic-gate "\20\14nxe\13lma\11lme\1sce" 1110Sstevel@tonic-gate 1120Sstevel@tonic-gate /* AMD's SYSCFG register */ 1130Sstevel@tonic-gate 1140Sstevel@tonic-gate #define MSR_AMD_SYSCFG 0xc0000010 /* system configuration MSR */ 1150Sstevel@tonic-gate 1160Sstevel@tonic-gate #define AMD_SYSCFG_TOM2 0x200000 /* MtrrTom2En */ 1170Sstevel@tonic-gate #define AMD_SYSCFG_MVDM 0x100000 /* MtrrVarDramEn */ 1180Sstevel@tonic-gate #define AMD_SYSCFG_MFDM 0x080000 /* MtrrFixDramModEn */ 1190Sstevel@tonic-gate #define AMD_SYSCFG_MFDE 0x040000 /* MtrrFixDramEn */ 1200Sstevel@tonic-gate 1210Sstevel@tonic-gate #define FMT_AMD_SYSCFG \ 1220Sstevel@tonic-gate "\20\26tom2\25mvdm\24mfdm\23mfde" 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate /* AMD's syscall/sysret MSRs */ 1250Sstevel@tonic-gate 1260Sstevel@tonic-gate #define MSR_AMD_STAR 0xc0000081 /* %cs:%ss:%cs:%ss:%eip for syscall */ 1270Sstevel@tonic-gate #define MSR_AMD_LSTAR 0xc0000082 /* target %rip of 64-bit syscall */ 1280Sstevel@tonic-gate #define MSR_AMD_CSTAR 0xc0000083 /* target %rip of 32-bit syscall */ 1290Sstevel@tonic-gate #define MSR_AMD_SFMASK 0xc0000084 /* syscall flag mask */ 1300Sstevel@tonic-gate 1310Sstevel@tonic-gate /* AMD's FS.base and GS.base MSRs */ 1320Sstevel@tonic-gate 1330Sstevel@tonic-gate #define MSR_AMD_FSBASE 0xc0000100 /* 64-bit base address for %fs */ 1340Sstevel@tonic-gate #define MSR_AMD_GSBASE 0xc0000101 /* 64-bit base address for %gs */ 1350Sstevel@tonic-gate #define MSR_AMD_KGSBASE 0xc0000102 /* swapgs swaps this with gsbase */ 1360Sstevel@tonic-gate 1370Sstevel@tonic-gate /* AMD's configuration MSRs, weakly documented in the revision guide */ 1380Sstevel@tonic-gate 1390Sstevel@tonic-gate #define MSR_AMD_DC_CFG 0xc0011022 1400Sstevel@tonic-gate 1410Sstevel@tonic-gate #define AMD_DC_CFG_DIS_CNV_WC_SSO (UINT64_C(1) << 3) 1420Sstevel@tonic-gate #define AMD_DC_CFG_DIS_SMC_CHK_BUF (UINT64_C(1) << 10) 1430Sstevel@tonic-gate 1440Sstevel@tonic-gate /* AMD's HWCR MSR */ 145359Skucharsk 1460Sstevel@tonic-gate #define MSR_AMD_HWCR 0xc0010015 1470Sstevel@tonic-gate 148*1414Scindi #define AMD_HWCR_FFDIS 0x00040 /* disable TLB Flush Filter */ 149*1414Scindi #define AMD_HWCR_MCI_STATUS_WREN 0x40000 /* enable write of MCi_STATUS */ 1500Sstevel@tonic-gate 151359Skucharsk /* AMD's NorthBridge Config MSR, SHOULD ONLY BE WRITTEN TO BY BIOS */ 152359Skucharsk 153359Skucharsk #define MSR_AMD_NB_CFG 0xc001001f 154359Skucharsk 155359Skucharsk #define AMD_NB_CFG_SRQ_HEARTBEAT (UINT64_C(1) << 20) 156359Skucharsk 1570Sstevel@tonic-gate /* AMD */ 1580Sstevel@tonic-gate #define MSR_AMD_PATCHLEVEL 0x8b 1590Sstevel@tonic-gate 1600Sstevel@tonic-gate #ifdef __cplusplus 1610Sstevel@tonic-gate } 1620Sstevel@tonic-gate #endif 1630Sstevel@tonic-gate 1640Sstevel@tonic-gate #endif /* !_SYS_CONTROLREGS_H */ 165