Win32 API 日本語リファレンス
ホームSystem.Diagnostics.Debug › XSTATE_CONFIGURATION

XSTATE_CONFIGURATION

構造体
サイズx64: 848 バイト / x86: 840 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
EnabledFeaturesULONGLONG8+0+0有効なXSAVE機能を示すビットマスク。
EnabledVolatileFeaturesULONGLONG8+8+8揮発性として扱われる有効機能のマスク。
SizeDWORD4+16+16XSAVE領域全体のサイズ。
Anonymous_Anonymous_e__Union8/4+24+20制御フラグ(最適化XSAVE可否等)を格納する無名共用体。
FeaturesXSTATE_FEATURE512+32+24各XSAVE機能の配置情報(XSTATE_FEATURE)配列。
EnabledSupervisorFeaturesULONGLONG8+544+536有効なスーパバイザ(特権)機能のマスク。
AlignedFeaturesULONGLONG8+552+54464バイト境界整列が必要な機能のマスク。
AllFeatureSizeDWORD4+560+552全機能を含む領域サイズ。
AllFeaturesDWORD256+564+556各機能のサイズを格納する配列。
EnabledUserVisibleSupervisorFeaturesULONGLONG8+824+816ユーザに可視な有効スーパバイザ機能のマスク。
ExtendedFeatureDisableFeaturesULONGLONG8+832+824XFDで無効化可能な機能のマスク。
AllNonLargeFeatureSizeDWORD4+840+832大規模機能を除いた全機能サイズ。
MaxSveVectorLengthWORD2+844+836SVEの最大ベクタ長(ARM64)。
Spare1WORD2+846+838予約フィールド。

共用体: _Anonymous_e__Union x64 8B / x86 4B

フィールドサイズx64x86説明
ControlFlagsDWORD4+0+0
Anonymous_Anonymous_e__Struct8/4+0+0制御フラグ(最適化XSAVE可否等)を格納する無名共用体。

各言語での定義

#include <windows.h>

// XSTATE_FEATURE  (x64 8 / x86 8 バイト)
typedef struct XSTATE_FEATURE {
    DWORD Offset;
    DWORD Size;
} XSTATE_FEATURE;

// XSTATE_CONFIGURATION  (x64 848 / x86 840 バイト)
typedef struct XSTATE_CONFIGURATION {
    ULONGLONG EnabledFeatures;
    ULONGLONG EnabledVolatileFeatures;
    DWORD Size;
    _Anonymous_e__Union Anonymous;
    XSTATE_FEATURE Features[64];
    ULONGLONG EnabledSupervisorFeatures;
    ULONGLONG AlignedFeatures;
    DWORD AllFeatureSize;
    DWORD AllFeatures[64];
    ULONGLONG EnabledUserVisibleSupervisorFeatures;
    ULONGLONG ExtendedFeatureDisableFeatures;
    DWORD AllNonLargeFeatureSize;
    WORD MaxSveVectorLength;
    WORD Spare1;
} XSTATE_CONFIGURATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct XSTATE_FEATURE
{
    public uint Offset;
    public uint Size;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct XSTATE_CONFIGURATION
{
    public ulong EnabledFeatures;
    public ulong EnabledVolatileFeatures;
    public uint Size;
    public _Anonymous_e__Union Anonymous;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public XSTATE_FEATURE[] Features;
    public ulong EnabledSupervisorFeatures;
    public ulong AlignedFeatures;
    public uint AllFeatureSize;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public uint[] AllFeatures;
    public ulong EnabledUserVisibleSupervisorFeatures;
    public ulong ExtendedFeatureDisableFeatures;
    public uint AllNonLargeFeatureSize;
    public ushort MaxSveVectorLength;
    public ushort Spare1;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure XSTATE_FEATURE
    Public Offset As UInteger
    Public Size As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure XSTATE_CONFIGURATION
    Public EnabledFeatures As ULong
    Public EnabledVolatileFeatures As ULong
    Public Size As UInteger
    Public Anonymous As _Anonymous_e__Union
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=64)> Public Features() As XSTATE_FEATURE
    Public EnabledSupervisorFeatures As ULong
    Public AlignedFeatures As ULong
    Public AllFeatureSize As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=64)> Public AllFeatures() As UInteger
    Public EnabledUserVisibleSupervisorFeatures As ULong
    Public ExtendedFeatureDisableFeatures As ULong
    Public AllNonLargeFeatureSize As UInteger
    Public MaxSveVectorLength As UShort
    Public Spare1 As UShort
End Structure
import ctypes
from ctypes import wintypes

class XSTATE_FEATURE(ctypes.Structure):
    _fields_ = [
        ("Offset", wintypes.DWORD),
        ("Size", wintypes.DWORD),
    ]

