01 introduction Flashcards

1
Q

Parts of the Machine Cycle

A

Fetch, Decode, and Execute

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

Retrieve the instruction from the memory and increment the Program Counter

A

Fetch

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

Decode the bit pattern in the Instruction Register

A

Decode

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

Perform the instruction in the Instruction Register

A

Execute

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

Decodes the bits to determine what should happen

A

CPU

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

Is stored in memory as bunch of bits

A

Instruction

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

Sequence of simple instructions

A

Executable program

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

Where is the sequence stored?

A

Memory

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

True or False
The CPU processes the simple instructions sequentialy.

A

True

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

This is what the computer actually sees and deals with.

A

Machine Language

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

Every command the computer sees is given as ______ or ________

A

a number or sequence of numbers

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

The same as machine language, except the command numbers have been replaced by letter sequences which are easier to memorize

A

Assembly Language

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

Maps human-readable mnemonics to machine instructions

Allows machine-level programming without writing in machine language

A

Assembly Language

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

Makes programming easier

Allow you to describe the program in a more natural language

A

High-level Language

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

Low-level language which provides the basic instructional interface to the computer processor

Is as close to the processor as you can get as a programmer

A

Assembly Language

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

What are the direct controls that Assembly language gives

A
  • setting processor registers
  • accessing memory locations
  • interfacing with other hardware elements
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Reason NOT to use assembly

A
  • Development time: it takes much longer to develop in assembly
  • Maintainability: unstructured
  • Portability: platform-dependent
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Reasons to use assembly

A
  • To understand how CPUs and compilers work
  • Developing compilers, debuggers and other development tools
  • Hardware drivers, system code and low-level tasks such as bootloaders
  • embedded systems
  • Reverse Engineering
  • Address critical performance issues (Optimizing for speed or space)
  • Creating/fighting malware
  • writing low-level programs helps programmers improve algorithm development skills by practicing with a language that requires more thought and more attention to detail.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Devices connected to the bus

A

Input and Output (I/O devices)

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

A collection of the computer’s electrical lines where signals pass through

A

bus

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

The bus is typically designed to transfer fixed-sized chunks of bytes known as _____

A

words

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

The computer’s processor

Engine that interprets (or executes) instructions stored in main memory

A

Central Processing Unit (CPU)

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

Includes the Arithmetic and Logic Unit and CPU Registers

A

CPU chip

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

A logic circuit in the CPU that is responsible for performing mathematical and logical operations

A

Arithmetic and Logic Unit (ALU)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
A set of flip-flops treated as a single unit
Register
26
A digital logic circuit capable of storing a single bit
Flip-flop
27
Temporary storage device that holds both a program and the data it manipulates while the processor is executing the program
Main memory
28
Size in bits and bytes of the following: 1) Byte 2) Word 3) Double-word 4) Quadword 5) Double quadword
bits bytes 8 1 16 2 32 4 64 8 128 16
29
A temporary storage or working location built into the CPU itself (separate from memory) Computations are typically performed by the CPU using this
Register
30
Register that can be accessed with all 64-bits or some portion or subset accessed (e.g., rax, eax, ax, al, rbx, ebx)
General Purpose Registers (GPR)
31
Used to point to the current top of the stack
Stack pointer register (RSP)
32
Used as a base pointer during function calls
Base pointer register (RBP)
33
Used by the CPU to point to the next instruction to be executed
Instruction pointer register (RIP)
34
Used for status and CPU control information Updated by the CPU after each instruction and not directly accessible by programs Stores status information about the instruction that was just executed
Flag register (rFlags)
35
Used to indicate if the previous operation resulted in a carry
Carry (CF)
36
Used to indicate of the last byte has an even number of 1's
Parity (PF)
37
Used to support Binary Coded Decimal operations
Adjust (AF)
38
Used to indicate if the result of the previous operation resulted in a 1 in the most significant bit (indicating negative in the context of signed data)
Sign (SF)
39
Used to specify the direction (increment or decrement for some string operations)
Direction (DF)
40
Used to indicate if the previous operation resulted in an overflow
Overflow (OF)
41
Can be viewed as a series of bytes Each memory address holds one byte of information
Main memory
42
Least Significant Byte (LSB) is stored in the lowest memory address Most Significant Byte (MSB) is stored in the highest memory location
Little-Endian Architecture
43
General memory layout for a program
Memory layout
44
Where the machine language (1's an 0's representing the code) is stored
text (code)
45
Where the initialized data is stored
data
46
Where uninitialized declared variables are stored
BSS
47
Where dynamically allocated data will be stored (if requested)
heap
48
Starts in high memory and grows downward (used by subroutines)
stack
49
All initialized variables and constants are placed in this section
section .data (data section)
50
What is the format for variable definition?
example: SYS_EXIT equ 60 num1 db 21
51
Must start with a letter, followed by letters or numbers, including some special characters (such as the underscore)
Variable names
52
What do you call these: db 8-bit variable dw 16-bit variable dd 32-bit variable dq 64-bit variable
Directives
53
Substituted for their defined values during the assembly process Not assigned a memory location
Constant
54
What is the format for defining constants?
< varname> equ < initVal>
55
All uninitialized variables are placed in this section
section .bss (BSS section)
56
Includes some headers or labels that define the initial program entry point
section .text (text section)
57
with suffix h or x: 7Fh preceded with 0x or 0h: 0x7F
Hexadecimal
58
with suffix q or o: 777q preceded with 0q or 0o: 0q777
Octal
59
Used to start a program comment
semicolon (;)
60
Parts of assembly programming process or compilation system
Preprocessor Compiler Assembler Linker
61
Modifies the original C program according to directives that begin with '#' character
Preprocessing
62
Translates the output text file of the pre-processor into a text file which contains an assembly language program
Compilation
63
Translates compiler output to machine language instructions, generating a relocatable object program
Assembly
64
Handles the merging of the other necessary precompiled object files with the assembler's output, generating an executable file
Linking
65
Parts of Assembly Tool Chain
Assembler Linker Loader Debugger
66
Program that will read an assembly language input file and convert the code into a machine language binary file Comments are removed, and the variable names and labels are converted into appropriate addresses Optionally capable of creating a list file which shows the line number, the relative address, the machine language version of the instruction, and the original source line
Assembler
67
What is the NASM assembler command?
nasm -felf64 < asmFile>.asm
68
Combines one or more object files into a single executable file Any routines from user or system libraries are included as necessary
Linker
69
What is the GNU Linker command?
ld [-o < execFileName>] < objFile>.o
70
Part of the operating system that will load the program from secondary storage into primary storage (main memory) Implicitly invoked by typing the program name
Loader ./< execFileName>
71
Used to control execution of a program This allows for testing and debugging activities to be performed
Debugger gdb < execFileName>
72
GDB command to view the list of functions
info functions
73
GDB command to disassemble functions
disas < function name>
74
GDB command lets you swtich to intel syntax
set disassembly-flavor intel
75
GDB command to run the executable file in gdb
r [< command line arguments>]
76
GDB command to set a breakpoint
b*< function name>[< +offset>]
77
GDB command to inspect registers
info registers or i r
78
GDB command to execute the next instruction
ni
79
GDB command to inspect specific registers
info registers < register name> or i r < register name>
80
GDB command to continue until next breakpoint
c
81
GDB command to examine memory location
x/< n>< f>< u> &< variable> n = number of locations f = format (dec, hex, char, str, float) u = unit size (byte, halfword, word, giant)
82