@@ -1576,6 +1576,109 @@ bitflags! {
15761576 }
15771577}
15781578
1579+ /// Performance Optimization Identifier (LEAF=0x8000_001A).
1580+ ///
1581+ /// # Platforms
1582+ /// ✅ AMD ❌ Intel
1583+ #[ derive( PartialEq , Eq , Debug ) ]
1584+ pub struct InstructionBasedSamplingCapabilities {
1585+ eax : InstructionBasedSamplingCapabilitiesEax ,
1586+ /// Reserved
1587+ _ebx : u32 ,
1588+ /// Reserved
1589+ _ecx : u32 ,
1590+ /// Reserved
1591+ _edx : u32 ,
1592+ }
1593+
1594+ impl InstructionBasedSamplingCapabilities {
1595+ pub ( crate ) fn new ( data : CpuIdResult ) -> Self {
1596+ Self {
1597+ eax : InstructionBasedSamplingCapabilitiesEax :: from_bits_truncate ( data. eax ) ,
1598+ _ebx : data. ebx ,
1599+ _ecx : data. ecx ,
1600+ _edx : data. edx ,
1601+ }
1602+ }
1603+
1604+ /// IBS feature flags valid if set.
1605+ pub fn has_feature_flags ( & self ) -> bool {
1606+ self . eax
1607+ . contains ( InstructionBasedSamplingCapabilitiesEax :: IBSFFV )
1608+ }
1609+
1610+ /// IBS fetch sampling supported if set.
1611+ pub fn has_fetch_sampling ( & self ) -> bool {
1612+ self . eax
1613+ . contains ( InstructionBasedSamplingCapabilitiesEax :: FETCH_SAM )
1614+ }
1615+
1616+ /// IBS execution sampling supported if set.
1617+ pub fn has_execution_sampling ( & self ) -> bool {
1618+ self . eax
1619+ . contains ( InstructionBasedSamplingCapabilitiesEax :: OP_SAM )
1620+ }
1621+
1622+ /// Read write of op counter supported if set.
1623+ pub fn has_read_write_operation_counter ( & self ) -> bool {
1624+ self . eax
1625+ . contains ( InstructionBasedSamplingCapabilitiesEax :: RD_WR_OP_CNT )
1626+ }
1627+
1628+ /// Op counting mode supported if set.
1629+ pub fn has_operation_counter ( & self ) -> bool {
1630+ self . eax
1631+ . contains ( InstructionBasedSamplingCapabilitiesEax :: OP_CNT )
1632+ }
1633+
1634+ /// Branch target address reporting supported if set.
1635+ pub fn has_branch_target_address_reporting ( & self ) -> bool {
1636+ self . eax
1637+ . contains ( InstructionBasedSamplingCapabilitiesEax :: BRN_TRGT )
1638+ }
1639+
1640+ /// IbsOpCurCnt and IbsOpMaxCnt extend by 7 bits if set.
1641+ pub fn has_operation_counter_extended ( & self ) -> bool {
1642+ self . eax
1643+ . contains ( InstructionBasedSamplingCapabilitiesEax :: OP_CNT_EXT )
1644+ }
1645+
1646+ /// Invalid RIP indication supported if set.
1647+ pub fn has_invalid_rip_indication ( & self ) -> bool {
1648+ self . eax
1649+ . contains ( InstructionBasedSamplingCapabilitiesEax :: RIP_INVALID_CHK )
1650+ }
1651+
1652+ /// Fused branch micro-op indication supported if set.
1653+ pub fn has_fused_branch_micro_op_indication ( & self ) -> bool {
1654+ self . eax
1655+ . contains ( InstructionBasedSamplingCapabilitiesEax :: OP_BRN_FUSE )
1656+ }
1657+
1658+ /// L3 Miss Filtering for IBS supported if set.
1659+ pub fn has_l3_miss_filtering ( & self ) -> bool {
1660+ self . eax
1661+ . contains ( InstructionBasedSamplingCapabilitiesEax :: IBS_L3_MISS_FILTERING )
1662+ }
1663+ }
1664+
1665+ bitflags ! {
1666+ #[ repr( transparent) ]
1667+ #[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
1668+ struct InstructionBasedSamplingCapabilitiesEax : u32 {
1669+ const IBSFFV = 1 << 0 ;
1670+ const FETCH_SAM = 1 << 1 ;
1671+ const OP_SAM = 1 << 2 ;
1672+ const RD_WR_OP_CNT = 1 << 3 ;
1673+ const OP_CNT = 1 << 4 ;
1674+ const BRN_TRGT = 1 << 5 ;
1675+ const OP_CNT_EXT = 1 << 6 ;
1676+ const RIP_INVALID_CHK = 1 << 7 ;
1677+ const OP_BRN_FUSE = 1 << 8 ;
1678+ const IBS_L3_MISS_FILTERING = 1 << 11 ;
1679+ }
1680+ }
1681+
15791682/// Processor Topology Information (LEAF=0x8000_001E).
15801683///
15811684/// # Platforms
0 commit comments