Slide 1Last Time: Floating PointMachine Programming I: BasicsIntel x86 ProcessorsIntel x86 Evolution: MilestonesIntel x86 Processors: OverviewIntel x86 Processors, contd.More InformationNew Species: ia64, then IPF, then Itanium,…x86 Clones: Advanced Micro Devices (AMD)Intel’s 64-BitOur CoverageMachine Programming I: BasicsDefinitionsAssembly Programmer’s ViewTurning C into Object CodeCompiling Into AssemblyAssembly Characteristics: Data TypesAssembly Characteristics: OperationsObject CodeMachine Instruction ExampleDisassembling Object CodeAlternate DisassemblyWhat Can be Disassembled?Machine Programming I: BasicsInteger Registers (IA32)Moving Data: IA32Moving Data: IA32movl Operand CombinationsSimple Memory Addressing ModesUsing Simple Addressing ModesUsing Simple Addressing ModesUnderstanding SwapUnderstanding SwapUnderstanding SwapUnderstanding SwapUnderstanding SwapUnderstanding SwapUnderstanding SwapUnderstanding SwapComplete Memory Addressing ModesCarnegie MellonIntroduction to Computer Systems15-213/18-243, spring 20095th Lecture, Jan. 27th Instructors: Gregory Kesden and Markus PüschelCarnegie MellonLast Time: Floating PointFractional binary numbersIEEE floating point standard: DefinitionExample and propertiesRounding, addition, multiplicationFloating point in CSummaryCarnegie MellonMachine Programming I: BasicsHistory of Intel processors and architecturesC, assembly, machine codeAssembly Basics: Registers, operands, moveCarnegie MellonIntel x86 ProcessorsTotally dominate computer marketEvolutionary designBackwards compatible up until 8086, introduced in 1978Added more features as time goes onComplex instruction set computer (CISC)Many different instructions with many different formatsBut, only small subset encountered with Linux programsHard to match performance of Reduced Instruction Set Computers (RISC)But, Intel has done just that!Carnegie MellonIntel x86 Evolution: MilestonesName Date TransistorsMHz8086 1978 29K 5-10First 16-bit processor. Basis for IBM PC & DOS1MB address space386 1985 275K 16-33First 32 bit processor , referred to as IA32Added “flat addressing”Capable of running Unix32-bit Linux/gcc uses no instructions introduced in later modelsPentium 4F 2005 230M 2800-3800First 64-bit processorMeanwhile, Pentium 4s (Netburst arch.) phased out in favor of “Core” lineCarnegie MellonIntel x86 Processors: OverviewX86-64 / EM64tX86-32/IA32X86-168086286386486PentiumPentium MMXPentium IIIPentium 4Pentium 4EPentium 4FCore 2 DuoCore i7IA: often redefined as latest Intel architecturetimeArchitectures ProcessorsMMXSSESSE2SSE3SSE4Carnegie MellonIntel x86 Processors, contd.Machine Evolution486 1989 1.9MPentium 1993 3.1MPentium/MMX 1997 4.5MPentiumPro 1995 6.5MPentium III 1999 8.2MPentium 4 2001 42MCore 2 Duo 2006 291MAdded FeaturesInstructions to support multimedia operationsParallel operations on 1, 2, and 4-byte data, both integer & FPInstructions to enable more efficient conditional operationsLinux/GCC EvolutionVery limitedCarnegie MellonMore InformationIntel processors (Wikipedia)Intel microarchitecturesCarnegie MellonNew Species: ia64, then IPF, then Itanium,… Name Date TransistorsItanium 200110MFirst shot at 64-bit architecture: first called IA64Radically new instruction set designed for high performanceCan run existing IA32 programsOn-board “x86 engine”Joint project with Hewlett-PackardItanium 2 2002221MBig performance boostItanium 2 Dual-Core 20061.7BItanium has not taken off in marketplaceLack of backward compatibility, no good compiler support, Pentium 4 got too goodCarnegie Mellonx86 Clones: Advanced Micro Devices (AMD)HistoricallyAMD has followed just behind IntelA little bit slower, a lot cheaperThenRecruited top circuit designers from Digital Equipment Corp. and other downward trending companiesBuilt Opteron: tough competitor to Pentium 4Developed x86-64, their own extension to 64 bitsRecentlyIntel much quicker with dual core designIntel currently far ahead in performanceem64t backwards compatible to x86-64Carnegie MellonIntel’s 64-BitIntel Attempted Radical Shift from IA32 to IA64Totally different architecture (Itanium)Executes IA32 code only as legacyPerformance disappointingAMD Stepped in with Evolutionary Solutionx86-64 (now called “AMD64”)Intel Felt Obligated to Focus on IA64Hard to admit mistake or that AMD is better2004: Intel Announces EM64T extension to IA32Extended Memory 64-bit TechnologyAlmost identical to x86-64!Our Saltwater fish machinesMeanwhile: EM64t well introduced, however, still often not used by OS, programsCarnegie MellonOur CoverageIA32The traditional x86x86-64/EM64TThe emerging standardPresentationBook has IA32Handout has x86-64Lecture will cover bothCarnegie MellonMachine Programming I: BasicsHistory of Intel processors and architecturesC, assembly, machine codeAssembly Basics: Registers, operands, moveCarnegie MellonDefinitionsArchitecture: (also instruction set architecture: ISA) The parts of a processor design that one needs to understand to write assembly code. Microarchitecture: Implementation of the architecture.Architecture examples: instruction set specification, registers.Microarchitecture examples: cache sizes and core frequency.Example ISAs (Intel): x86, IA, IPFCarnegie MellonCPUAssembly Programmer’s ViewProgrammer-Visible StatePC: Program counterAddress of next instructionCalled “EIP” (IA32) or “RIP” (x86-64)Register fileHeavily used program dataCondition codesStore status information about most recent arithmetic operationUsed for conditional branchingPCRegistersMemoryObject CodeProgram DataOS DataAddressesDataInstructionsStackConditionCodesMemoryByte addressable arrayCode, user data, (some) OS dataIncludes stack used to support proceduresCarnegie MellontexttextbinarybinaryCompiler (gcc -S)Assembler (gcc or as)Linker (gcc or ld)C program (p1.c p2.c)Asm program (p1.s p2.s)Object program (p1.o p2.o)Executable program (p)Static libraries (.a)Turning C into Object CodeCode in files p1.c p2.cCompile with command: gcc -O p1.c p2.c -o pUse optimizations (-O)Put resulting binary in file pCarnegie MellonCompiling Into AssemblyC Codeint sum(int x, int y){ int
View Full Document