ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalDC-221X86 64 Extending Ia32 …
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    DC-221

    Computer Organization and Assembly Language

    Progress0 / 35 done
    Topics35
    1Introduction to Computer Systems2Information is Bits + Context3Programs are Translated by Other Programs4Understanding Compilation Systems5Processors Read and Interpret Instructions6Caches Matter7Storage Devices Form a Hierarchy8The Operating System Manages the Hardware9Systems Communicate Using Networks10Representing and Manipulating Information11Information Storage12Integer Representations13Integer Arithmetic14Floating Point15Machine-Level Representation of Programs16A Historical Perspective17Program Encodings18Data Formats19Accessing Information20Arithmetic and Logical Operations21Control22Procedures23Array Allocation and Access24Heterogeneous Data Structures25Understanding Pointers26Using the GDB Debugger27Out-of-Bounds Memory References and Buffer Overflow
    28Extending IA-32 to 64 Bits29Machine-Level Representations of Floating-Point Programs30Processor Architecture31The Y86 Instruction Set Architecture32Logic Design and the Hardware Control Language (HCL)33Sequential Y86 Implementations34General Principles of Pipelining35Pipelined Y86 Implementations
    7 min read
    Topic 28 of 35
    Topic Study Note Illustration
    28

    x86-64: Extending IA-32 to 64 Bits

    The x86-64 architecture (also known as AMD64 or x64 ) is a 64-bit extension of the IA-32 architecture (also known as x86 ), which was originally a...

    x86-64: Extending IA-32 to 64 Bits

    The x86-64 architecture (also known as AMD64 or x64) is a 64-bit extension of the IA-32 architecture (also known as x86), which was originally a 32-bit architecture. This extension was introduced by AMD in 2003, and later Intel adopted it for their processors as well. The key difference between IA-32 and x86-64 is the transition from 32-bit to 64-bit addressing and processing capabilities.

    Let’s dive into the details of how the x86-64 architecture extends IA-32 to 64-bits, and explore its significance, differences, and how it impacts assembly language programming.


    1. Background: IA-32 (x86) Architecture

    The IA-32 architecture, commonly referred to as x86, is a 32-bit architecture developed by Intel. Key characteristics of IA-32 include:

    • 32-bit registers: All general-purpose registers (such as EAX, EBX, ECX, etc.) are 32 bits wide.
    • 32-bit addressing: Memory addresses are represented by 32-bit values, limiting the addressable memory space to 4 GB.
    • 32-bit data: Data is handled in 32-bit chunks by the processor.

    As the demand for more memory and faster processing grew, there was a need to extend the capabilities of the 32-bit architecture.


    2. The Transition to x86-64

    x86-64 is an extension of the IA-32 architecture, allowing processors to handle 64-bit data, registers, and memory addressing. This transition involved significant changes to the architecture, and these changes provided several key benefits, such as the ability to access larger memory spaces and increased performance in certain types of computations.

    Here’s how x86-64 extends the IA-32 architecture:


    3. Key Features of x86-64

    A. 64-Bit General-Purpose Registers

    In x86-64, the general-purpose registers are extended to 64 bits:

    • Registers like EAX, EBX, etc., are now extended to RAX, RBX, RCX, and so on.
    • In the IA-32 architecture, the registers are 32-bits wide (e.g., EAX), but in x86-64, these are now 64-bits wide (e.g., RAX).

    For example:

    • EAX (32-bit) becomes RAX (64-bit).
    • EBX becomes RBX, ECX becomes RCX, and so on.

    This means that x86-64 can handle 64-bit integers, perform 64-bit arithmetic, and manipulate larger values more efficiently.

    B. 64-Bit Memory Addressing

    • x86-64 extends the IA-32 architecture's 32-bit memory addresses to 64-bit memory addresses. This allows the system to address more than 4 GB of memory (the limit of IA-32).
    • The memory address space is theoretically expanded to 18.4 million TB (18.4 exabytes), although current systems typically implement far less due to hardware and OS limitations.

    C. 64-Bit Data Types

    • In IA-32, data is processed in 32-bit chunks. In x86-64, data can be processed in 64-bit chunks, which is useful for handling larger integers and floating-point numbers more efficiently.
    • For example, a 64-bit long or double can be processed natively by the processor, improving the performance of certain operations.

    D. New Registers and Expanded Register Set

    • x86-64 introduces additional registers that are not present in IA-32:
      • Eight additional general-purpose registers: These are R8 to R15. These provide more registers to work with, allowing for more efficient use of registers during computations and function calls.
      • The XMM registers used for SIMD (Single Instruction, Multiple Data) operations are extended from 128-bits in IA-32 to 256-bits in x86-64 for better handling of multimedia and vector processing.

    E. Extended Stack and Argument Passing

    • In x86-64, the calling convention has changed. While IA-32 uses the stack for all function arguments, x86-64 passes the first six integer arguments in registers (RDI, RSI, RDX, RCX, R8, and R9). This reduces the overhead of pushing and popping values onto the stack for function calls.
    • The stack pointer register is now RSP in x86-64, and the base pointer register is RBP.

    4. Example of Register Changes: IA-32 vs x86-64

    Let’s compare the register changes between IA-32 and x86-64:

    Register IA-32 x86-64
    General-purpose EAX RAX
    EBX RBX
    ECX RCX
    EDX RDX
    ESI RSI
    EDI RDI
    EBP RBP
    ESP RSP
    Additional - R8 - R15

    Example in Assembly:

    • IA-32 assembly (32-bit code):

      mov eax, 5    ; Load the value 5 into the 32-bit EAX register
      add eax, 3    ; Add 3 to EAX
      
    • x86-64 assembly (64-bit code):

      mov rax, 5    ; Load the value 5 into the 64-bit RAX register
      add rax, 3    ; Add 3 to RAX
      

    In x86-64, the registers like RAX are now 64 bits wide, and operations on them can handle much larger values.


    5. Addressing Modes and Instructions

    While IA-32 used 32-bit instructions and addressing modes, x86-64 introduces 64-bit addressing and modifies the instruction set to handle the larger data width. However, the architecture is backward compatible, meaning x86-64 processors can still run 32-bit (IA-32) programs using 32-bit instructions.

    In x86-64, there are instructions that can access 64-bit operands directly, and memory addressing has been extended to 64-bit addresses, allowing programs to access more memory.


    6. Backward Compatibility

    One of the most significant aspects of x86-64 is its backward compatibility with IA-32. This means:

    • An x86-64 processor can run 32-bit programs without modification.
    • A program compiled for IA-32 will still execute on an x86-64 processor, but it will run in 32-bit mode, using only 32-bit registers and memory addressing.

    In contrast, x86-64 programs that use 64-bit features cannot run on an IA-32 processor, as it lacks the necessary 64-bit processing capabilities.


    7. Advantages of x86-64 Over IA-32

    • Larger Address Space: The biggest advantage is the ability to address more memory—up to 18 exabytes, compared to just 4 GB in IA-32.
    • Increased Performance: The expanded registers and the use of 64-bit data allow for faster and more efficient computation, especially for applications that involve large data sets or require high-performance arithmetic operations.
    • More General-Purpose Registers: With additional registers (R8 to R15), x86-64 reduces the need for pushing and popping values onto the stack during function calls, improving performance.
    • Improved SIMD Support: x86-64 extends SIMD (Single Instruction, Multiple Data) instructions, allowing for more parallel processing and better handling of multimedia tasks.

    8. Conclusion

    The x86-64 architecture is an extension of the IA-32 (x86) architecture, adding 64-bit registers, larger memory addressing, and expanded instruction capabilities. This transition from 32-bit to 64-bit enhances the ability of processors to handle larger data, process more memory, and improve performance in modern applications.

    In the context of Computer Organization and Assembly Language (COAL), understanding the transition from IA-32 to x86-64 is essential for low-level programming, as it affects how data is stored, accessed, and processed at the hardware level. Whether you are writing assembly code or working with compiled programs, the move to 64-bit processing allows for more efficient and scalable software development.

    ← Previous topic 27
    Out-of-Bounds Memory References and Buffer Overflow
    Next topic 29 →
    Machine-Level Representations of Floating-Point Programs

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    7mremaining
    1.1kwords
    Intermediatelevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Computer Organization and Assembly Language