CS208 Introduction to Computer Systems Monday, 9 October 2023 + Next - Intro to x86_64 assembly language and machine language - Using the gdb debugger - How do C constructs get translated into x86_64? + Why learn assembly language? - to better understand C and higher-level languages - it's cool - to understand some vicious security problems - to understand why garbage collection, string classes, Rust, etc. exist - (unlikely for most of you) to become an assembly language programmer + Meet Compiler Explorer (godbolt.org) - Try this int main() { int sum = 0; for (int k = 0; k < 10; k++) { sum += k * k; } return sum; } + x86_64 architecture - registers - register names - notable: EFLAGS register - notable: rip register - memory + A little history - Gordon Moore - Busicom - Intel 4004, 8008, 8080, 8086, 80186, 80286, 80386, 80486, Pentium,... - Book: The Microprocessor: A Biography + C to assembly language - Machine language vs. assembly language - Assembly & loading: hello.asm - object modules - gcc -c - objdump -d - gcc -g -Og ... + Lab + Prep for the puzzles assignment - AT&T vs. Intel notation - Textbook (AT&T) - Jeff (AT&T) - Felix Cloutier (Intel) - References https://www.felixcloutier.com/x86/ https://web.stanford.edu/class/archive/cs/cs107/cs107.1224/guide/x86-64.html - Online discussions - Let's look at one puzzle