class XSTATE_CONFIGURATION(ctypes.Structure):
    _fields_ = [
        ("EnabledFeatures", ctypes.c_ulonglong),
        ("EnabledVolatileFeatures", ctypes.c_ulonglong),
        ("Size", wintypes.DWORD),
        ("Anonymous", _Anonymous_e__Union),
        ("Features", XSTATE_FEATURE * 64),
        ("EnabledSupervisorFeatures", ctypes.c_ulonglong),
        ("AlignedFeatures", ctypes.c_ulonglong),
        ("AllFeatureSize", wintypes.DWORD),
        ("AllFeatures", wintypes.DWORD * 64),
        ("EnabledUserVisibleSupervisorFeatures", ctypes.c_ulonglong),
        ("ExtendedFeatureDisableFeatures", ctypes.c_ulonglong),
        ("AllNonLargeFeatureSize", wintypes.DWORD),
        ("MaxSveVectorLength", ctypes.c_ushort),
        ("Spare1", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct XSTATE_FEATURE {
    pub Offset: u32,
    pub Size: u32,
}

#[repr(C)]
pub struct XSTATE_CONFIGURATION {
    pub EnabledFeatures: u64,
    pub EnabledVolatileFeatures: u64,
    pub Size: u32,
    pub Anonymous: _Anonymous_e__Union,
    pub Features: [XSTATE_FEATURE; 64],
    pub EnabledSupervisorFeatures: u64,
    pub AlignedFeatures: u64,
    pub AllFeatureSize: u32,
    pub AllFeatures: [u32; 64],
    pub EnabledUserVisibleSupervisorFeatures: u64,
    pub ExtendedFeatureDisableFeatures: u64,
    pub AllNonLargeFeatureSize: u32,
    pub MaxSveVectorLength: u16,
    pub Spare1: u16,
}
import "golang.org/x/sys/windows"

type XSTATE_FEATURE struct {
	Offset uint32
	Size uint32
}

type XSTATE_CONFIGURATION struct {
	EnabledFeatures uint64
	EnabledVolatileFeatures uint64
	Size uint32
	Anonymous _Anonymous_e__Union
	Features [64]XSTATE_FEATURE
	EnabledSupervisorFeatures uint64
	AlignedFeatures uint64
	AllFeatureSize uint32
	AllFeatures [64]uint32
	EnabledUserVisibleSupervisorFeatures uint64
	ExtendedFeatureDisableFeatures uint64
	AllNonLargeFeatureSize uint32
	MaxSveVectorLength uint16
	Spare1 uint16
}
type
  XSTATE_FEATURE = record
    Offset: DWORD;
    Size: DWORD;
  end;

  XSTATE_CONFIGURATION = record
    EnabledFeatures: UInt64;
    EnabledVolatileFeatures: UInt64;
    Size: DWORD;
    Anonymous: _Anonymous_e__Union;
    Features: array[0..63] of XSTATE_FEATURE;
    EnabledSupervisorFeatures: UInt64;
    AlignedFeatures: UInt64;
    AllFeatureSize: DWORD;
    AllFeatures: array[0..63] of DWORD;
    EnabledUserVisibleSupervisorFeatures: UInt64;
    ExtendedFeatureDisableFeatures: UInt64;
    AllNonLargeFeatureSize: DWORD;
    MaxSveVectorLength: Word;
    Spare1: Word;
  end;
const XSTATE_FEATURE = extern struct {
    Offset: u32,
    Size: u32,
};

const XSTATE_CONFIGURATION = extern struct {
    EnabledFeatures: u64,
    EnabledVolatileFeatures: u64,
    Size: u32,
    Anonymous: _Anonymous_e__Union,
    Features: [64]XSTATE_FEATURE,
    EnabledSupervisorFeatures: u64,
    AlignedFeatures: u64,
    AllFeatureSize: u32,
    AllFeatures: [64]u32,
    EnabledUserVisibleSupervisorFeatures: u64,
    ExtendedFeatureDisableFeatures: u64,
    AllNonLargeFeatureSize: u32,
    MaxSveVectorLength: u16,
    Spare1: u16,
};
type
  XSTATE_FEATURE {.bycopy.} = object
    Offset: uint32
    Size: uint32

  XSTATE_CONFIGURATION {.bycopy.} = object
    EnabledFeatures: uint64
    EnabledVolatileFeatures: uint64
    Size: uint32
    Anonymous: _Anonymous_e__Union
    Features: array[64, XSTATE_FEATURE]
    EnabledSupervisorFeatures: uint64
    AlignedFeatures: uint64
    AllFeatureSize: uint32
    AllFeatures: array[64, uint32]
    EnabledUserVisibleSupervisorFeatures: uint64
    ExtendedFeatureDisableFeatures: uint64
    AllNonLargeFeatureSize: uint32
    MaxSveVectorLength: uint16
    Spare1: uint16
struct XSTATE_FEATURE
{
    uint Offset;
    uint Size;
}

struct XSTATE_CONFIGURATION
{
    ulong EnabledFeatures;
    ulong EnabledVolatileFeatures;
    uint Size;
    _Anonymous_e__Union Anonymous;
    XSTATE_FEATURE[64] Features;
    ulong EnabledSupervisorFeatures;
    ulong AlignedFeatures;
    uint AllFeatureSize;
    uint[64] AllFeatures;
    ulong EnabledUserVisibleSupervisorFeatures;
    ulong ExtendedFeatureDisableFeatures;
    uint AllNonLargeFeatureSize;
    ushort MaxSveVectorLength;
    ushort Spare1;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; XSTATE_CONFIGURATION サイズ: 840 バイト(x86)
dim st, 210    ; 4byte整数×210(構造体サイズ 840 / 4 切り上げ)
; EnabledFeatures : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; EnabledVolatileFeatures : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Size : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+20, 4byte)  varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; Features : XSTATE_FEATURE (+24, 512byte)  varptr(st)+24 を基点に操作(512byte:入れ子/配列)
; EnabledSupervisorFeatures : ULONGLONG (+536, 8byte)  qpoke st,536,値 / qpeek(st,536)  ※IronHSPのみ。3.7/3.8は lpoke st,536,下位 : lpoke st,540,上位
; AlignedFeatures : ULONGLONG (+544, 8byte)  qpoke st,544,値 / qpeek(st,544)  ※IronHSPのみ。3.7/3.8は lpoke st,544,下位 : lpoke st,548,上位
; AllFeatureSize : DWORD (+552, 4byte)  st.138 = 値  /  値 = st.138   (lpoke/lpeek も可)
; AllFeatures : DWORD (+556, 256byte)  varptr(st)+556 を基点に操作(256byte:入れ子/配列)
; EnabledUserVisibleSupervisorFeatures : ULONGLONG (+816, 8byte)  qpoke st,816,値 / qpeek(st,816)  ※IronHSPのみ。3.7/3.8は lpoke st,816,下位 : lpoke st,820,上位
; ExtendedFeatureDisableFeatures : ULONGLONG (+824, 8byte)  qpoke st,824,値 / qpeek(st,824)  ※IronHSPのみ。3.7/3.8は lpoke st,824,下位 : lpoke st,828,上位
; AllNonLargeFeatureSize : DWORD (+832, 4byte)  st.208 = 値  /  値 = st.208   (lpoke/lpeek も可)
; MaxSveVectorLength : WORD (+836, 2byte)  wpoke st,836,値  /  値 = wpeek(st,836)
; Spare1 : WORD (+838, 2byte)  wpoke st,838,値  /  値 = wpeek(st,838)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; XSTATE_CONFIGURATION サイズ: 848 バイト(x64)
dim st, 212    ; 4byte整数×212(構造体サイズ 848 / 4 切り上げ)
; EnabledFeatures : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; EnabledVolatileFeatures : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Size : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; Anonymous : _Anonymous_e__Union (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; Features : XSTATE_FEATURE (+32, 512byte)  varptr(st)+32 を基点に操作(512byte:入れ子/配列)
; EnabledSupervisorFeatures : ULONGLONG (+544, 8byte)  qpoke st,544,値 / qpeek(st,544)  ※IronHSPのみ。3.7/3.8は lpoke st,544,下位 : lpoke st,548,上位
; AlignedFeatures : ULONGLONG (+552, 8byte)  qpoke st,552,値 / qpeek(st,552)  ※IronHSPのみ。3.7/3.8は lpoke st,552,下位 : lpoke st,556,上位
; AllFeatureSize : DWORD (+560, 4byte)  st.140 = 値  /  値 = st.140   (lpoke/lpeek も可)
; AllFeatures : DWORD (+564, 256byte)  varptr(st)+564 を基点に操作(256byte:入れ子/配列)
; EnabledUserVisibleSupervisorFeatures : ULONGLONG (+824, 8byte)  qpoke st,824,値 / qpeek(st,824)  ※IronHSPのみ。3.7/3.8は lpoke st,824,下位 : lpoke st,828,上位
; ExtendedFeatureDisableFeatures : ULONGLONG (+832, 8byte)  qpoke st,832,値 / qpeek(st,832)  ※IronHSPのみ。3.7/3.8は lpoke st,832,下位 : lpoke st,836,上位
; AllNonLargeFeatureSize : DWORD (+840, 4byte)  st.210 = 値  /  値 = st.210   (lpoke/lpeek も可)
; MaxSveVectorLength : WORD (+844, 2byte)  wpoke st,844,値  /  値 = wpeek(st,844)
; Spare1 : WORD (+846, 2byte)  wpoke st,846,値  /  値 = wpeek(st,846)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global XSTATE_FEATURE
    #field int Offset
    #field int Size
#endstruct

#defstruct global XSTATE_CONFIGURATION
    #field int64 EnabledFeatures
    #field int64 EnabledVolatileFeatures
    #field int Size
    #field byte Anonymous 8
    #field XSTATE_FEATURE Features 64
    #field int64 EnabledSupervisorFeatures
    #field int64 AlignedFeatures
    #field int AllFeatureSize
    #field int AllFeatures 64
    #field int64 EnabledUserVisibleSupervisorFeatures
    #field int64 ExtendedFeatureDisableFeatures
    #field int AllNonLargeFeatureSize
    #field short MaxSveVectorLength
    #field short Spare1
#endstruct

stdim st, XSTATE_CONFIGURATION        ; NSTRUCT 変数を確保
st->EnabledFeatures = 100
mes "EnabledFeatures=" + st->EnabledFeatures
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。