1 / 9

64-Bit Architectures

64-Bit Architectures. CS 105 “Tour of the Black Holes of Computing!”. Topics 64-bit data New registers and instructions Calling conventions. Data Representations: IA32 + x86-64. Sizes of C Objects (in Bytes) C Data Type Typical 32-bit Intel IA32 x86-64 unsigned 4 4 4

essien
Download Presentation

64-Bit Architectures

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 64-Bit Architectures CS 105“Tour of the Black Holes of Computing!” • Topics • 64-bit data • New registers and instructions • Calling conventions

  2. Data Representations: IA32 + x86-64 Sizes of C Objects (in Bytes) C Data Type Typical 32-bit Intel IA32 x86-64 • unsigned 4 4 4 • int 4 4 4 • long int 4 4 8 • char 1 1 1 • short 2 2 2 • float 4 4 4 • double 8 8 8 • long double 8 10/12 16 • char * 4 4 8Or any other pointer

  3. x86-64 Integer Registers %rax %r8 Oh. %eax %ax ah al %r8d %r8w r8b • Extend existing registers. Add 8 new ones. • Make %ebp/%rbp general purpose %r8w %rbx %r9 %ebx %bx bh bl %r9d %r9w r9b %r9w %rcx %r10 %ecx ch %cx cl %r10d %r10w r10b %r10w My. %rdx %r11 %edx dh %dx dl %r11d %r11w r11b %dx %r11w %rsi %r12 %esi %si sil %r12d %r12w r12b %si %r12w %rdi %r13 %edi %di dil %r13d %r13w r13b %di God. %rsp %r14 %esp %sp spl %r14d %r14w r14b %sp %rbp %r15 %ebp %bp bpl %r15d %r15w r15b %bp

  4. x86-64 Integer Registers %rax %r8 %eax %r8d • Extend existing registers. Add 8 new ones. • Make %ebp/%rbp general purpose %rbx %r9 %ebx %r9d %rcx %r10 %ecx %r10d %rdx %r11 %edx %r11d %rsi %r12 %esi %r12d %rdi %r13 %edi %r13d %rsp %r14 %esp %r14d %rbp %r15 %ebp %r15d

  5. Instructions • Long word l (4 Bytes) ↔ Quad word q (8 Bytes) • New instructions: • movl → movq • addl → addq • sall → salq • movzbq, movslq • etc. • 32-bit instructions that generate 32-bit results • Set higher order bits of destination register to 0 • Example: addl, movl (thus nomovzlq)

  6. Swap in 32-bit Mode swap: pushl %ebp movl %esp,%ebp pushl %ebx movl 12(%ebp),%ecx movl 8(%ebp),%edx movl (%ecx),%eax movl (%edx),%ebx movl %eax,(%edx) movl %ebx,(%ecx) movl -4(%ebp),%ebx movl %ebp,%esp popl %ebp ret void swap(int *xp, int *yp) { int t0 = *xp; int t1 = *yp; *xp = t1; *yp = t0; } Setup Body Finish

  7. Swap in 64-bit Mode • Operands passed in registers (why useful?) • First (xp) in %rdi, second (yp) in %rsi • 64-bit pointers • No stack operations required • 32-bit data • Data held in registers %eax and %edx • movl operation void swap(int *xp, int *yp) { int t0 = *xp; int t1 = *yp; *xp = t1; *yp = t0; } swap: movl (%rdi), %edx movl (%rsi), %eax movl %eax, (%rdi) movl %edx, (%rsi) retq

  8. Swap Long Ints in 64-bit Mode • 64-bit data • Data held in registers %rax and %rdx • movq operation • Otherwise same void swap_l (long int *xp, long int *yp) { long int t0 = *xp; long int t1 = *yp; *xp = t1; *yp = t0; } swap_l: movq (%rdi), %rdx movq (%rsi), %rax movq %rax, (%rdi) movq %rdx, (%rsi) retq

  9. New Calling Conventions • Most procedures no longer need stack frame • First six arguments passed in registers • Register %rbp available for general use • Stack frame accessed via %rsp • 128 bytes below %rsp usable by function (“red zone”)

More Related