-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Binding for the cpuid machine instruction on x86 compatible processors -- -- This module provides the function cpuid for accessing -- information about the currently running IA-32 processor. Both a -- function for calling the cpuid instruction directly, and some -- convenience functions for common uses are provided. This package is -- only portable to IA-32 machines. @package cpuid @version 0.2.2 -- | This module provides the function cpuid for accessing the cpuid -- instruction on modern IA-32 processors. Additionally, some convenience -- functions are provided, which perform some of the (really complicated -- and obstruse) decoding. -- -- As an example, you may use the following program to determine some -- characteristics of your machine: -- --
--   module Main(main) where
--   
--   import Text.Printf (printf, )
--   import System.Cpuid
--   
--   main :: IO ()
--   main = do
--      (a, b, c, d) <- cpuid 0
--      _ <- printf "Basic CPUID usage: EAX=0: %8x %8x %8x %8x\n\n" a b c d
--      _ <- printf "Vendor string: %s\n\n" =<< vendorString
--      _ <- printf "Brand string: %s\n\n" =<< brandString
--      putStrLn "Cache information:"
--      putStrLn . unlines .
--         map (\ v -> "  " ++ show v) =<< cacheInfo
--      p <- processorInfo
--      _ <- printf "Processor info: family: %d, model: %d, stepping: %d, processor type: %d\n"
--         (piFamily p) (piModel p) (piStepping p) (piType p)
--      return ()
--   
module System.Cpuid -- | Execute the cpuid instructions with the given argument in the -- EAX register. Return the values of the registers EAX, EBX, ECX and EDX -- in that order. cpuid :: Word32 -> IO (Word32, Word32, Word32, Word32) -- | Retrieve basic processor information from the processor using the -- cpuid instruction. processorInfo :: IO ProcessorInfo -- | Execute the cpuid instruction and return the vendor string -- reported by that instruction. vendorString :: IO String -- | Execute the cpuid instruction and return the brand string -- (processor name and maximum frequency) reported by that instruction. brandString :: IO String -- | Fetch all available cache information from the processor, using the -- cpuid instruction. The list is not ordered. cacheInfo :: IO [CacheInfo] -- | Cache associativity. For some entries, this is not specified in the -- manual. We report these as DirectMapped. data Associativity SetAssociative :: Ways -> Associativity DirectMapped :: Associativity -- | Page size. Some entries can have alternative page sizes, therefore the -- complicated type. data PageSize PageSize :: Int -> PageSize PageSizeOr :: PageSize -> PageSize -> PageSize -- | Associativity in a set-associative cache. newtype Ways Ways :: Int -> Ways -- | Number of entries in a TLB. newtype Entries Entries :: Int -> Entries -- | Cache size. Some entries can have alternative cache sizes, therefore -- the complicated type. data CacheSize CacheSize :: Int -> CacheSize CacheSizeOr :: CacheSize -> CacheSize -> CacheSize -- | Information for caches and TLBs. data CacheInfo -- | Configuration of code TLB. InstructionTLB :: (Maybe CacheSize) -> PageSize -> Associativity -> Entries -> CacheInfo -- | Configuration of data TLB. DataTLB :: (Maybe CacheSize) -> PageSize -> Associativity -> Entries -> CacheInfo -- | First-level code cache configuration. FirstLevelICache :: CacheSize -> Associativity -> LineSize -> CacheInfo -- | First-level code cache configuration. FirstLevelDCache :: CacheSize -> Associativity -> LineSize -> CacheInfo -- | No second level support. NoSecondLevelCache :: CacheInfo -- | Second-level cache configuration. SecondLevelCache :: CacheSize -> Associativity -> LineSize -> (Maybe BytesPerSector) -> CacheInfo -- | No third level support. NoThirdLevelCache :: CacheInfo -- | Internal use only. NoSecondOrThirdLevelCache :: CacheInfo -- | Second-level cache configuration. ThirdLevelCache :: CacheSize -> Associativity -> LineSize -> (Maybe BytesPerSector) -> CacheInfo -- | Trace cache (1st-level code cache) configuration. TraceCache :: MuOps -> Associativity -> CacheInfo -- | Prefetching information. Prefetching :: Int -> CacheInfo -- | Line size in a cache. newtype LineSize LineSize :: Int -> LineSize -- | MuOps in a processors trace cache. newtype MuOps MuOps :: Int -> MuOps -- | Bytes per sector in a cache. newtype BytesPerSector BytesPerSector :: Int -> BytesPerSector -- | Processor information. data ProcessorInfo ProcessorInfo :: Int -> Int -> Int -> Int -> ProcessorInfo -- | Processor family. piFamily :: ProcessorInfo -> Int -- | Processor model. piModel :: ProcessorInfo -> Int -- | Processor stepping. piStepping :: ProcessorInfo -> Int piType :: ProcessorInfo -> Int features :: IO (FlagSet Feature1C, FlagSet Feature1D) type FlagSet = T Word32 testFlag :: Enum a => a -> FlagSet a -> Bool -- | features as found in page 1, register C data Feature1C sse3 :: Feature1C pclmulqdq :: Feature1C dtes64 :: Feature1C monitor :: Feature1C dscpl :: Feature1C vmx :: Feature1C smx :: Feature1C est :: Feature1C tm2 :: Feature1C ssse3 :: Feature1C cnxtid :: Feature1C fma :: Feature1C cmpxchg16b :: Feature1C xtpr :: Feature1C pdcm :: Feature1C dca :: Feature1C sse4_1 :: Feature1C sse4_2 :: Feature1C x2apic :: Feature1C movbe :: Feature1C popcnt :: Feature1C aes :: Feature1C xsave :: Feature1C osxsave :: Feature1C avx :: Feature1C -- | features as found in page 1, register D data Feature1D fpu :: Feature1D vme :: Feature1D de :: Feature1D pse :: Feature1D tsc :: Feature1D msr :: Feature1D pae :: Feature1D mce :: Feature1D cx8 :: Feature1D apic :: Feature1D sep :: Feature1D mtrr :: Feature1D pge :: Feature1D mca :: Feature1D cmov :: Feature1D pat :: Feature1D pse36 :: Feature1D psn :: Feature1D clfsh :: Feature1D ds :: Feature1D acpi :: Feature1D mmx :: Feature1D fxsr :: Feature1D sse :: Feature1D sse2 :: Feature1D ss :: Feature1D htt :: Feature1D tm :: Feature1D pbe :: Feature1D instance Show Entries instance Show Ways instance Show MuOps instance Show PageSize instance Show CacheSize instance Show LineSize instance Show BytesPerSector instance Show Associativity instance Show CacheInfo instance Eq Feature1C instance Ord Feature1C instance Eq Feature1D instance Ord Feature1D instance Show Feature1D instance Bounded Feature1D instance Enum Feature1D instance Show Feature1C instance Bounded Feature1C instance Enum Feature1C