PyCPUID Documentation

Similar documents
4) C = 96 * B 5) 1 and 3 only 6) 2 and 4 only

Program Exploitation Intro

CS 31: Intro to Systems ISAs and Assembly. Martin Gagné Swarthmore College February 7, 2017

Practical Malware Analysis

Introduction to Machine/Assembler Language

Assembly Language: Overview!

Putting the pieces together

CS Bootcamp x86-64 Autumn 2015

Stepic Plugins Documentation

Memory Models. Registers

CNIT 127: Exploit Development. Ch 3: Shellcode. Updated

Chapter 2. lw $s1,100($s2) $s1 = Memory[$s2+100] sw $s1,100($s2) Memory[$s2+100] = $s1

Topic 6: Code Generation

Reversing. Time to get with the program

Compiler Construction D7011E

Compiler construction. x86 architecture. This lecture. Lecture 6: Code generation for x86. x86: assembly for a real machine.

You may work with a partner on this quiz; both of you must submit your answers.

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College February 9, 2016

Reverse Engineering Low Level Software. CS5375 Software Reverse Engineering Dr. Jaime C. Acosta

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 2: IA-32 Processor Architecture Included elements of the IA-64 bit

CS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College September 25, 2018

What is a Compiler? Compiler Construction SMD163. Why Translation is Needed: Know your Target: Lecture 8: Introduction to code generation

GCC as Optimising Compiler

Kivy Designer Documentation

Important From Last Time

solrq Documentation Release Michał Jaworski

The x86 Architecture

Important From Last Time

Technical Report. Research Lab: LERIA

Credits and Disclaimers

W4118: PC Hardware and x86. Junfeng Yang

Assembly Language Programming 64-bit environments

Software Development. Integrated Software Environment

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Assignment 11: functions, calling conventions, and the stack

Python wrapper for Viscosity.app Documentation

Assembly Language: Overview

Lecture 10 Return-oriented programming. Stephen Checkoway University of Illinois at Chicago Based on slides by Bailey, Brumley, and Miller

Credits and Disclaimers

CNIT 127: Exploit Development. Ch 1: Before you begin. Updated

The x86 Architecture. ICS312 - Spring 2018 Machine-Level and Systems Programming. Henri Casanova

Integers and variables

CS354 gdb Tutorial Written by Chris Feilbach

Integers and variables

Florian Florob Zeitz

CSC 2400: Computer Systems. Key to Success

Lecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86

mith College Computer Science CSC231 Assembly Week #9 Spring 2017 Dominique Thiébaut

AMD PROCESSOR RECOGNITION

Instruction Set Architectures

CSE 351 Section 4 GDB and x86-64 Assembly Hi there! Welcome back to section, we re happy that you re here

Page 1. Today. Important From Last Time. Is the assembly code right? Is the assembly code right? Which compiler is right?

maya-cmds-help Documentation

Intel X86 Assembler Instruction Set Opcode Table

Load Effective Address Part I Written By: Vandad Nahavandi Pour Web-site:

EECE.3170: Microprocessor Systems Design I Summer 2017 Homework 4 Solution

Machine and Assembly Language Principles

CS 220: Introduction to Parallel Computing. Beginning C. Lecture 2

Computer Labs: Profiling and Optimization

Buffer overflow is still one of the most common vulnerabilities being discovered and exploited in commodity software.

How Software Executes

0. The first step of this tutorial is to read the following documents (either in the tutorial or at home):

Machine Programming 1: Introduction

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 21: Generating Pentium Code 10 March 08

TPS Documentation. Release Thomas Roten

What You Need to Know for Project Three. Dave Eckhardt Steve Muckle

CAS CS Computer Systems Spring 2015 Solutions to Problem Set #2 (Intel Instructions) Due: Friday, March 20, 1:00 pm

mith College Computer Science CSC231 Assembly Week #10 Fall 2017 Dominique Thiébaut

Intro to x86 Binaries. From ASM to exploit

How Software Executes

Assembly Language Programming Debugging programs

Running a C program Compilation Python and C Variables and types Data and addresses Functions Performance. John Edgar 2

RISC I from Berkeley. 44k Transistors 1Mhz 77mm^2

gettext.js Documentation

Computer System Architecture

(2½ Hours) [Total Marks: 75]

Cost of Your Programs

We can study computer architectures by starting with the basic building blocks. Adders, decoders, multiplexors, flip-flops, registers,...

x86 assembly CS449 Fall 2017

Lecture #16: Introduction to Runtime Organization. Last modified: Fri Mar 19 00:17: CS164: Lecture #16 1

Is stack overflow still a problem?

mith College Computer Science CSC231 Assembly Week #13 Fall 2017 Dominique Thiébaut

The von Neumann Machine

Django-CSP Documentation

Interlude. Why Object Oriented Programming?

mith College Computer Science CSC231 Assembly Week #12 Thanksgiving 2017 Dominique Thiébaut

Chapter 4. MARIE: An Introduction to a Simple Computer 4.8 MARIE 4.8 MARIE A Discussion on Decoding

CISC220 Lab 2: Due Wed, Sep 26 at Midnight (110 pts)

edeposit.amqp.calibre Release 1.1.4

Subprograms: Arguments

Lecture Outline. Code Generation. Lecture 30. Example of a Stack Machine Program. Stack Machines

seccomp-nurse Nicolas Bareil ekoparty 2010 EADS CSC Innovation Works France seccomp-nurse: sandboxing environment

SFFT Documentation. Release 0.1. Jörn Schumacher

Operating Systems. Part 8. Operating Systems. What is an operating system? Interact with Applications. Vector Tables. The master software

