Assembly Flashcards
(26 cards)
What is the primary use of AT&T syntax?
AT&T syntax is commonly used in Unix-based systems (Linux, macOS) and by the GNU Assembler (gas)
AT&T syntax differs from Intel syntax in several key ways.
How does the operand order differ between AT&T syntax and Intel syntax?
AT&T syntax uses op src, dest
, while Intel syntax uses op dest, src
.
What is the prefix for registers in AT&T syntax?
The prefix for registers in AT&T syntax is %
.
What is the immediate prefix in AT&T syntax?
The immediate prefix in AT&T syntax is $
.
How is memory referenced in AT&T syntax?
Memory is referenced in AT&T syntax using (%eax)
.
What suffixes are used in AT&T syntax instructions?
AT&T syntax uses suffixes like movl
(long), movb
(byte).
What is the purpose of the %eax
register?
The %eax
register is used as the accumulator for return values.
List the general-purpose registers in x86 assembly.
%eax
%ebx
%ecx
%edx
%esi
%edi
%esp
%ebp
What does the mov
instruction do?
mov
is used to move data from one location to another.
What does the push
instruction do?
The push
instruction places a value onto the stack.
What is the result of the instruction addl %ebx, %eax
?
The result of addl %ebx, %eax
is %eax += %ebx
.
What is the purpose of the fadd
instruction?
fadd
adds two floating-point values in the x87 FPU.
How many x87 FPU registers are there?
There are 8 x87 FPU registers: %st(0)
to %st(7)
.
What is the function of the fld
instruction?
fld
loads a floating-point value from memory into the x87 FPU stack.
What does SIMD stand for?
SIMD stands for Single Instruction, Multiple Data.
What is the purpose of the movaps
instruction?
The movaps
instruction moves aligned packed single-precision floating-point values.
What is the purpose of the .macro
directive in GAS?
The .macro
directive defines a macro for reuse in assembly code.
How do you call a C function from assembly?
You declare the function with .extern
and call it using call
.
What is one optimization technique mentioned in the guide?
Minimizing memory access is one optimization technique.
Fill in the blank: In AT&T syntax, the instruction to subtract is written as _______.
subl
True or False: The int $0x80
instruction is used for system calls in Linux.
True
What is the purpose of the .align
directive?
The .align
directive ensures that the following code is aligned to a specified byte boundary.
What are the XMM registers used for?
XMM registers are used for SIMD operations with packed single and double precision floats.
What does the fdiv
instruction do?
fdiv
divides the value in %st(0)
by the value in another %st
register.