CS208 Introduction to Computer Systems Wednesday, 11 October 2023 + Test Possible: 43 Mean, median: about 30 Toughest page: 2 Meanest individual problem: 8 Opportunities to improve your understanding (and gain a few extra points) - Redo the problems you didn't get full points for - open book, open internet - put your redone problems on separate paper, clearly labeled - staple your redone problems to your original exam - hand in by Wednesday, 10/18, 11:10 AM -- no exceptions - your exam score will be the average of your in-class score and your redo score - please focus on understanding rather than points; you'll be glad you did - If there's interest, I can run a 90-minute review session Monday xor Tuesday. Only if you're interested in attending, please fill out the survey I linked on Slack #announcements ======= + Good alternative textbook: Dive Into Systems - Ch 7, on x86_64: https://diveintosystems.org/book/C7-x86_64/index.html + Short list of key ideas (* for today) * Instructions, operands, and naming suffixes * Registers and their names * Register conventional uses * Instruction pointer (rip) * EFLAGS register - A handful of essential instructions * MOV ADD SUB * CMP * TEST * JMP and its many friends RET CALL - Addressing modes - The stack pointer (rsp) + Questions to learn the answers to - At the moment I call a function (with the call instruction), where are the parameters stored? + Let's play with them - Write a little code that + x86_64 assembly essentials - General data registers (rax, rbx, rcx, rdx, rdi, rsi, r8, r9,...) - Naming of parts of the registers rax = 64 bits (8 bytes) eax = lowest-order 32 bits (4 bytes) in rax ax = lowest-order 16 bits (2 bytes) in rax al = lowest-order 8 bits (1 byte) in rax - Naming the instructions by size of operand movq: "quad word" - 64-bit operands movl: "long word" - 32-bit operands movb: "byte" - 8-bit operands - Special registers rip - the instruction pointer (i.e., the address of the next instruction to be executed) eflags - the "condition codes" saving info about the most recent instruction rsp - the stack pointer - Conventional roles for general registers rax/eax - return value goes here before ret rdi/edi - 1st parameter in function call rsi/esi - 2nd parameter rdx/edx - 3rd parameter rcx/ecx - 4th parameter r8/r8d - 5th parameter r9/r9d - 6th parameter - Addressing modes immediate register ...