1/136
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
A 64 bit register the CPU uses to put addresses for memory accesses on the address bus
Memory Address Register (MAR)
A 64 bit register which the CPU uses to put data on the data bus for writes, or to retrieve data from the data bus for reads from memory
Memory Data Register (MDR)
A collection of intertwined hardware and systems software that must cooperate in order to achieve the ultimate goal of running application programs
System
A directive needed by the linker for symbol resolution, followed by the name of the function
.globl
A logic element that does not store state, the output depends only on the current input
Combinatorial Logic Element
A logic element that is capable of storing state, has memory and can store prior states
Sequential (clocked) Logic Element
A method of optimizing a processor by predicting what instructions will be computed next
Speculative execution
A requirement of the x86-64 ABI, should be satisfied prior to any call.
stack alignment
A value too large for representation
overflow
A value too small to be represented, not as serious because it's comparable to a loss of precision, which can be approximated by zero.
underflow
Address displacement syntax
displacement (src, index, scale)
Adds first argument to second argument
add
Allows a name to be assigned to the assembly language source code file
.file
Arithmic logic unit, sets the condition flags
ALU
.byte data size
1 byte (byte)
Changes or sets the current section to the data section
.data
Changes or sets the current section to the text (or code) section
.text
changing a given bit pattern to a related one
Data Transformation
Computes address math, does not touch memory or affect condition codes
lea
Computes bitwise NOT
not
Computes bitwise OR
or
Computes bitwise XOR
xor
Computes biwise AND
and
Data called by the program that is likely to be called again, EX: indexes in for loops
Temporal Locality
Do displacements require dollar signs?
No
Does the stack grow towards higher or lower addresses?
Lower
Dynamic Ram, slow memory dense needs constant refresh
DRAM
faster than addq one
inc
faster than subq one
dec
Holds static variables in the file scope
Heap
How do you access a member of a structure?
use leaq to find the address, imulq may be needed
How do you access an array that is a member of a structure?
use leaq to find the address, displacement is needed for index
How do you allocate space on the stack?
Subtract from rsp
How do you call malloc in assembler?
put size in rdi and call malloc
How do you go to the value that a memory expression points to in x86-64 ASM?
Use () (this is a memory reference)
How does call figure out what the return address is?
call pushes the return address of the next call instruction
How does lea compute addresses?
lea uses displacement(base,index,scale) formula
How does someone allocate space on the stack?
Move the stack pointer (subq $40, %rsp)
How many registers are in a 64 bit architecture?
16
If a particular piece of data is accessed, nearby addresses are also likely to be accessed. Ex: arrays
Spatial Locality
If we don't ______, we don't know what.
Measure
If we don't ______, we don't know where.
Profile
In what order are multidimensional (nested) arrays created?
Row major order
increment a register
inc
Keeps track of what instruction being executed
Program Counter (PC)
Keyboards, mouse, etc
I/O Devices
Larger memory sizes take more time to access and vice versa.
Memory Hierarchy
.long data size
4 bytes (.long)
Memory that can maintain its value without power
Non-Volatile Memory
Moves a value onto the stack, subtracts quad value to rsp
push
moving data from one system component to another, or within a given component
Data Movement
movq %rsp, %rbp; pop %rbp
leave
Needed by the linker to identify the label as one associated with a function, as opposed to data
.type
Needed by the linker to identify the size of the text for the program
.size
older version of call, not really all that useful because it's slower than other instructions that do the same thing
enter
opcode conditional move
cmov
opcode for unconditional jump
jmp
opcode to jump when equal
je
opcode to jump when not equal
jne
opcode to move and sign extend as it moves
movs
opcode to move and zero extend as it moves
movz
opcode to move data from one register to another
mov
opcode to shift in the sign bit
sar
opcode to shift left
shl
opcode to shift right, add in 0's
shr
Parameter order for registers
rdi, rsi, rdx, rcx, r8, r9
.quad data size
8 bytes (q)
Registers that push values to the stack to be used later
callee-saved register
Removes a value from the stack, adds quad value to rsp
pop
Scratch pad register that will get trashed at function calls
caller-saved register
Sets the flags for SF, ZF, and PF, discards result of bitwise AND
test
Sets the flags, subtracts first argument from second argument
cmp
Similar to preprocessor directives in C, provides information helpful to execution of the file
Assembler Directives
Specifies that the characters enclosed in quotation marks are to be stored in memory, terminated by a null byte
.string
Specifies that the following data is to be placed in the read only memory portion of the executable
.rodata
Static ram, fast, memory intensive
SRAM
Storage held within processor
Cache
storing digital data in a form which balances considerations of cost, reliability, and access speed
Data Storage
Subtracts first argument from second argument
sub
Temp storage for applications being exceuted. SRAM and DRAM
Main Memory
The abstraction of hardware, what our software must comply with
Instruction Set Architecture (ISA)
The execution of a computer program using one or more threads
Process
The style used for floating point math
IEEE 754
This file format combines .o, .out, and .so into a single linking file
Executable Linkage Format (ELF)
This is used by the OS to manage each process in the system
Process Control Block (PCB)
This kind of memory storage is used for the stack, does not allow for direct memory access.
LIFO storage
This makes the specified section the current section
.section (this is important!!)
This register keeps track of the current instruction
Instruction Register (IR)
This storage location has no direct memory access
Stack
Transfers control to a function, uses the parameters in the parameter registers to execute the function as needed
call
Transfers control to the return address located on the stack. This address is usually placed on the stack by a call instruction. This transfers control to the calling function at the instruction following the call.
ret
transfers data between system components or within system components
Bus
This opcode is used for scales not in 1, 2, 4, or 8 bytes.
imul
We have a struct s with members:
{
char name[23];
int age;
int stuff[2];
double height;
int friends;
}
What's the size of the struct?
56 bytes
What are the stack housekeeping calls after a function body is executed?
leave, ret
What are the stack housekeeping calls before a function body is executed?
pushq %rbp, followed by movq rsp, rbp. this makes our stack frame
What coding style is pipeline friendly?
branchless code
What do you have to do with rax before using printf?
set rax to 0 because of floating points, printf
What do you have to do with rax before using scanf?
set rax to 0 because of floating points, scanf
What does the CF flag do?
carry flag. for carrying bits