x86-64 assembly language Flashcards

(73 cards)

1
Q

how to assemble .asm file with yasm to get object .o file

A

yasm -g dwarf2 -f elf64 example.asm -l example.txt

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

-g dwarf2

A

informs assembler to include debugging info in object file

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

-f elf64

A

informs assembler to create object file in ELF64 format

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

example.asm

A

name of assembly language source file

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

-l example.txt

A

informs assembler to create list file named example.list

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

link object files with ld to get executable program

A

ld -g -o example example.o

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

-g

A

informs linker to include debugging info in final executable file

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

-o example

A

specify and create executable file named example

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

data section of program

A

section .data; holds initialized variables and constants

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

variable format

A

<variableName> <dataType> <initialValue>
</initialValue></dataType></variableName>

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

text section of program

A

section .text; includes instructions

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

starting text section

A

global _start
_start:

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

(data types) db

A

8-bits

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

(data types) dw

A

16-bits

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

(data types) dd

A

32-bits

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

(data types) dq

A

64-bits

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

(data types) ddq

A

128-bit integer

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

(data types) dt

A

128-bit float

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

(data declarations) _Var

A

_bit variable (wVar dw = declaring 16 bit variable)

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

(data declarations) cVar

A

single character (8 bits)

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

(data declarations) strng

A

string

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

(data declarations) arr

A

array

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

(data declarations) flt1

A

float

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

constants are defined as

A

equ

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
lowest 32-bits registers
eax, ebx, ecx, edx, esi, edi, ebp, esp, r8d-r15d
26
64 bit registers
rax, rbx, rcx, rdx, rsi, rdi, rbp, rsp, r8-r15
27
how to access memory
brackets
28
brackets vs no brackets
no brackets obtain address of item, brackets access memory / value stored
29
size qualifiers
byte, dword, qword
30
labels
target or location to jump to for control statements (.loopStart) will know to jump back to that label
31
global
means label will be accessible from outside the file
32
to access variables not in current file
extern
33
addition
add
34
subtraction
sub
35
increment
inc
36
decrement
dec
37
multiplication
imul
38
division
div
39
and
and
40
or
or
41
not
not
42
shift right
shr ,
43
shift right
shr , cl
44
shift left
shl ,
45
shift left
shl , cl
46
shift arithmetic right
sar ,
47
shift arithmetic right
sar , cl
48
jump
jmp
49
compare
cmp
50
jump if equal
je
51
jump if not equal
jne
52
jump if greater than
jg
53
jump if greater or equal
jge
54
jump if less
jl
55
jump if less or equal
jle
56
call
call
57
return
ret
58
put on stack
push
59
take off stack
pop
60
pushing examples
push rax push qword [qVal] --> value push qVal --> address
61
pushing meaning
push 64 bit operand onto stack; first adjust rsp (rsp-8); copy operand to rsp
62
pop meaning
pop 64 bit from the stack; first adjust rsp (rsp+8)
63
item on top of stack
rsp
64
second item on stack
rsp+8
65
third item on stack
rsp+16
66
rip register
points to next instruction to be executed
67
call function
transfer control to named function; saves return address (where to go when function completes); places rip register onto stack
68
ret function
pops current top of stack (rsp) into rip
69
(accessing array elements) [A+8]
value stored at address A plus 8 bits
70
(accessing array elements) general form
base + register * scale + displacement
71
function declaration
global : ; function body ret
72
rsp
stack pointer register
73
rbp
stack base pointer