Assembly Flashcards

(26 cards)

1
Q

What is the primary use of AT&T syntax?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does the operand order differ between AT&T syntax and Intel syntax?

A

AT&T syntax uses op src, dest, while Intel syntax uses op dest, src.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the prefix for registers in AT&T syntax?

A

The prefix for registers in AT&T syntax is %.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the immediate prefix in AT&T syntax?

A

The immediate prefix in AT&T syntax is $.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How is memory referenced in AT&T syntax?

A

Memory is referenced in AT&T syntax using (%eax).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What suffixes are used in AT&T syntax instructions?

A

AT&T syntax uses suffixes like movl (long), movb (byte).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the purpose of the %eax register?

A

The %eax register is used as the accumulator for return values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

List the general-purpose registers in x86 assembly.

A
  • %eax
  • %ebx
  • %ecx
  • %edx
  • %esi
  • %edi
  • %esp
  • %ebp
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does the mov instruction do?

A

mov is used to move data from one location to another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the push instruction do?

A

The push instruction places a value onto the stack.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the result of the instruction addl %ebx, %eax?

A

The result of addl %ebx, %eax is %eax += %ebx.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the purpose of the fadd instruction?

A

fadd adds two floating-point values in the x87 FPU.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How many x87 FPU registers are there?

A

There are 8 x87 FPU registers: %st(0) to %st(7).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the function of the fld instruction?

A

fld loads a floating-point value from memory into the x87 FPU stack.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does SIMD stand for?

A

SIMD stands for Single Instruction, Multiple Data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the purpose of the movaps instruction?

A

The movaps instruction moves aligned packed single-precision floating-point values.

17
Q

What is the purpose of the .macro directive in GAS?

A

The .macro directive defines a macro for reuse in assembly code.

18
Q

How do you call a C function from assembly?

A

You declare the function with .extern and call it using call.

19
Q

What is one optimization technique mentioned in the guide?

A

Minimizing memory access is one optimization technique.

20
Q

Fill in the blank: In AT&T syntax, the instruction to subtract is written as _______.

21
Q

True or False: The int $0x80 instruction is used for system calls in Linux.

22
Q

What is the purpose of the .align directive?

A

The .align directive ensures that the following code is aligned to a specified byte boundary.

23
Q

What are the XMM registers used for?

A

XMM registers are used for SIMD operations with packed single and double precision floats.

24
Q

What does the fdiv instruction do?

A

fdiv divides the value in %st(0) by the value in another %st register.

25
What is the purpose of the `jmp` instruction?
`jmp` is used for unconditional jumps in control flow.
26
What is an example of a basic FPU instruction?
An example is `fadd %st(1), %st(0)` which adds `%st(1)` to `%st(0)`.