📗 -> End of Inline Assembly and Intro to I/O
[Lecture Slide Link]
🎤 Vocab
❗ Unit and Larger Context
Make sure to know:
-
Structs and how they’re allocated
- 1D arrays, except the elements are of different size
Structs:
Structs are like 1D arrays with properties being different sizes
Field Bytes Past Beginning of struct x 0 y 4 s 5 name 7 d 17 f 25
Link to originalTypedef struct Struct_Type{ Int x; Char y; Short s; Char name[10]; Double d; Float f; } Example Struct;
- 1D arrays, except the elements are of different size
-
Access memory
Ordering of Variables
Global Variables
- Stored in order of appearance, so the first global will have the lowest address
Arguments
- Stored in order of appearance, so the first argument will have the lowest address
Locals
- Stored in reverse order of appearance, so the least local will have the lowest address
-
GCC calling conventions
- Caller Saved:
- EAX, ECX, EDX
- Callee Saved:
- The rest
- Caller Saved:
-
How are functions called
- Calling:
- push $label_to_continue
- jmp foo
or - call foo
- Returning
- pop %eip
or - ret
- pop %eip
- Calling:
✒️ -> Scratch Notes
movs (move string) - Moves a value
- can be used to implement memcopy
- “moves a string of bytes, words, or double words from one location to another”
stos(store string) - Copies - can be used for a memset instruction
- “stores a value (byte, word, or double word) into a memory location, incrementing or decrementing the destination pointer (ES:DI) accordingly”
🔗 -> Links
Resources
- Put useful links here
Connections
- Link all related words