BanzaiDB Documentation

Code Generation. Lecture 30

Credits and Disclaimers

bottle-rest Release 0.5.0

Chapter 4 Processor Architecture: Y86 (Sections 4.1 & 4.3) with material from Dr. Bin Ren, College of William & Mary

CSE351 Autumn 2012 Midterm Exam (5 Nov 2012)

Transcription:

PyCPUID Documentation Release 0.5 Bram de Greve March 13, 2016

Contents 1 Introduction 3 1.1 Installation.............................................. 3 1.2 Source Code............................................. 3 1.3 Documentation............................................ 3 2 Using PyCPUID 5 3 Changes 7 3.1 0.4.................................................. 7 3.2 0.3.................................................. 7 3.3 0.2.................................................. 7 3.4 0.1.................................................. 7 4 To Do 9 5 Credits 11 6 pycpuid 13 6.1 pycpuid Package........................................... 13 7 Indices and tables 15 Python Module Index 17 i

ii

PyCPUID Documentation, Release 0.5 Contents: Contents 1

PyCPUID Documentation, Release 0.5 2 Contents

CHAPTER 1 Introduction PyCPUID reads the information available from the CPUID assembly instruction and makes it available to any Python program. It could be used to decide on some codepath based on whether the target computer supports SSE2. import pycpuid if pycpuid.has_sse2: import foobar_sse2 as foobar else: import foobar It is not the goal of PyCPUID to provide a full report of all CPUID information available. It s merely a way to get raw access to the machine instruction from within Python. Some functions are provided for translation to something human readable, but this is far from complete. Full details on how to interpret the raw data can be found in the application notes of Intel and AMD. Project maintained by Flight Data Services and released under the GNU Lesses General Public License (LGPL- 2.1). 1.1 Installation Package requires pip for installation. pip install PyCPUID If you re doing this on Windows you ll need to make sure you have a C++ compiler installed and properly configured. 1.2 Source Code Source code is available from GitHub: https://github.com/organizations/flightdataservices/pycpuid 1.3 Documentation Documentation is available from the Python Package Index: http://packages.python.org/pycpuid/ 3

PyCPUID Documentation, Release 0.5 4 Chapter 1. Introduction

CHAPTER 2 Using PyCPUID There s not much to it, really. PyCPUID is just a bunch of module constants. Just import the module and access the constants. The HAS_FOOBAR constants are Boolean flags to indicate whether the feature is available. The function features() returns a list of all the available features as strings. There are some other functions like vendor() and brand_string() you can use to identify the CPU. import pycpuid print "has SSE2:", pycpuid.has_sse2 print "all availabe features:", pycpuid.features() print "brand string:", pycpuid.brand_string() 5

PyCPUID Documentation, Release 0.5 6 Chapter 2. Using PyCPUID

CHAPTER 3 Changes 3.1 0.4 Mostly PEP8 compliant. 3.2 0.3 Should now compile on 32-bit and 64-bit platforms. Updated packaging and now uses SetupFixer. Added documentation based on the original text from Bram. 3.3 0.2 The feature abbreviations now resemble the ones in the Intel and AMD documentation. features() is now a function and returns a list of strings, instead of being a comma separated string. Added some functions like vendor() and brand_string() as handy wrappers. PyCPUID is now a combination of a pure python module pycpuid.py and an extension _pycpuid.c. The extension module is only responsible for the actual cpuid call. All the fancy wrapper bits are implemented in Python. Added gcc support. Using cpuid intrinsic on MSVC to support x64. 3.4 0.1 Initial release. 7

PyCPUID Documentation, Release 0.5 8 Chapter 3. Changes

CHAPTER 4 To Do Hopefully, nothing. 9

PyCPUID Documentation, Release 0.5 10 Chapter 4. To Do

CHAPTER 5 Credits PyCPUID was written by Bram de Greve <bram.degreve@bramz.net> and is maintained by Flight Data Services, Ltd <developers@flightdataservices.com>. 11

PyCPUID Documentation, Release 0.5 12 Chapter 5. Credits

CHAPTER 6 pycpuid 6.1 pycpuid Package 6.1.1 pycpuid Package 6.1.2 pycpuid Module pycpuid.pycpuid.brand_id() pycpuid.pycpuid.brand_string() pycpuid.pycpuid.cpuid(infotype) -> (eax, ebx, ecx, edx) pycpuid.pycpuid.family() pycpuid.pycpuid.features() [str, str,...] returns sequence of available features pycpuid.pycpuid.model() pycpuid.pycpuid.processor_type() pycpuid.pycpuid.stepping_id() pycpuid.pycpuid.vendor() 13

PyCPUID Documentation, Release 0.5 14 Chapter 6. pycpuid

CHAPTER 7 Indices and tables genindex modindex search 15

PyCPUID Documentation, Release 0.5 16 Chapter 7. Indices and tables

Python Module Index p pycpuid. init, 13 pycpuid.pycpuid, 13 17

PyCPUID Documentation, Release 0.5 18 Python Module Index

Index B brand_id() (in module pycpuid.pycpuid), 13 brand_string() (in module pycpuid.pycpuid), 13 C cpuid() (in module pycpuid.pycpuid), 13 F family() (in module pycpuid.pycpuid), 13 features() (in module pycpuid.pycpuid), 13 M model() (in module pycpuid.pycpuid), 13 P processor_type() (in module pycpuid.pycpuid), 13 pycpuid. init (module), 13 pycpuid.pycpuid (module), 13 S stepping_id() (in module pycpuid.pycpuid), 13 V vendor() (in module pycpuid.pycpuid), 13 19