Utility routines for identifying features of the processor. More...
Utility routines for identifying features of the processor.
| #define FAMILY_486 4 |
proc_get_family() processor family: 486
| #define FAMILY_ATHLON 6 |
proc_get_family() processor family: Athlon
| #define FAMILY_CORE 6 |
proc_get_family() processor family: Core
| #define FAMILY_CORE_2 6 |
proc_get_family() processor family: Core 2
| #define FAMILY_CORE_I7 6 |
proc_get_family() processor family: Core i7
| #define FAMILY_ITANIUM 7 |
proc_get_family() processor family: Itanium
| #define FAMILY_ITANIUM_2 16 |
proc_get_family() processor family: Itanium 2
| #define FAMILY_ITANIUM_2_DC 17 |
proc_get_family() processor family: Itanium 2 DC
| #define FAMILY_K5 5 |
proc_get_family() processor family: K5
| #define FAMILY_K6 5 |
proc_get_family() processor family: K6
| #define FAMILY_K7 6 |
proc_get_family() processor family: AMD K7
| #define FAMILY_K8 15 |
proc_get_family() processor family: AMD K8
| #define FAMILY_K8_MOBILE 17 |
proc_get_family() processor family: AMD K8 Mobile
| #define FAMILY_K8L 16 |
proc_get_family() processor family: AMD K8L
| #define FAMILY_LLANO 18 |
proc_get_family() processor family: AMD Llano
| #define FAMILY_P4 15 |
proc_get_family() processor family: P4 family
| #define FAMILY_P5 5 |
proc_get_family() processor family: P5 family
| #define FAMILY_P6 6 |
proc_get_family() processor family: P6 family
| #define FAMILY_PENTIUM 5 |
proc_get_family() processor family: Pentium
| #define FAMILY_PENTIUM_2 6 |
proc_get_family() processor family: Pentium 2
| #define FAMILY_PENTIUM_3 6 |
proc_get_family() processor family: Pentium 3
| #define FAMILY_PENTIUM_4 15 |
proc_get_family() processor family: Pentium 4
| #define FAMILY_PENTIUM_M 6 |
proc_get_family() processor family: Pentium M
| #define FAMILY_PENTIUM_PRO 6 |
proc_get_family() processor family: Pentium Pro
| #define MODEL_ATOM 28 |
proc_get_model(): Atom
| #define MODEL_CORE 14 |
proc_get_model(): Core Yonah
| #define MODEL_CORE_2 15 |
proc_get_model(): Core 2 Merom/Conroe
| #define MODEL_CORE_PENRYN 23 |
proc_get_model(): Core 2 Penryn
| #define MODEL_I7_CLARKDALE 37 |
proc_get_model(): Core i7 Clarkdale/Arrandale
| #define MODEL_I7_CLARKSFIELD 30 |
proc_get_model(): Core i7 Clarksfield/Lynnfield
| #define MODEL_I7_GAINESTOWN 26 |
proc_get_model(): Core i7 Gainestown
| #define MODEL_I7_HAVENDALE 31 |
proc_get_model(): Core i7 Havendale/Auburndale
| #define MODEL_I7_WESTMERE 44 |
proc_get_model(): Core i7 Westmere
| #define MODEL_I7_WESTMERE_EX 47 |
proc_get_model(): Core i7 Westmere Ex
| #define MODEL_PENTIUM_M 13 |
proc_get_model(): Pentium M 2MB L2
| #define MODEL_PENTIUM_M_1MB 9 |
proc_get_model(): Pentium M 1MB L2
| #define PAGE_SIZE (4*1024) |
Size of a page of memory. Convenience macro to align to the start of a page of memory.
| anonymous enum |
Constants returned by proc_get_vendor().
| VENDOR_INTEL |
proc_get_vendor() processor identification: Intel |
| VENDOR_AMD |
proc_get_vendor() processor identification: AMD |
| VENDOR_UNKNOWN |
proc_get_vendor() processor identification: unknown |
| enum cache_size_t |
L1 and L2 cache sizes, used by proc_get_L1_icache_size(), proc_get_L1_dcache_size(), proc_get_L2_cache_size(), and proc_get_cache_size_str().
| enum feature_bit_t |
Feature bits returned by cpuid. Pass one of these values to proc_has_feature() to determine whether the underlying processor has the feature.
| bool dr_insert_get_seg_base | ( | void * | drcontext, | |
| instrlist_t * | ilist, | |||
| instr_t * | instr, | |||
| reg_id_t | seg, | |||
| reg_id_t | reg | |||
| ) |
Insert code to get the segment base address pointed to by seg into register reg. In Linux, it is only supported with -mangle_app_seg option. In Windows, it only supports getting base address of the TLS segment.
| void dr_insert_restore_fpstate | ( | void * | drcontext, | |
| instrlist_t * | ilist, | |||
| instr_t * | where, | |||
| opnd_t | buf | |||
| ) |
Inserts into ilist prior to where meta-instruction(s) to restore the floating point state from the 16-byte-aligned buffer referred to by buf, which must be 512 bytes for processors with the FXSR feature, and 108 bytes for those without (where this routine does not support 16-bit operand sizing). buf should have size of OPSZ_512; this routine will automatically adjust it to OPSZ_108 if necessary.
Inserts into ilist prior to where meta-instruction(s) to save the floating point state into the 16-byte-aligned buffer referred to by buf, which must be 512 bytes for processors with the FXSR feature, and 108 bytes for those without (where this routine does not support 16-bit operand sizing). buf should have size of OPSZ_512; this routine will automatically adjust it to OPSZ_108 if necessary.
| ptr_uint_t proc_bump_to_end_of_cache_line | ( | ptr_uint_t | sz | ) |
Returns n >= sz such that n is a multiple of the cache line size.
| size_t proc_fpstate_save_size | ( | void | ) |
Returns the size in bytes needed for a buffer for saving the floating point state.
| features_t* proc_get_all_feature_bits | ( | void | ) |
Returns all 4 32-bit feature values. Use proc_has_feature to test for specific features.
| char* proc_get_brand_string | ( | void | ) |
Returns the processor brand string as given by the cpuid instruction.
| size_t proc_get_cache_line_size | ( | void | ) |
Returns the cache line size in bytes of the processor.
| const char* proc_get_cache_size_str | ( | cache_size_t | size | ) |
Converts a cache_size_t type to a string.
| void* proc_get_containing_page | ( | void * | addr | ) |
Returns n <= addr such that n is a multiple of the page size.
| uint proc_get_family | ( | void | ) |
Returns the processor family as given by the cpuid instruction, adjusted by the extended family as described in the Intel documentation. The FAMILY_ constants identify important family values.
| cache_size_t proc_get_L1_dcache_size | ( | void | ) |
Returns the size of the L1 data cache.
| cache_size_t proc_get_L1_icache_size | ( | void | ) |
Returns the size of the L1 instruction cache.
| cache_size_t proc_get_L2_cache_size | ( | void | ) |
Returns the size of the L2 cache.
| uint proc_get_model | ( | void | ) |
Returns the processor model as given by the cpuid instruction, adjusted by the extended model as described in the Intel documentation. The MODEL_ constants identify important model values.
| uint proc_get_stepping | ( | void | ) |
Returns the processor stepping ID.
| uint proc_get_type | ( | void | ) |
Returns the processor type as given by the cpuid instruction.
| uint proc_get_vendor | ( | void | ) |
Returns one of the VENDOR_ constants.
| bool proc_has_feature | ( | feature_bit_t | feature | ) |
Tests if processor has selected feature.
| bool proc_is_cache_aligned | ( | void * | addr | ) |
Returns true only if addr is cache-line-aligned.
| void proc_restore_fpstate | ( | byte * | buf | ) |
Restores the floating point state from the 16-byte-aligned buffer buf, which must be 512 bytes for processors with the FXSR feature, and 108 bytes for those without (where this routine does not support 16-bit operand sizing).
| size_t proc_save_fpstate | ( | byte * | buf | ) |
Saves the floating point state into the 16-byte-aligned buffer buf, which must be 512 bytes for processors with the FXSR feature, and 108 bytes for those without (where this routine does not support 16-bit operand sizing).
DR does NOT save the application's floating-point, MMX, or SSE state on context switches! Thus if a client performs any floating-point operations in its main routines called by DR, the client must save and restore the floating-point/MMX/SSE state. If the client needs to do so inside the code cache the client should implement that itself. Returns number of bytes written.
| int proc_set_vendor | ( | uint | new_vendor | ) |
Sets the vendor to the given VENDOR_ constant. This function is supplied to support decoding or encoding with respect to other than the current processor being executed on. The change in vendor will be seen by the decoder and encoder, as well as the rest of the system.