Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 81 additions & 25 deletions cpuid/src/cpu_leaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,6 @@ pub mod leaf_0x4 {
}
}

// Extended Cache Topology Leaf
pub mod leaf_0x8000001d {
pub const LEAF_NUM: u32 = 0x8000_001d;

// inherit eax from leaf_cache_parameters
pub use cpu_leaf::leaf_cache_parameters::eax;
}

// Thermal and Power Management Leaf
pub mod leaf_0x6 {
pub const LEAF_NUM: u32 = 0x6;
Expand Down Expand Up @@ -173,23 +165,6 @@ pub mod leaf_0x7 {
}
}

pub mod leaf_0x80000000 {
pub const LEAF_NUM: u32 = 0x8000_0000;
}

pub mod leaf_0x80000001 {
pub const LEAF_NUM: u32 = 0x8000_0001;

pub mod ecx {
pub const PREFETCH_SHIFT: u32 = 8; // 3DNow! PREFETCH/PREFETCHW instructions
pub const LZCNT_SHIFT: u32 = 5; // advanced bit manipulation
}

pub mod edx {
pub const PDPE1GB_SHIFT: u32 = 26; // 1-GByte pages are available if 1.
}
}

pub mod leaf_0xa {
pub const LEAF_NUM: u32 = 0xa;
}
Expand Down Expand Up @@ -225,3 +200,84 @@ pub mod leaf_0xb {
pub const LEVEL_NUMBER_BITRANGE: BitRange = bit_range!(7, 0);
}
}

pub mod leaf_0x80000000 {
pub const LEAF_NUM: u32 = 0x8000_0000;

pub mod eax {
use bit_helper::BitRange;

pub const LARGEST_EXTENDED_FN_BITRANGE: BitRange = bit_range!(31, 0);
}
}

pub mod leaf_0x80000001 {
pub const LEAF_NUM: u32 = 0x8000_0001;

pub mod ecx {
pub const LZCNT_SHIFT: u32 = 5; // advanced bit manipulation
pub const PREFETCH_SHIFT: u32 = 8; // 3DNow! PREFETCH/PREFETCHW instructions
pub const TOPOEXT_INDEX: u32 = 22;
}

pub mod edx {
pub const PDPE1GB_SHIFT: u32 = 26; // 1-GByte pages are available if 1.
}
}

pub mod leaf_0x80000008 {
pub const LEAF_NUM: u32 = 0x8000_0008;

pub mod ecx {
use bit_helper::BitRange;

// The number of bits in the initial ApicId value that indicate thread ID within a package
// Possible values:
// 0-3 -> Reserved
// 4 -> 1 Die, up to 16 threads
// 5 -> 2 Die, up to 32 threads
// 6 -> 3,4 Die, up to 64 threads
pub const THREAD_ID_SIZE_BITRANGE: BitRange = bit_range!(15, 12);
// The number of threads in the package - 1
pub const NUM_THREADS_BITRANGE: BitRange = bit_range!(7, 0);
}
}

// Extended Cache Topology Leaf
pub mod leaf_0x8000001d {
pub const LEAF_NUM: u32 = 0x8000_001d;

// inherit eax from leaf_cache_parameters
pub use cpu_leaf::leaf_cache_parameters::eax;
}

// Extended APIC ID Leaf
pub mod leaf_0x8000001e {
pub const LEAF_NUM: u32 = 0x8000_001e;

pub mod eax {
use bit_helper::BitRange;

pub const EXTENDED_APIC_ID_BITRANGE: BitRange = bit_range!(31, 0);
}

pub mod ebx {
use bit_helper::BitRange;

// The number of threads per core - 1
pub const THREADS_PER_CORE_BITRANGE: BitRange = bit_range!(15, 8);
pub const CORE_ID_BITRANGE: BitRange = bit_range!(7, 0);
}

pub mod ecx {
use bit_helper::BitRange;

// The number of nodes per processor. Possible values:
// 0 -> 1 node per processor
// 1 -> 2 nodes per processor
// 2 -> Reserved
// 3 -> 4 nodes per processor
pub const NODES_PER_PROCESSOR_BITRANGE: BitRange = bit_range!(10, 8);
pub const NODE_ID_BITRANGE: BitRange = bit_range!(7, 0);
}
}
Loading