ホーム › System.Hypervisor › WHV_X64_CPUID_RESULT
WHV_X64_CPUID_RESULT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Function | DWORD | 4 | +0 | +0 | 対象とするCPUID命令のリーフ番号(EAX入力値)を示す。 |
| Reserved | DWORD | 12 | +4 | +4 | 予約フィールド。アライメント用で0とする。 |
| Eax | DWORD | 4 | +16 | +16 | CPUID命令の戻り値として設定するEAXレジスタ値である。 |
| Ebx | DWORD | 4 | +20 | +20 | CPUID命令の戻り値として設定するEBXレジスタ値である。 |
| Ecx | DWORD | 4 | +24 | +24 | CPUID命令の戻り値として設定するECXレジスタ値である。 |
| Edx | DWORD | 4 | +28 | +28 | CPUID命令の戻り値として設定するEDXレジスタ値である。 |
各言語での定義
#include <windows.h>
// WHV_X64_CPUID_RESULT (x64 32 / x86 32 バイト)
typedef struct WHV_X64_CPUID_RESULT {
DWORD Function;
DWORD Reserved[3];
DWORD Eax;
DWORD Ebx;
DWORD Ecx;
DWORD Edx;
} WHV_X64_CPUID_RESULT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct WHV_X64_CPUID_RESULT
{
public uint Function;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] Reserved;
public uint Eax;
public uint Ebx;
public uint Ecx;
public uint Edx;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure WHV_X64_CPUID_RESULT
Public Function As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Public Reserved() As UInteger
Public Eax As UInteger
Public Ebx As UInteger
Public Ecx As UInteger
Public Edx As UInteger
End Structureimport ctypes
from ctypes import wintypes
class WHV_X64_CPUID_RESULT(ctypes.Structure):
_fields_ = [
("Function", wintypes.DWORD),
("Reserved", wintypes.DWORD * 3),
("Eax", wintypes.DWORD),
("Ebx", wintypes.DWORD),
("Ecx", wintypes.DWORD),
("Edx", wintypes.DWORD),
]#[repr(C)]
pub struct WHV_X64_CPUID_RESULT {
pub Function: u32,
pub Reserved: [u32; 3],
pub Eax: u32,
pub Ebx: u32,
pub Ecx: u32,
pub Edx: u32,
}import "golang.org/x/sys/windows"
type WHV_X64_CPUID_RESULT struct {
Function uint32
Reserved [3]uint32
Eax uint32
Ebx uint32
Ecx uint32
Edx uint32
}type
WHV_X64_CPUID_RESULT = record
Function: DWORD;
Reserved: array[0..2] of DWORD;
Eax: DWORD;
Ebx: DWORD;
Ecx: DWORD;
Edx: DWORD;
end;const WHV_X64_CPUID_RESULT = extern struct {
Function: u32,
Reserved: [3]u32,
Eax: u32,
Ebx: u32,
Ecx: u32,
Edx: u32,
};type
WHV_X64_CPUID_RESULT {.bycopy.} = object
Function: uint32
Reserved: array[3, uint32]
Eax: uint32
Ebx: uint32
Ecx: uint32
Edx: uint32struct WHV_X64_CPUID_RESULT
{
uint Function;
uint[3] Reserved;
uint Eax;
uint Ebx;
uint Ecx;
uint Edx;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WHV_X64_CPUID_RESULT サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Function : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Reserved : DWORD (+4, 12byte) varptr(st)+4 を基点に操作(12byte:入れ子/配列)
; Eax : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Ebx : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; Ecx : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; Edx : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WHV_X64_CPUID_RESULT
#field int Function
#field int Reserved 3
#field int Eax
#field int Ebx
#field int Ecx
#field int Edx
#endstruct
stdim st, WHV_X64_CPUID_RESULT ; NSTRUCT 変数を確保
st->Function = 100
mes "Function=" + st->Function