From e8616df2031b39535e62dce1142b029e65723c95 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 11 Nov 2026 11:52:21 -0300 Subject: design: the address space as one tall rectangle; aligned as a listing From the user. segments is the textbook picture: one rectangle, high addresses on top, each mapping a band in its ink (heights by the log of their size, holes folded with their size beside them), labels outside on leaders, a file's mappings bracketed as one, the stack's and the heap's growth as arrows, rsp and rip pinned in their bands. aligned is one panel: a line as the head of its instructions, line numbers and addresses in one column since both say where, a rule over every head. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa --- design/mock/32-intro-code.svg | 287 ++++++++++++++++++++---------------------- 1 file changed, 138 insertions(+), 149 deletions(-) (limited to 'design/mock/32-intro-code.svg') diff --git a/design/mock/32-intro-code.svg b/design/mock/32-intro-code.svg index 35597b8..a5eafc0 100644 --- a/design/mock/32-intro-code.svg +++ b/design/mock/32-intro-code.svg @@ -1,155 +1,144 @@ - - - -list.c -each line beside the first of its instructions - - - -disassembly -reverse - - - - - - - - - - - - - - - -20 -while -( -head -) -{ -10019 -10 -48 85 ff -test -rdi, rdi -10019 -13 -74 20 -je -1001935 -10019 -15 -55 -push -rbp -10019 -16 -48 89 e5 -mov -rbp, rsp -10019 -19 -31 c0 -xor -eax, eax -10019 -1b -0f 1f 44 00 00 -nop -[rax + rax] -10019 -20 -48 89 c1 -mov -rcx, rax -10019 -23 -48 89 f8 -mov -rax, rdi - - - - - - -21 -struct -node -* -next -= -head -- -> -next -; -10019 -26 -48 8b 7f 08 -mov -rdi, [rdi + 8] -1004098 - - -1004070 - - -9 -22 -head -- -> -next -= -prev -; -10019 -2a -48 89 48 08 -mov -[rax + 8], rcx -20 -while (head) { -10019 -2e -48 85 ff -test -rdi, rdi -10019 -31 -75 ed -jne -1001920 -10019 -33 -5d -pop -rbp -26 -return -prev -; -10019 -34 -c3 -ret - -10019 -35 -31 c0 -xor -eax, eax -10019 -37 -c3 -ret - + + + +list.c · reverse +each line, then the instructions it compiled to · lines and addresses in one column + + +20 +while +( +head +) +{ +1001 +910 +48 85 ff +test +rdi, rdi +1001 +913 +74 20 +je +1001935 +1001 +915 +55 +push +rbp +1001 +916 +48 89 e5 +mov +rbp, rsp +1001 +919 +31 c0 +xor +eax, eax +1001 +91b +0f 1f 44 00 00 +nop +[rax + rax] +1001 +920 +48 89 c1 +mov +rcx, rax +1001 +923 +48 89 f8 +mov +rax, rdi + + + +21 +struct +node +* +next += +head +- +> +next +; + + + +1001 +926 +48 8b 7f 08 +mov +rdi, [rdi + 8] +1004098 + + +1004070 + + +9 + + +22 +head +- +> +next += +prev +; +1001 +92a +48 89 48 08 +mov +[rax + 8], rcx + + +20 +while (head) { again: its second run +1001 +92e +48 85 ff +test +rdi, rdi +1001 +931 +75 ed +jne +1001920 +1001 +933 +5d +pop +rbp + + +26 +return +prev +; +1001 +934 +c3 +ret + +1001 +935 +31 c0 +xor +eax, eax +1001 +937 +c3 +ret + + 48 8b 7f 08 is one instruction: mov rdi, [rdi + 8], line 21's head->next. The line sits level with its code: they are one row. -- cgit v1.3