Chapter 3 Machine Level Representation of Programs Flashcards
Assembly code suffix b represents…
C declaration: Char
Intel data type : Byte
Size: 1 byte
Assembly code suffix w represents…
C declaration: short
Intel data type : Word
Size: 2 bytes
Assembly code suffix l represents
C declaration: int or double
Intel data type : Double word(int), Double precision (double)
Size: 4 bytes (int), 8 bytes(double)
Assembly code suffix q represents:
C declaration: long or char*
Intel data type : Quad word
Size: 8 bytes
Assembly code suffix s
C declaration: float
Intel data type : Single precision
Size: 4 bytes
in x86-64, what is the size of pointers
8 bytes
Return register for 64 bit machine
%rax (r for 64)
Return register for 32 bit machine
%eax (e for 32)
Return register for 16 bit machine
%ax
Data movement instruction
mov
$
immediate value
movzb
Move zero extending byte. These instructions have a register or memory location as the source and a register as the destination
movsbw
move sign-extended byte to word (bw can change to bl, wl… meaning from one type to another)
PC
Program Counter
Importance of PC
Holds address of next instruction
What do Condition codes do
Store status information about most recent arithmetic or logical operation
Used for conditional branching
What is Memory
- Byte addressable array
- Code and user data
- Stack to support procedures
Translate to C
movq $0x4,%rax
Immediate value to register
temp = 0x4
Translate to C
movq $-147,(%rax)
Immediate value to memory
*p = -147
Translate to C
movq %rax,%rdx
register to register
temp2 = temp1