32-Bit Linux Assembly: Ep.2 – New Sections and File Manipulation Flashcards
What are the three main types of operands?
Register operand
Memory operand
Immediate operand
What does [eax] mean?
Square brackets indicate “the value located at”, so [eax] would mean “the value contained in eax”
value = 0x00408000
0x00408000 contains “0x54”
If the instruction “mov ebx, [value]” is issued, what will the value entered into the ebx register be?
0x54.
What does 70q mean in assembly?
70 in “Octal” notation.
What does 20o mean in assembly?
20 in “Octal” notation.
What does 0b10011000 mean in assembly?
10011000 in binary notation.
What is .bss short for?
Block Started by Symbol (BSS).
What is stored in the .bss section?
Uninitialised variables.
What permissions should the .bss section have?
Writeable but not executable.
What permissions should the .data section have?
Writeable but not executable.
What does the .bss section in an object file contain?
The .bss section stores the length of the units of data that are to be stored there.
What happens to the .bss section when the executable is loaded into memory?
The operating system allocates the amount of memory dictated by the .bss section, to store the uninitialised variables in.
What does resw 2, in assembly mean?
“Reserve” 2 words: 2x 16-bit variables worth of space.
How would you reserve 2 bytes of memory using assembly?
resb 2
How would you reserve 3x32-bits of memory using assembly?
resd 3
Where are uninitialised variables stored?
The .bss section.
Where are initialised variables stored?
The .data section.
What advantage does storing uninitialised variables in the .bss section provide?
Disk space is saved when the executable is not loaded into memory, as only the length of an uninitialised variable is stored in the executable.
What does resd stand for?
Reserve dword.
What does resw stand for?
Reserve word.
How many bits of memory would be reserved by the following line of assembly?
resw 6 ;
6 words = 6x16 bits = 96 bits
How many bits of memory would be reserved by the following line of assembly?
resd 6 ;
6 d-words = 6x32 = 192 bits
How many bits of memory would be reserved by the following line of assembly?
resb 6 ;
6 bytes = 6x8 bits = 48 bits
How many bits of memory would be reserved by the following line of assembly?
resd 2 ;
2 d-words = 2x32 = 64 bits
How many bits of memory would be reserved by the following line of assembly?
resw 3 ;
3 words 3x16 = 48 bits
Which syscall is 3 in x86?
sys_read
What is the call number for the sys_read syscall?
3
How would you execute a sys_read call in x86 assembly?
mov eax, 3 ;
Name one type of operand
The three types are:
- Register operand
- Memory operand
- Immediate operand
What is the third type of operand?
- …
- Register operand
- Memory operand
Immediate operand
What is the third type of operand?
- …
- Immediate operand
- Register operand
Memory operand
What is the third type of operand?
- …
- Immediate operand
- Memory operand
Register operand
What is syscall 8?
sys_create
What is the syscall number for sys_open in 32-bit x86?
5
What is syscall 6 in 32-bit x86?
sys_close
value = 0x00408000
0x00408000 contains “0x54”
If the instruction “mov ebx, value” is issued, what will the value entered into the ebx register be?
0x00408000