Creating a program Flashcards

Understand the program requirements to build a program in assembly.

1
Q

What are the sections of a program?

A

A text section, data section,

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

What is the file extension for a assembly program in Linux system?

A

.asm

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

How do you create a text section.

A

In the editor type:

“section .text”

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

How do you create a data section?

A

“section .data”

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

What goes inside the data section?

A

The message the program needs to print placed inside of the data section.
Ex:
section .data
message: db “Hello World!”

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

What is the linker of a program?

A

It is the entry point of a program.
Ex.
global _start

section .text
_start:

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

How do you invoke a system call?

A

A user space program calls a system call by invoking it with a generated interrupt such as “int 0x80”, “SYSENTER” or VDSO.

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

What are system calls?

A

Provides a interface for user space programs to request the kernel to execute tasks.

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

Where are system calls located?

A

/usr/include/1386-linux-gnu/asm/unistd_32.h

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

What command can be used to count a string in an asm program?

A

mlen equ $-message

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

What system call can be used to write a program to screen?

A

_write identified in a program by the number 4

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

What system call will exit a program?

A

_exit closes a program with the status code given by the programmer.

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

Where in the program is the system call located?

A
It is located in the text section of the program. Below is code to print the message on the screen.
Ex:
_start:
              mov eax, 0x4
               mov ebx, 0x1
               mov ecx, message
               mov edx, mlen
               int 0x80 (invokes syscall)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly