misc.hh revision 9470
14684SN/A/*
25419SN/A * Copyright (c) 2007-2008 The Hewlett-Packard Development Company
34684SN/A * All rights reserved.
44684SN/A *
57087SN/A * The license below extends only to copyright in the software and shall
67087SN/A * not be construed as granting a license to any other intellectual
77087SN/A * property including but not limited to intellectual property relating
87087SN/A * to a hardware implementation of the functionality of the software
97087SN/A * licensed hereunder.  You may use the software subject to the license
107087SN/A * terms below provided that you ensure that this notice is replicated
117087SN/A * unmodified and in its entirety in all distributions of the software,
127087SN/A * modified or unmodified, in source code or in binary form.
134684SN/A *
147087SN/A * Redistribution and use in source and binary forms, with or without
157087SN/A * modification, are permitted provided that the following conditions are
167087SN/A * met: redistributions of source code must retain the above copyright
177087SN/A * notice, this list of conditions and the following disclaimer;
187087SN/A * redistributions in binary form must reproduce the above copyright
197087SN/A * notice, this list of conditions and the following disclaimer in the
207087SN/A * documentation and/or other materials provided with the distribution;
217087SN/A * neither the name of the copyright holders nor the names of its
224684SN/A * contributors may be used to endorse or promote products derived from
237087SN/A * this software without specific prior written permission.
244684SN/A *
254684SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
264684SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
274684SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
284684SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
294684SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
304684SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
314684SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
324684SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
334684SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
344684SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
354684SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
364684SN/A *
374684SN/A * Authors: Gabe Black
384684SN/A */
394684SN/A
404684SN/A#ifndef __ARCH_X86_MISCREGS_HH__
414684SN/A#define __ARCH_X86_MISCREGS_HH__
424684SN/A
437629Sgblack@eecs.umich.edu#include "arch/x86/regs/segment.hh"
445025SN/A#include "arch/x86/x86_traits.hh"
454684SN/A#include "base/bitunion.hh"
464684SN/A
475086SN/A//These get defined in some system headers (at least termbits.h). That confuses
485086SN/A//things here significantly.
495086SN/A#undef CR0
505086SN/A#undef CR2
515086SN/A#undef CR3
525086SN/A
534684SN/Anamespace X86ISA
544684SN/A{
554684SN/A    enum CondFlagBit {
564684SN/A        CFBit = 1 << 0,
574684SN/A        PFBit = 1 << 2,
584684SN/A        ECFBit = 1 << 3,
594684SN/A        AFBit = 1 << 4,
604684SN/A        EZFBit = 1 << 5,
614684SN/A        ZFBit = 1 << 6,
624684SN/A        SFBit = 1 << 7,
634868SN/A        DFBit = 1 << 10,
644684SN/A        OFBit = 1 << 11
654684SN/A    };
664684SN/A
679010Snilay@cs.wisc.edu    const uint32_t cfofMask = CFBit | OFBit;
689211Snilay@cs.wisc.edu    const uint32_t ccFlagMask = PFBit | AFBit | ZFBit | SFBit;
699010Snilay@cs.wisc.edu
705426SN/A    enum RFLAGBit {
715426SN/A        TFBit = 1 << 8,
725426SN/A        IFBit = 1 << 9,
735426SN/A        NTBit = 1 << 14,
745426SN/A        RFBit = 1 << 16,
755426SN/A        VMBit = 1 << 17,
765426SN/A        ACBit = 1 << 18,
775426SN/A        VIFBit = 1 << 19,
785426SN/A        VIPBit = 1 << 20,
795426SN/A        IDBit = 1 << 21
805426SN/A    };
815426SN/A
829470Snilay@cs.wisc.edu    enum X87StatusBit {
839470Snilay@cs.wisc.edu        // Exception Flags
849470Snilay@cs.wisc.edu        IEBit = 1 << 0,
859470Snilay@cs.wisc.edu        DEBit = 1 << 1,
869470Snilay@cs.wisc.edu        ZEBit = 1 << 2,
879470Snilay@cs.wisc.edu        OEBit = 1 << 3,
889470Snilay@cs.wisc.edu        UEBit = 1 << 4,
899470Snilay@cs.wisc.edu        PEBit = 1 << 5,
909470Snilay@cs.wisc.edu
919470Snilay@cs.wisc.edu        // !Exception Flags
929470Snilay@cs.wisc.edu        StackFaultBit = 1 << 6,
939470Snilay@cs.wisc.edu        ErrSummaryBit = 1 << 7,
949470Snilay@cs.wisc.edu        CC0Bit = 1 << 8,
959470Snilay@cs.wisc.edu        CC1Bit = 1 << 9,
969470Snilay@cs.wisc.edu        CC2Bit = 1 << 10,
979470Snilay@cs.wisc.edu        CC3Bit = 1 << 14,
989470Snilay@cs.wisc.edu        BusyBit = 1 << 15,
999470Snilay@cs.wisc.edu    };
1009470Snilay@cs.wisc.edu
1014700SN/A    enum MiscRegIndex
1024700SN/A    {
1034700SN/A        // Control registers
1044700SN/A        // Most of these are invalid.
1054862SN/A        MISCREG_CR_BASE,
1064862SN/A        MISCREG_CR0 = MISCREG_CR_BASE,
1074700SN/A        MISCREG_CR1,
1084700SN/A        MISCREG_CR2,
1094700SN/A        MISCREG_CR3,
1104700SN/A        MISCREG_CR4,
1114700SN/A        MISCREG_CR5,
1124700SN/A        MISCREG_CR6,
1134700SN/A        MISCREG_CR7,
1144700SN/A        MISCREG_CR8,
1154700SN/A        MISCREG_CR9,
1164700SN/A        MISCREG_CR10,
1174700SN/A        MISCREG_CR11,
1184700SN/A        MISCREG_CR12,
1194700SN/A        MISCREG_CR13,
1204700SN/A        MISCREG_CR14,
1214700SN/A        MISCREG_CR15,
1224700SN/A
1234700SN/A        // Debug registers
1245025SN/A        MISCREG_DR_BASE = MISCREG_CR_BASE + NumCRegs,
1254862SN/A        MISCREG_DR0 = MISCREG_DR_BASE,
1264700SN/A        MISCREG_DR1,
1274700SN/A        MISCREG_DR2,
1284700SN/A        MISCREG_DR3,
1294700SN/A        MISCREG_DR4,
1304700SN/A        MISCREG_DR5,
1314700SN/A        MISCREG_DR6,
1324700SN/A        MISCREG_DR7,
1334700SN/A
1344700SN/A        // Flags register
1355025SN/A        MISCREG_RFLAGS = MISCREG_DR_BASE + NumDRegs,
1364700SN/A
1375429SN/A        //Register to keep handy values like the CPU mode in.
1385429SN/A        MISCREG_M5_REG,
1395429SN/A
1405138SN/A        /*
1415138SN/A         * Model Specific Registers
1425138SN/A         */
1435138SN/A        // Time stamp counter
1445138SN/A        MISCREG_TSC,
1455138SN/A
1465138SN/A        MISCREG_MTRRCAP,
1475138SN/A
1485138SN/A        MISCREG_SYSENTER_CS,
1495138SN/A        MISCREG_SYSENTER_ESP,
1505138SN/A        MISCREG_SYSENTER_EIP,
1515138SN/A
1525138SN/A        MISCREG_MCG_CAP,
1535138SN/A        MISCREG_MCG_STATUS,
1545138SN/A        MISCREG_MCG_CTL,
1555138SN/A
1565138SN/A        MISCREG_DEBUG_CTL_MSR,
1575138SN/A
1585138SN/A        MISCREG_LAST_BRANCH_FROM_IP,
1595138SN/A        MISCREG_LAST_BRANCH_TO_IP,
1605138SN/A        MISCREG_LAST_EXCEPTION_FROM_IP,
1615138SN/A        MISCREG_LAST_EXCEPTION_TO_IP,
1625138SN/A
1635138SN/A        MISCREG_MTRR_PHYS_BASE_BASE,
1645138SN/A        MISCREG_MTRR_PHYS_BASE_0 = MISCREG_MTRR_PHYS_BASE_BASE,
1655138SN/A        MISCREG_MTRR_PHYS_BASE_1,
1665138SN/A        MISCREG_MTRR_PHYS_BASE_2,
1675138SN/A        MISCREG_MTRR_PHYS_BASE_3,
1685138SN/A        MISCREG_MTRR_PHYS_BASE_4,
1695138SN/A        MISCREG_MTRR_PHYS_BASE_5,
1705138SN/A        MISCREG_MTRR_PHYS_BASE_6,
1715138SN/A        MISCREG_MTRR_PHYS_BASE_7,
1726346SN/A        MISCREG_MTRR_PHYS_BASE_END,
1735138SN/A
1746346SN/A        MISCREG_MTRR_PHYS_MASK_BASE = MISCREG_MTRR_PHYS_BASE_END,
1755138SN/A        MISCREG_MTRR_PHYS_MASK_0 = MISCREG_MTRR_PHYS_MASK_BASE,
1765138SN/A        MISCREG_MTRR_PHYS_MASK_1,
1775138SN/A        MISCREG_MTRR_PHYS_MASK_2,
1785138SN/A        MISCREG_MTRR_PHYS_MASK_3,
1795138SN/A        MISCREG_MTRR_PHYS_MASK_4,
1805138SN/A        MISCREG_MTRR_PHYS_MASK_5,
1815138SN/A        MISCREG_MTRR_PHYS_MASK_6,
1825138SN/A        MISCREG_MTRR_PHYS_MASK_7,
1836346SN/A        MISCREG_MTRR_PHYS_MASK_END,
1845138SN/A
1856346SN/A        MISCREG_MTRR_FIX_64K_00000 = MISCREG_MTRR_PHYS_MASK_END,
1865138SN/A        MISCREG_MTRR_FIX_16K_80000,
1875138SN/A        MISCREG_MTRR_FIX_16K_A0000,
1885138SN/A        MISCREG_MTRR_FIX_4K_C0000,
1895149SN/A        MISCREG_MTRR_FIX_4K_C8000,
1905138SN/A        MISCREG_MTRR_FIX_4K_D0000,
1915138SN/A        MISCREG_MTRR_FIX_4K_D8000,
1925138SN/A        MISCREG_MTRR_FIX_4K_E0000,
1935138SN/A        MISCREG_MTRR_FIX_4K_E8000,
1945138SN/A        MISCREG_MTRR_FIX_4K_F0000,
1955138SN/A        MISCREG_MTRR_FIX_4K_F8000,
1965138SN/A
1975138SN/A        MISCREG_PAT,
1985138SN/A
1995138SN/A        MISCREG_DEF_TYPE,
2005138SN/A
2015138SN/A        MISCREG_MC_CTL_BASE,
2025138SN/A        MISCREG_MC0_CTL = MISCREG_MC_CTL_BASE,
2035138SN/A        MISCREG_MC1_CTL,
2045138SN/A        MISCREG_MC2_CTL,
2055138SN/A        MISCREG_MC3_CTL,
2065138SN/A        MISCREG_MC4_CTL,
2075419SN/A        MISCREG_MC5_CTL,
2085419SN/A        MISCREG_MC6_CTL,
2095419SN/A        MISCREG_MC7_CTL,
2106346SN/A        MISCREG_MC_CTL_END,
2115138SN/A
2126346SN/A        MISCREG_MC_STATUS_BASE = MISCREG_MC_CTL_END,
2135138SN/A        MISCREG_MC0_STATUS = MISCREG_MC_STATUS_BASE,
2145138SN/A        MISCREG_MC1_STATUS,
2155138SN/A        MISCREG_MC2_STATUS,
2165138SN/A        MISCREG_MC3_STATUS,
2175138SN/A        MISCREG_MC4_STATUS,
2185419SN/A        MISCREG_MC5_STATUS,
2195419SN/A        MISCREG_MC6_STATUS,
2205419SN/A        MISCREG_MC7_STATUS,
2216346SN/A        MISCREG_MC_STATUS_END,
2225138SN/A
2236346SN/A        MISCREG_MC_ADDR_BASE = MISCREG_MC_STATUS_END,
2245138SN/A        MISCREG_MC0_ADDR = MISCREG_MC_ADDR_BASE,
2255138SN/A        MISCREG_MC1_ADDR,
2265138SN/A        MISCREG_MC2_ADDR,
2275138SN/A        MISCREG_MC3_ADDR,
2285138SN/A        MISCREG_MC4_ADDR,
2295419SN/A        MISCREG_MC5_ADDR,
2305419SN/A        MISCREG_MC6_ADDR,
2315419SN/A        MISCREG_MC7_ADDR,
2326346SN/A        MISCREG_MC_ADDR_END,
2335138SN/A
2346346SN/A        MISCREG_MC_MISC_BASE = MISCREG_MC_ADDR_END,
2355138SN/A        MISCREG_MC0_MISC = MISCREG_MC_MISC_BASE,
2365138SN/A        MISCREG_MC1_MISC,
2375138SN/A        MISCREG_MC2_MISC,
2385138SN/A        MISCREG_MC3_MISC,
2395138SN/A        MISCREG_MC4_MISC,
2405419SN/A        MISCREG_MC5_MISC,
2415419SN/A        MISCREG_MC6_MISC,
2425419SN/A        MISCREG_MC7_MISC,
2436346SN/A        MISCREG_MC_MISC_END,
2445138SN/A
2455135SN/A        // Extended feature enable register
2466346SN/A        MISCREG_EFER = MISCREG_MC_MISC_END,
2475135SN/A
2485138SN/A        MISCREG_STAR,
2495138SN/A        MISCREG_LSTAR,
2505138SN/A        MISCREG_CSTAR,
2515138SN/A
2525138SN/A        MISCREG_SF_MASK,
2535138SN/A
2545138SN/A        MISCREG_KERNEL_GS_BASE,
2555138SN/A
2565138SN/A        MISCREG_TSC_AUX,
2575138SN/A
2585138SN/A        MISCREG_PERF_EVT_SEL_BASE,
2595138SN/A        MISCREG_PERF_EVT_SEL0 = MISCREG_PERF_EVT_SEL_BASE,
2605138SN/A        MISCREG_PERF_EVT_SEL1,
2615138SN/A        MISCREG_PERF_EVT_SEL2,
2625138SN/A        MISCREG_PERF_EVT_SEL3,
2636346SN/A        MISCREG_PERF_EVT_SEL_END,
2645138SN/A
2656346SN/A        MISCREG_PERF_EVT_CTR_BASE = MISCREG_PERF_EVT_SEL_END,
2665138SN/A        MISCREG_PERF_EVT_CTR0 = MISCREG_PERF_EVT_CTR_BASE,
2675138SN/A        MISCREG_PERF_EVT_CTR1,
2685138SN/A        MISCREG_PERF_EVT_CTR2,
2695138SN/A        MISCREG_PERF_EVT_CTR3,
2706346SN/A        MISCREG_PERF_EVT_CTR_END,
2715138SN/A
2726346SN/A        MISCREG_SYSCFG = MISCREG_PERF_EVT_CTR_END,
2735138SN/A
2745138SN/A        MISCREG_IORR_BASE_BASE,
2755138SN/A        MISCREG_IORR_BASE0 = MISCREG_IORR_BASE_BASE,
2765138SN/A        MISCREG_IORR_BASE1,
2776346SN/A        MISCREG_IORR_BASE_END,
2785138SN/A
2796346SN/A        MISCREG_IORR_MASK_BASE = MISCREG_IORR_BASE_END,
2805138SN/A        MISCREG_IORR_MASK0 = MISCREG_IORR_MASK_BASE,
2815138SN/A        MISCREG_IORR_MASK1,
2826346SN/A        MISCREG_IORR_MASK_END,
2835138SN/A
2846346SN/A        MISCREG_TOP_MEM = MISCREG_IORR_MASK_END,
2855138SN/A        MISCREG_TOP_MEM2,
2865138SN/A
2875138SN/A        MISCREG_VM_CR,
2885138SN/A        MISCREG_IGNNE,
2895138SN/A        MISCREG_SMM_CTL,
2905138SN/A        MISCREG_VM_HSAVE_PA,
2915138SN/A
2925138SN/A        /*
2935138SN/A         * Segment registers
2945138SN/A         */
2954700SN/A        // Segment selectors
2964862SN/A        MISCREG_SEG_SEL_BASE,
2974862SN/A        MISCREG_ES = MISCREG_SEG_SEL_BASE,
2984700SN/A        MISCREG_CS,
2994700SN/A        MISCREG_SS,
3004700SN/A        MISCREG_DS,
3014700SN/A        MISCREG_FS,
3024700SN/A        MISCREG_GS,
3035294SN/A        MISCREG_HS,
3045294SN/A        MISCREG_TSL,
3055294SN/A        MISCREG_TSG,
3065294SN/A        MISCREG_LS,
3075294SN/A        MISCREG_MS,
3085294SN/A        MISCREG_TR,
3095294SN/A        MISCREG_IDTR,
3104700SN/A
3114700SN/A        // Hidden segment base field
3125294SN/A        MISCREG_SEG_BASE_BASE = MISCREG_SEG_SEL_BASE + NUM_SEGMENTREGS,
3134862SN/A        MISCREG_ES_BASE = MISCREG_SEG_BASE_BASE,
3144700SN/A        MISCREG_CS_BASE,
3154700SN/A        MISCREG_SS_BASE,
3164700SN/A        MISCREG_DS_BASE,
3174700SN/A        MISCREG_FS_BASE,
3184700SN/A        MISCREG_GS_BASE,
3195294SN/A        MISCREG_HS_BASE,
3205294SN/A        MISCREG_TSL_BASE,
3215294SN/A        MISCREG_TSG_BASE,
3225294SN/A        MISCREG_LS_BASE,
3235294SN/A        MISCREG_MS_BASE,
3245294SN/A        MISCREG_TR_BASE,
3255294SN/A        MISCREG_IDTR_BASE,
3264700SN/A
3275289SN/A        // The effective segment base, ie what is actually added to an
3285289SN/A        // address. In 64 bit mode this can be different from the above,
3295289SN/A        // namely 0.
3305294SN/A        MISCREG_SEG_EFF_BASE_BASE = MISCREG_SEG_BASE_BASE + NUM_SEGMENTREGS,
3315289SN/A        MISCREG_ES_EFF_BASE = MISCREG_SEG_EFF_BASE_BASE,
3325289SN/A        MISCREG_CS_EFF_BASE,
3335289SN/A        MISCREG_SS_EFF_BASE,
3345289SN/A        MISCREG_DS_EFF_BASE,
3355289SN/A        MISCREG_FS_EFF_BASE,
3365289SN/A        MISCREG_GS_EFF_BASE,
3375294SN/A        MISCREG_HS_EFF_BASE,
3385294SN/A        MISCREG_TSL_EFF_BASE,
3395294SN/A        MISCREG_TSG_EFF_BASE,
3405294SN/A        MISCREG_LS_EFF_BASE,
3415294SN/A        MISCREG_MS_EFF_BASE,
3425294SN/A        MISCREG_TR_EFF_BASE,
3435294SN/A        MISCREG_IDTR_EFF_BASE,
3445289SN/A
3454700SN/A        // Hidden segment limit field
3465294SN/A        MISCREG_SEG_LIMIT_BASE = MISCREG_SEG_EFF_BASE_BASE + NUM_SEGMENTREGS,
3474862SN/A        MISCREG_ES_LIMIT = MISCREG_SEG_LIMIT_BASE,
3484700SN/A        MISCREG_CS_LIMIT,
3494700SN/A        MISCREG_SS_LIMIT,
3504700SN/A        MISCREG_DS_LIMIT,
3514700SN/A        MISCREG_FS_LIMIT,
3524700SN/A        MISCREG_GS_LIMIT,
3535294SN/A        MISCREG_HS_LIMIT,
3545294SN/A        MISCREG_TSL_LIMIT,
3555294SN/A        MISCREG_TSG_LIMIT,
3565294SN/A        MISCREG_LS_LIMIT,
3575294SN/A        MISCREG_MS_LIMIT,
3585294SN/A        MISCREG_TR_LIMIT,
3595294SN/A        MISCREG_IDTR_LIMIT,
3604700SN/A
3614700SN/A        // Hidden segment limit attributes
3625294SN/A        MISCREG_SEG_ATTR_BASE = MISCREG_SEG_LIMIT_BASE + NUM_SEGMENTREGS,
3634862SN/A        MISCREG_ES_ATTR = MISCREG_SEG_ATTR_BASE,
3644700SN/A        MISCREG_CS_ATTR,
3654700SN/A        MISCREG_SS_ATTR,
3664700SN/A        MISCREG_DS_ATTR,
3674700SN/A        MISCREG_FS_ATTR,
3684700SN/A        MISCREG_GS_ATTR,
3695294SN/A        MISCREG_HS_ATTR,
3705294SN/A        MISCREG_TSL_ATTR,
3715294SN/A        MISCREG_TSG_ATTR,
3725294SN/A        MISCREG_LS_ATTR,
3735294SN/A        MISCREG_MS_ATTR,
3744700SN/A        MISCREG_TR_ATTR,
3755294SN/A        MISCREG_IDTR_ATTR,
3764700SN/A
3775082SN/A        // Floating point control registers
3785294SN/A        MISCREG_X87_TOP =
3795294SN/A            MISCREG_SEG_ATTR_BASE + NUM_SEGMENTREGS,
3805082SN/A
3816362SN/A        MISCREG_MXCSR,
3826362SN/A        MISCREG_FCW,
3836362SN/A        MISCREG_FSW,
3846362SN/A        MISCREG_FTW,
3856362SN/A        MISCREG_FTAG,
3866362SN/A        MISCREG_FISEG,
3876362SN/A        MISCREG_FIOFF,
3886362SN/A        MISCREG_FOSEG,
3896362SN/A        MISCREG_FOOFF,
3906362SN/A        MISCREG_FOP,
3916362SN/A
3924700SN/A        //XXX Add "Model-Specific Registers"
3934700SN/A
3945360SN/A        MISCREG_APIC_BASE,
3955360SN/A
3965360SN/A        // "Fake" MSRs for internally implemented devices
3975357SN/A        MISCREG_PCI_CONFIG_ADDRESS,
3985357SN/A
3995082SN/A        NUM_MISCREGS
4004700SN/A    };
4014700SN/A
4025025SN/A    static inline MiscRegIndex
4035025SN/A    MISCREG_CR(int index)
4045025SN/A    {
4056346SN/A        assert(index >= 0 && index < NumCRegs);
4065025SN/A        return (MiscRegIndex)(MISCREG_CR_BASE + index);
4075025SN/A    }
4085025SN/A
4095025SN/A    static inline MiscRegIndex
4105025SN/A    MISCREG_DR(int index)
4115025SN/A    {
4126346SN/A        assert(index >= 0 && index < NumDRegs);
4135025SN/A        return (MiscRegIndex)(MISCREG_DR_BASE + index);
4145025SN/A    }
4155025SN/A
4165025SN/A    static inline MiscRegIndex
4175138SN/A    MISCREG_MTRR_PHYS_BASE(int index)
4185138SN/A    {
4196346SN/A        assert(index >= 0 && index < (MISCREG_MTRR_PHYS_BASE_END -
4206346SN/A                                      MISCREG_MTRR_PHYS_BASE_BASE));
4215138SN/A        return (MiscRegIndex)(MISCREG_MTRR_PHYS_BASE_BASE + index);
4225138SN/A    }
4235138SN/A
4245138SN/A    static inline MiscRegIndex
4255138SN/A    MISCREG_MTRR_PHYS_MASK(int index)
4265138SN/A    {
4276346SN/A        assert(index >= 0 && index < (MISCREG_MTRR_PHYS_MASK_END -
4286346SN/A                                      MISCREG_MTRR_PHYS_MASK_BASE));
4295138SN/A        return (MiscRegIndex)(MISCREG_MTRR_PHYS_MASK_BASE + index);
4305138SN/A    }
4315138SN/A
4325138SN/A    static inline MiscRegIndex
4335138SN/A    MISCREG_MC_CTL(int index)
4345138SN/A    {
4356346SN/A        assert(index >= 0 && index < (MISCREG_MC_CTL_END -
4366346SN/A                                      MISCREG_MC_CTL_BASE));
4375138SN/A        return (MiscRegIndex)(MISCREG_MC_CTL_BASE + index);
4385138SN/A    }
4395138SN/A
4405138SN/A    static inline MiscRegIndex
4415138SN/A    MISCREG_MC_STATUS(int index)
4425138SN/A    {
4436346SN/A        assert(index >= 0 && index < (MISCREG_MC_STATUS_END -
4446346SN/A                                      MISCREG_MC_STATUS_BASE));
4455138SN/A        return (MiscRegIndex)(MISCREG_MC_STATUS_BASE + index);
4465138SN/A    }
4475138SN/A
4485138SN/A    static inline MiscRegIndex
4495138SN/A    MISCREG_MC_ADDR(int index)
4505138SN/A    {
4516346SN/A        assert(index >= 0 && index < (MISCREG_MC_ADDR_END -
4526346SN/A                                      MISCREG_MC_ADDR_BASE));
4535138SN/A        return (MiscRegIndex)(MISCREG_MC_ADDR_BASE + index);
4545138SN/A    }
4555138SN/A
4565138SN/A    static inline MiscRegIndex
4575138SN/A    MISCREG_MC_MISC(int index)
4585138SN/A    {
4596346SN/A        assert(index >= 0 && index < (MISCREG_MC_MISC_END -
4606346SN/A                                      MISCREG_MC_MISC_BASE));
4615138SN/A        return (MiscRegIndex)(MISCREG_MC_MISC_BASE + index);
4625138SN/A    }
4635138SN/A
4645138SN/A    static inline MiscRegIndex
4655138SN/A    MISCREG_PERF_EVT_SEL(int index)
4665138SN/A    {
4676346SN/A        assert(index >= 0 && index < (MISCREG_PERF_EVT_SEL_END -
4686346SN/A                                      MISCREG_PERF_EVT_SEL_BASE));
4695138SN/A        return (MiscRegIndex)(MISCREG_PERF_EVT_SEL_BASE + index);
4705138SN/A    }
4715138SN/A
4725138SN/A    static inline MiscRegIndex
4735138SN/A    MISCREG_PERF_EVT_CTR(int index)
4745138SN/A    {
4756346SN/A        assert(index >= 0 && index < (MISCREG_PERF_EVT_CTR_END -
4766346SN/A                                      MISCREG_PERF_EVT_CTR_BASE));
4775138SN/A        return (MiscRegIndex)(MISCREG_PERF_EVT_CTR_BASE + index);
4785138SN/A    }
4795138SN/A
4805138SN/A    static inline MiscRegIndex
4815138SN/A    MISCREG_IORR_BASE(int index)
4825138SN/A    {
4836346SN/A        assert(index >= 0 && index < (MISCREG_IORR_BASE_END -
4846346SN/A                                      MISCREG_IORR_BASE_BASE));
4855138SN/A        return (MiscRegIndex)(MISCREG_IORR_BASE_BASE + index);
4865138SN/A    }
4875138SN/A
4885138SN/A    static inline MiscRegIndex
4895138SN/A    MISCREG_IORR_MASK(int index)
4905138SN/A    {
4916346SN/A        assert(index >= 0 && index < (MISCREG_IORR_MASK_END -
4926346SN/A                                      MISCREG_IORR_MASK_BASE));
4935138SN/A        return (MiscRegIndex)(MISCREG_IORR_MASK_BASE + index);
4945138SN/A    }
4955138SN/A
4965138SN/A    static inline MiscRegIndex
4975025SN/A    MISCREG_SEG_SEL(int index)
4985025SN/A    {
4996346SN/A        assert(index >= 0 && index < NUM_SEGMENTREGS);
5005025SN/A        return (MiscRegIndex)(MISCREG_SEG_SEL_BASE + index);
5015025SN/A    }
5025025SN/A
5035025SN/A    static inline MiscRegIndex
5045025SN/A    MISCREG_SEG_BASE(int index)
5055025SN/A    {
5066346SN/A        assert(index >= 0 && index < NUM_SEGMENTREGS);
5075025SN/A        return (MiscRegIndex)(MISCREG_SEG_BASE_BASE + index);
5085025SN/A    }
5095025SN/A
5105025SN/A    static inline MiscRegIndex
5115289SN/A    MISCREG_SEG_EFF_BASE(int index)
5125289SN/A    {
5136346SN/A        assert(index >= 0 && index < NUM_SEGMENTREGS);
5145289SN/A        return (MiscRegIndex)(MISCREG_SEG_EFF_BASE_BASE + index);
5155289SN/A    }
5165289SN/A
5175289SN/A    static inline MiscRegIndex
5185025SN/A    MISCREG_SEG_LIMIT(int index)
5195025SN/A    {
5206346SN/A        assert(index >= 0 && index < NUM_SEGMENTREGS);
5215025SN/A        return (MiscRegIndex)(MISCREG_SEG_LIMIT_BASE + index);
5225025SN/A    }
5235025SN/A
5245025SN/A    static inline MiscRegIndex
5255025SN/A    MISCREG_SEG_ATTR(int index)
5265025SN/A    {
5276346SN/A        assert(index >= 0 && index < NUM_SEGMENTREGS);
5285025SN/A        return (MiscRegIndex)(MISCREG_SEG_ATTR_BASE + index);
5295025SN/A    }
5305025SN/A
5314700SN/A    /**
5324700SN/A     * A type to describe the condition code bits of the RFLAGS register,
5334700SN/A     * plus two flags, EZF and ECF, which are only visible to microcode.
5344700SN/A     */
5354684SN/A    BitUnion64(CCFlagBits)
5365138SN/A        Bitfield<11> of;
5375138SN/A        Bitfield<7> sf;
5385138SN/A        Bitfield<6> zf;
5395138SN/A        Bitfield<5> ezf;
5405138SN/A        Bitfield<4> af;
5415138SN/A        Bitfield<3> ecf;
5425138SN/A        Bitfield<2> pf;
5435138SN/A        Bitfield<0> cf;
5444684SN/A    EndBitUnion(CCFlagBits)
5454700SN/A
5464700SN/A    /**
5474700SN/A     * RFLAGS
5484700SN/A     */
5494700SN/A    BitUnion64(RFLAGS)
5505138SN/A        Bitfield<21> id; // ID Flag
5515138SN/A        Bitfield<20> vip; // Virtual Interrupt Pending
5525138SN/A        Bitfield<19> vif; // Virtual Interrupt Flag
5535138SN/A        Bitfield<18> ac; // Alignment Check
5545138SN/A        Bitfield<17> vm; // Virtual-8086 Mode
5555138SN/A        Bitfield<16> rf; // Resume Flag
5565138SN/A        Bitfield<14> nt; // Nested Task
5575138SN/A        Bitfield<13, 12> iopl; // I/O Privilege Level
5585138SN/A        Bitfield<11> of; // Overflow Flag
5595138SN/A        Bitfield<10> df; // Direction Flag
5605138SN/A        Bitfield<9> intf; // Interrupt Flag
5615138SN/A        Bitfield<8> tf; // Trap Flag
5625138SN/A        Bitfield<7> sf; // Sign Flag
5635138SN/A        Bitfield<6> zf; // Zero Flag
5645138SN/A        Bitfield<4> af; // Auxiliary Flag
5655138SN/A        Bitfield<2> pf; // Parity Flag
5665138SN/A        Bitfield<0> cf; // Carry Flag
5674700SN/A    EndBitUnion(RFLAGS)
5684700SN/A
5695429SN/A    BitUnion64(HandyM5Reg)
5705429SN/A        Bitfield<0> mode;
5715429SN/A        Bitfield<3, 1> submode;
5725429SN/A        Bitfield<5, 4> cpl;
5736141SN/A        Bitfield<6> paging;
5746141SN/A        Bitfield<7> prot;
5756142SN/A        Bitfield<9, 8> defOp;
5766142SN/A        Bitfield<11, 10> altOp;
5776142SN/A        Bitfield<13, 12> defAddr;
5786142SN/A        Bitfield<15, 14> altAddr;
5796142SN/A        Bitfield<17, 16> stack;
5805429SN/A    EndBitUnion(HandyM5Reg)
5815429SN/A
5824700SN/A    /**
5834700SN/A     * Control registers
5844700SN/A     */
5854700SN/A    BitUnion64(CR0)
5865138SN/A        Bitfield<31> pg; // Paging
5875138SN/A        Bitfield<30> cd; // Cache Disable
5885138SN/A        Bitfield<29> nw; // Not Writethrough
5895138SN/A        Bitfield<18> am; // Alignment Mask
5905138SN/A        Bitfield<16> wp; // Write Protect
5915138SN/A        Bitfield<5> ne; // Numeric Error
5925138SN/A        Bitfield<4> et; // Extension Type
5935138SN/A        Bitfield<3> ts; // Task Switched
5945138SN/A        Bitfield<2> em; // Emulation
5955138SN/A        Bitfield<1> mp; // Monitor Coprocessor
5965138SN/A        Bitfield<0> pe; // Protection Enabled
5974700SN/A    EndBitUnion(CR0)
5984700SN/A
5994700SN/A    // Page Fault Virtual Address
6004700SN/A    BitUnion64(CR2)
6014700SN/A        Bitfield<31, 0> legacy;
6024700SN/A    EndBitUnion(CR2)
6034700SN/A
6044700SN/A    BitUnion64(CR3)
6055138SN/A        Bitfield<51, 12> longPdtb; // Long Mode Page-Directory-Table
6064700SN/A                                   // Base Address
6075138SN/A        Bitfield<31, 12> pdtb; // Non-PAE Addressing Page-Directory-Table
6084700SN/A                               // Base Address
6095138SN/A        Bitfield<31, 5> paePdtb; // PAE Addressing Page-Directory-Table
6104700SN/A                                 // Base Address
6115138SN/A        Bitfield<4> pcd; // Page-Level Cache Disable
6125138SN/A        Bitfield<3> pwt; // Page-Level Writethrough
6134700SN/A    EndBitUnion(CR3)
6144700SN/A
6154700SN/A    BitUnion64(CR4)
6165138SN/A        Bitfield<10> osxmmexcpt; // Operating System Unmasked
6174700SN/A                                 // Exception Support
6185138SN/A        Bitfield<9> osfxsr; // Operating System FXSave/FSRSTOR Support
6195138SN/A        Bitfield<8> pce; // Performance-Monitoring Counter Enable
6205138SN/A        Bitfield<7> pge; // Page-Global Enable
6215138SN/A        Bitfield<6> mce; // Machine Check Enable
6225138SN/A        Bitfield<5> pae; // Physical-Address Extension
6235138SN/A        Bitfield<4> pse; // Page Size Extensions
6245138SN/A        Bitfield<3> de; // Debugging Extensions
6255138SN/A        Bitfield<2> tsd; // Time Stamp Disable
6265138SN/A        Bitfield<1> pvi; // Protected-Mode Virtual Interrupts
6275138SN/A        Bitfield<0> vme; // Virtual-8086 Mode Extensions
6284700SN/A    EndBitUnion(CR4)
6294700SN/A
6304700SN/A    BitUnion64(CR8)
6315138SN/A        Bitfield<3, 0> tpr; // Task Priority Register
6325138SN/A    EndBitUnion(CR8)
6335138SN/A
6345925SN/A    BitUnion64(DR6)
6355925SN/A        Bitfield<0> b0;
6365925SN/A        Bitfield<1> b1;
6375925SN/A        Bitfield<2> b2;
6385925SN/A        Bitfield<3> b3;
6395925SN/A        Bitfield<13> bd;
6405925SN/A        Bitfield<14> bs;
6415925SN/A        Bitfield<15> bt;
6425925SN/A    EndBitUnion(DR6)
6435925SN/A
6445925SN/A    BitUnion64(DR7)
6455925SN/A        Bitfield<0> l0;
6465925SN/A        Bitfield<1> g0;
6475925SN/A        Bitfield<2> l1;
6485925SN/A        Bitfield<3> g1;
6495925SN/A        Bitfield<4> l2;
6505925SN/A        Bitfield<5> g2;
6515925SN/A        Bitfield<6> l3;
6525925SN/A        Bitfield<7> g3;
6535925SN/A        Bitfield<8> le;
6545925SN/A        Bitfield<9> ge;
6555925SN/A        Bitfield<13> gd;
6565925SN/A        Bitfield<17, 16> rw0;
6575925SN/A        Bitfield<19, 18> len0;
6585925SN/A        Bitfield<21, 20> rw1;
6595925SN/A        Bitfield<23, 22> len1;
6605925SN/A        Bitfield<25, 24> rw2;
6615925SN/A        Bitfield<27, 26> len2;
6625925SN/A        Bitfield<29, 28> rw3;
6635925SN/A        Bitfield<31, 30> len3;
6645925SN/A    EndBitUnion(DR7)
6655925SN/A
6665138SN/A    // MTRR capabilities
6675138SN/A    BitUnion64(MTRRcap)
6685138SN/A        Bitfield<7, 0> vcnt; // Variable-Range Register Count
6695138SN/A        Bitfield<8> fix; // Fixed-Range Registers
6705138SN/A        Bitfield<10> wc; // Write-Combining
6715138SN/A    EndBitUnion(MTRRcap)
6725138SN/A
6735138SN/A    /**
6745138SN/A     * SYSENTER configuration registers
6755138SN/A     */
6765138SN/A    BitUnion64(SysenterCS)
6775138SN/A        Bitfield<15, 0> targetCS;
6785138SN/A    EndBitUnion(SysenterCS)
6795138SN/A
6805138SN/A    BitUnion64(SysenterESP)
6815138SN/A        Bitfield<31, 0> targetESP;
6825138SN/A    EndBitUnion(SysenterESP)
6835138SN/A
6845138SN/A    BitUnion64(SysenterEIP)
6855138SN/A        Bitfield<31, 0> targetEIP;
6865138SN/A    EndBitUnion(SysenterEIP)
6875138SN/A
6885138SN/A    /**
6895138SN/A     * Global machine check registers
6905138SN/A     */
6915138SN/A    BitUnion64(McgCap)
6925138SN/A        Bitfield<7, 0> count; // Number of error reporting register banks
6935138SN/A        Bitfield<8> MCGCP; // MCG_CTL register present.
6945138SN/A    EndBitUnion(McgCap)
6955138SN/A
6965138SN/A    BitUnion64(McgStatus)
6975138SN/A        Bitfield<0> ripv; // Restart-IP valid
6985138SN/A        Bitfield<1> eipv; // Error-IP valid
6995138SN/A        Bitfield<2> mcip; // Machine check in-progress
7005138SN/A    EndBitUnion(McgStatus)
7015138SN/A
7025138SN/A    BitUnion64(DebugCtlMsr)
7035138SN/A        Bitfield<0> lbr; // Last-branch record
7045138SN/A        Bitfield<1> btf; // Branch single step
7055138SN/A        Bitfield<2> pb0; // Performance monitoring pin control 0
7065138SN/A        Bitfield<3> pb1; // Performance monitoring pin control 1
7075138SN/A        Bitfield<4> pb2; // Performance monitoring pin control 2
7085138SN/A        Bitfield<5> pb3; // Performance monitoring pin control 3
7095138SN/A        /*uint64_t pb(int index)
7105138SN/A        {
7115138SN/A            return bits(__data, index + 2);
7125138SN/A        }*/
7135138SN/A    EndBitUnion(DebugCtlMsr)
7145138SN/A
7155138SN/A    BitUnion64(MtrrPhysBase)
7165138SN/A        Bitfield<7, 0> type; // Default memory type
7175138SN/A        Bitfield<51, 12> physbase; // Range physical base address
7185138SN/A    EndBitUnion(MtrrPhysBase)
7195138SN/A
7205138SN/A    BitUnion64(MtrrPhysMask)
7215138SN/A        Bitfield<11> valid; // MTRR pair enable
7225138SN/A        Bitfield<51, 12> physmask; // Range physical mask
7235138SN/A    EndBitUnion(MtrrPhysMask)
7245138SN/A
7255138SN/A    BitUnion64(MtrrFixed)
7265138SN/A        /*uint64_t type(int index)
7275138SN/A        {
7285138SN/A            return bits(__data, index * 8 + 7, index * 8);
7295138SN/A        }*/
7305138SN/A    EndBitUnion(MtrrFixed)
7315138SN/A
7325138SN/A    BitUnion64(Pat)
7335138SN/A        /*uint64_t pa(int index)
7345138SN/A        {
7355138SN/A            return bits(__data, index * 8 + 2, index * 8);
7365138SN/A        }*/
7375138SN/A    EndBitUnion(Pat)
7385138SN/A
7395138SN/A    BitUnion64(MtrrDefType)
7405138SN/A        Bitfield<7, 0> type; // Default type
7415138SN/A        Bitfield<10> fe; // Fixed range enable
7425138SN/A        Bitfield<11> e; // MTRR enable
7435138SN/A    EndBitUnion(MtrrDefType)
7445138SN/A
7455138SN/A    /**
7465138SN/A     * Machine check
7475138SN/A     */
7485138SN/A    BitUnion64(McStatus)
7495138SN/A        Bitfield<15,0> mcaErrorCode;
7505138SN/A        Bitfield<31,16> modelSpecificCode;
7515138SN/A        Bitfield<56,32> otherInfo;
7525138SN/A        Bitfield<57> pcc; // Processor-context corrupt
7535138SN/A        Bitfield<58> addrv; // Error-address register valid
7545138SN/A        Bitfield<59> miscv; // Miscellaneous-error register valid
7555138SN/A        Bitfield<60> en; // Error condition enabled
7565138SN/A        Bitfield<61> uc; // Uncorrected error
7575138SN/A        Bitfield<62> over; // Status register overflow
7585138SN/A        Bitfield<63> val; // Valid
7595138SN/A    EndBitUnion(McStatus)
7605138SN/A
7615138SN/A    BitUnion64(McCtl)
7625138SN/A        /*uint64_t en(int index)
7635138SN/A        {
7645138SN/A            return bits(__data, index);
7655138SN/A        }*/
7665138SN/A    EndBitUnion(McCtl)
7675138SN/A
7685138SN/A    // Extended feature enable register
7695138SN/A    BitUnion64(Efer)
7705138SN/A        Bitfield<0> sce; // System call extensions
7715138SN/A        Bitfield<8> lme; // Long mode enable
7725138SN/A        Bitfield<10> lma; // Long mode active
7735138SN/A        Bitfield<11> nxe; // No-execute enable
7745138SN/A        Bitfield<12> svme; // Secure virtual machine enable
7755138SN/A        Bitfield<14> ffxsr; // Fast fxsave/fxrstor
7765138SN/A    EndBitUnion(Efer)
7775138SN/A
7785138SN/A    BitUnion64(Star)
7795138SN/A        Bitfield<31,0> targetEip;
7805138SN/A        Bitfield<47,32> syscallCsAndSs;
7815138SN/A        Bitfield<63,48> sysretCsAndSs;
7825138SN/A    EndBitUnion(Star)
7835138SN/A
7845138SN/A    BitUnion64(SfMask)
7855138SN/A        Bitfield<31,0> mask;
7865138SN/A    EndBitUnion(SfMask)
7875138SN/A
7885138SN/A    BitUnion64(PerfEvtSel)
7895138SN/A        Bitfield<7,0> eventMask;
7905138SN/A        Bitfield<15,8> unitMask;
7915138SN/A        Bitfield<16> usr; // User mode
7925138SN/A        Bitfield<17> os; // Operating-system mode
7935138SN/A        Bitfield<18> e; // Edge detect
7945138SN/A        Bitfield<19> pc; // Pin control
7955138SN/A        Bitfield<20> intEn; // Interrupt enable
7965138SN/A        Bitfield<22> en; // Counter enable
7975138SN/A        Bitfield<23> inv; // Invert mask
7985138SN/A        Bitfield<31,24> counterMask;
7995138SN/A    EndBitUnion(PerfEvtSel)
8005138SN/A
8015138SN/A    BitUnion32(Syscfg)
8025138SN/A        Bitfield<18> mfde; // MtrrFixDramEn
8035138SN/A        Bitfield<19> mfdm; // MtrrFixDramModEn
8045138SN/A        Bitfield<20> mvdm; // MtrrVarDramEn
8055138SN/A        Bitfield<21> tom2; // MtrrTom2En
8065138SN/A    EndBitUnion(Syscfg)
8075138SN/A
8085138SN/A    BitUnion64(IorrBase)
8095138SN/A        Bitfield<3> wr; // WrMem Enable
8105138SN/A        Bitfield<4> rd; // RdMem Enable
8115138SN/A        Bitfield<51,12> physbase; // Range physical base address
8125138SN/A    EndBitUnion(IorrBase)
8135138SN/A
8145138SN/A    BitUnion64(IorrMask)
8155138SN/A        Bitfield<11> v; // I/O register pair enable (valid)
8165138SN/A        Bitfield<51,12> physmask; // Range physical mask
8175138SN/A    EndBitUnion(IorrMask)
8185138SN/A
8195138SN/A    BitUnion64(Tom)
8205138SN/A        Bitfield<51,23> physAddr; // Top of memory physical address
8215138SN/A    EndBitUnion(Tom)
8225138SN/A
8235138SN/A    BitUnion64(VmCrMsr)
8245138SN/A        Bitfield<0> dpd;
8255138SN/A        Bitfield<1> rInit;
8265138SN/A        Bitfield<2> disA20M;
8275138SN/A    EndBitUnion(VmCrMsr)
8285138SN/A
8295138SN/A    BitUnion64(IgnneMsr)
8305138SN/A        Bitfield<0> ignne;
8315138SN/A    EndBitUnion(IgnneMsr)
8325138SN/A
8335138SN/A    BitUnion64(SmmCtlMsr)
8345138SN/A        Bitfield<0> dismiss;
8355138SN/A        Bitfield<1> enter;
8365138SN/A        Bitfield<2> smiCycle;
8375138SN/A        Bitfield<3> exit;
8385138SN/A        Bitfield<4> rsmCycle;
8395138SN/A    EndBitUnion(SmmCtlMsr)
8404700SN/A
8414700SN/A    /**
8424700SN/A     * Segment Selector
8434700SN/A     */
8444700SN/A    BitUnion64(SegSelector)
8455294SN/A        // The following bitfield is not defined in the ISA, but it's useful
8465294SN/A        // when checking selectors in larger data types to make sure they
8475294SN/A        // aren't too large.
8485294SN/A        Bitfield<63, 3> esi; // Extended selector
8495138SN/A        Bitfield<15, 3> si; // Selector Index
8505138SN/A        Bitfield<2> ti; // Table Indicator
8515138SN/A        Bitfield<1, 0> rpl; // Requestor Privilege Level
8524700SN/A    EndBitUnion(SegSelector)
8534700SN/A
8544700SN/A    /**
8554700SN/A     * Segment Descriptors
8564700SN/A     */
8574700SN/A
8584700SN/A    BitUnion64(SegDescriptor)
8594700SN/A        Bitfield<63, 56> baseHigh;
8604700SN/A        Bitfield<39, 16> baseLow;
8615138SN/A        Bitfield<55> g; // Granularity
8625138SN/A        Bitfield<54> d; // Default Operand Size
8635138SN/A        Bitfield<54> b; // Default Operand Size
8645138SN/A        Bitfield<53> l; // Long Attribute Bit
8655138SN/A        Bitfield<52> avl; // Available To Software
8664700SN/A        Bitfield<51, 48> limitHigh;
8674700SN/A        Bitfield<15, 0> limitLow;
8685138SN/A        Bitfield<47> p; // Present
8695138SN/A        Bitfield<46, 45> dpl; // Descriptor Privilege-Level
8705138SN/A        Bitfield<44> s; // System
8714700SN/A        SubBitUnion(type, 43, 40)
8724700SN/A            // Specifies whether this descriptor is for code or data.
8734700SN/A            Bitfield<43> codeOrData;
8744700SN/A
8754700SN/A            // These bit fields are for code segments
8765138SN/A            Bitfield<42> c; // Conforming
8775138SN/A            Bitfield<41> r; // Readable
8784700SN/A
8794700SN/A            // These bit fields are for data segments
8805138SN/A            Bitfield<42> e; // Expand-Down
8815138SN/A            Bitfield<41> w; // Writable
8824700SN/A
8834700SN/A            // This is used for both code and data segments.
8845138SN/A            Bitfield<40> a; // Accessed
8854700SN/A        EndSubBitUnion(type)
8864700SN/A    EndBitUnion(SegDescriptor)
8874700SN/A
8885138SN/A    BitUnion64(SegAttr)
8896222SN/A        Bitfield<1, 0> dpl;
8906222SN/A        Bitfield<2> unusable;
8916222SN/A        Bitfield<3> defaultSize;
8926222SN/A        Bitfield<4> longMode;
8936222SN/A        Bitfield<5> avl;
8946222SN/A        Bitfield<6> granularity;
8956222SN/A        Bitfield<7> present;
8966222SN/A        Bitfield<11, 8> type;
8976222SN/A        Bitfield<12> writable;
8986222SN/A        Bitfield<13> readable;
8996222SN/A        Bitfield<14> expandDown;
9006222SN/A        Bitfield<15> system;
9015138SN/A    EndBitUnion(SegAttr)
9025138SN/A
9034700SN/A    BitUnion64(GateDescriptor)
9044700SN/A        Bitfield<63, 48> offsetHigh; // Target Code-Segment Offset
9054700SN/A        Bitfield<15, 0> offsetLow; // Target Code-Segment Offset
9064700SN/A        Bitfield<31, 16> selector; // Target Code-Segment Selector
9075138SN/A        Bitfield<47> p; // Present
9085138SN/A        Bitfield<46, 45> dpl; // Descriptor Privilege-Level
9094700SN/A        Bitfield<43, 40> type;
9104700SN/A        Bitfield<36, 32> count; // Parameter Count
9114700SN/A    EndBitUnion(GateDescriptor)
9124700SN/A
9134700SN/A    /**
9144700SN/A     * Descriptor-Table Registers
9154700SN/A     */
9164700SN/A    BitUnion64(GDTR)
9174700SN/A    EndBitUnion(GDTR)
9184700SN/A
9194700SN/A    BitUnion64(IDTR)
9204700SN/A    EndBitUnion(IDTR)
9214700SN/A
9224700SN/A    BitUnion64(LDTR)
9234700SN/A    EndBitUnion(LDTR)
9244700SN/A
9254700SN/A    /**
9264700SN/A     * Task Register
9274700SN/A     */
9284700SN/A    BitUnion64(TR)
9294700SN/A    EndBitUnion(TR)
9305360SN/A
9315360SN/A
9325360SN/A    /**
9335360SN/A     * Local APIC Base Register
9345360SN/A     */
9355360SN/A    BitUnion64(LocalApicBase)
9365360SN/A        Bitfield<51, 12> base;
9375360SN/A        Bitfield<11> enable;
9385360SN/A        Bitfield<8> bsp;
9395360SN/A    EndBitUnion(LocalApicBase)
9408902Sandreas.hansson@arm.com}
9414684SN/A
9424684SN/A#endif // __ARCH_X86_INTREGS_HH__
943