diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-10 12:01:16 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-10 12:07:12 -0300 |
| commit | af2d2cfdcdf5976f06fbcc4b1f8507f0b7d4af89 (patch) | |
| tree | eb455143013fa1b1278ae246676153205d9a3f17 /design/mock | |
| parent | a0ca9a0bfa76cd2d04502b7f341cba5153f51899 (diff) | |
| download | computeranim-af2d2cfdcdf5976f06fbcc4b1f8507f0b7d4af89.tar.gz computeranim-af2d2cfdcdf5976f06fbcc4b1f8507f0b7d4af89.zip | |
design: the visual system canim follows, with eight mock frames
Lapis page and vellum ink; a role is a form as well as a colour (current,
write, read, pointer, allocated, freed, fault, kernel); panels as acme
windows; Go Mono for the machine and Go for the narrator; motion as whole
frames at 60 fps. design/mock/gen.py redraws the mocks from the tokens.
Diffstat (limited to 'design/mock')
25 files changed, 3376 insertions, 0 deletions
diff --git a/design/mock/01-fib-recursion-480.png b/design/mock/01-fib-recursion-480.png Binary files differnew file mode 100644 index 0000000..167fc50 --- /dev/null +++ b/design/mock/01-fib-recursion-480.png diff --git a/design/mock/01-fib-recursion.png b/design/mock/01-fib-recursion.png Binary files differnew file mode 100644 index 0000000..aefa55a --- /dev/null +++ b/design/mock/01-fib-recursion.png diff --git a/design/mock/01-fib-recursion.svg b/design/mock/01-fib-recursion.svg new file mode 100644 index 0000000..1cb0378 --- /dev/null +++ b/design/mock/01-fib-recursion.svg @@ -0,0 +1,282 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="1920" height="1080" viewBox="0 0 1920 1080"> +<defs><pattern id="hatch" width="20" height="20" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="5" height="20" fill="#3a4a8a"/></pattern><pattern id="hazard" width="24" height="24" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="24" height="24" fill="#050a24"/><rect width="12" height="24" fill="#ff6a4a"/></pattern></defs> +<rect width="1920" height="1080" fill="#0a1030"/> +<text x="64.0" y="81.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">Recursion</text> +<text x="232.0 247.0 262.0 277.0 292.0 307.0" y="81.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">fib(5)</text> +<text x="1790.9" y="80.0" font-family="Go Medium" font-size="22" fill="#6a7ab8" xml:space="preserve">kernel</text> +<rect x="1767.9" y="66.0" width="14.0" height="14.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<text x="1646.4" y="80.0" font-family="Go Medium" font-size="22" fill="#6a7ab8" xml:space="preserve">memory</text> +<rect x="1623.4" y="66.0" width="14.0" height="14.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<text x="1547.1" y="80.0" font-family="Go Medium" font-size="22" fill="#9aa6d9" xml:space="preserve">cpu</text> +<rect x="1523.1" y="65.0" width="16.0" height="16.0" fill="#9aa6d9"/> +<text x="1416.1" y="80.0" font-family="Go Medium" font-size="22" fill="#eee6d2" xml:space="preserve">source</text> +<rect x="1392.1" y="65.0" width="16.0" height="16.0" fill="#e8c46a"/> +<line x1="64.0" y1="104.0" x2="1856.0" y2="104.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="64.0" y="120.0" width="728.0" height="48.0" fill="#16245f"/> +<rect x="65.0" y="121.0" width="726.0" height="766.0" fill="none" stroke="#9aa6d9" stroke-width="2"/> +<line x1="64.0" y1="168.0" x2="792.0" y2="168.0" stroke="#9aa6d9" stroke-width="2"/> +<rect x="78.0" y="134.0" width="20.0" height="20.0" fill="#e8c46a"/> +<text x="112.0" y="154.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">fib.c</text> +<text x="112.0" y="218.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">1</text> +<text x="156.0 174.0 192.0 210.0 228.0 246.0 264.0 282.0" y="218.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">#include</text> +<text x="318.0 336.0 354.0 372.0 390.0 408.0 426.0 444.0 462.0" y="218.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve"><stdio.h></text> +<text x="112.0" y="266.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">2</text> +<rect x="66.0" y="282.0" width="6.0" height="44.0" fill="#ae9350"/> +<text x="112.0" y="314.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">3</text> +<text x="156.0 174.0 192.0 210.0" y="314.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">long</text> +<text x="246.0 264.0 282.0 300.0" y="314.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">fib(</text> +<text x="318.0 336.0 354.0 372.0" y="314.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">long</text> +<text x="408.0 426.0 444.0 462.0" y="314.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">n) {</text> +<rect x="66.0" y="330.0" width="724.0" height="44.0" fill="#4a3d1c"/> +<rect x="66.0" y="330.0" width="74.0" height="44.0" fill="#e8c46a"/> +<text x="112.0" y="362.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">4</text> +<text x="228.0 246.0" y="362.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">if</text> +<text x="282.0 300.0 318.0 336.0 354.0" y="362.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">(n < </text> +<text x="372.0" y="362.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">2</text> +<text x="390.0" y="362.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">)</text> +<text x="112.0" y="410.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">5</text> +<text x="300.0 318.0 336.0 354.0 372.0 390.0" y="410.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">return</text> +<text x="426.0 444.0" y="410.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">n;</text> +<rect x="66.0" y="426.0" width="6.0" height="44.0" fill="#746235"/> +<text x="112.0" y="458.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">6</text> +<text x="228.0 246.0 264.0 282.0 300.0 318.0" y="458.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">return</text> +<text x="354.0 372.0 390.0 408.0 426.0 444.0" y="458.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">fib(n-</text> +<text x="462.0" y="458.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">1</text> +<text x="480.0 498.0 516.0 534.0 552.0 570.0 588.0 606.0 624.0 642.0" y="458.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">) + fib(n-</text> +<text x="660.0" y="458.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">2</text> +<text x="678.0 696.0" y="458.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">);</text> +<text x="112.0" y="506.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">7</text> +<text x="156.0" y="506.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">}</text> +<text x="112.0" y="554.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">8</text> +<text x="112.0" y="602.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">9</text> +<text x="156.0 174.0 192.0" y="602.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">int</text> +<text x="228.0 246.0 264.0 282.0 300.0" y="602.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">main(</text> +<text x="318.0 336.0 354.0 372.0" y="602.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">void</text> +<text x="390.0 408.0 426.0" y="602.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">) {</text> +<text x="94.0 112.0" y="650.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">10</text> +<text x="228.0 246.0 264.0 282.0 300.0 318.0 336.0" y="650.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">printf(</text> +<text x="354.0 372.0 390.0 408.0 426.0 444.0 462.0" y="650.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">"%ld\n"</text> +<text x="480.0 498.0 516.0 534.0 552.0 570.0" y="650.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">, fib(</text> +<text x="588.0" y="650.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">5</text> +<text x="606.0 624.0 642.0" y="650.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">));</text> +<text x="94.0 112.0" y="698.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">11</text> +<text x="228.0 246.0 264.0 282.0 300.0 318.0" y="698.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">return</text> +<text x="354.0" y="698.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">0</text> +<text x="372.0" y="698.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">;</text> +<text x="94.0 112.0" y="746.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">12</text> +<text x="156.0" y="746.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">}</text> +<rect x="445.0" y="333.0" width="97.0" height="38.0" fill="none" stroke="#9aa6d9" stroke-width="2"/> +<text x="456.0 471.0 486.0 501.0 516.0" y="361.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">n = 1</text> +<rect x="824.0" y="120.0" width="1032.0" height="48.0" fill="#16245f"/> +<rect x="825.0" y="121.0" width="1030.0" height="334.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="824.0" y1="168.0" x2="1856.0" y2="168.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="839.0" y="135.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="872.0" y="154.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">calls of fib(n)</text> +<text x="1840.0" y="152.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">each result on its call's shoulder</text> +<line x1="1340.0" y1="210.0" x2="1100.0" y2="264.0" stroke="#3a4a8a" stroke-width="3"/> +<line x1="1340.0" y1="210.0" x2="1600.0" y2="264.0" stroke="#eee6d2" stroke-width="4"/> +<line x1="1100.0" y1="264.0" x2="980.0" y2="318.0" stroke="#3a4a8a" stroke-width="3"/> +<line x1="1100.0" y1="264.0" x2="1220.0" y2="318.0" stroke="#3a4a8a" stroke-width="3"/> +<line x1="1600.0" y1="264.0" x2="1520.0" y2="318.0" stroke="#eee6d2" stroke-width="4"/> +<line x1="980.0" y1="318.0" x2="916.0" y2="372.0" stroke="#3a4a8a" stroke-width="3"/> +<line x1="980.0" y1="318.0" x2="1044.0" y2="372.0" stroke="#3a4a8a" stroke-width="3"/> +<line x1="1220.0" y1="318.0" x2="1176.0" y2="372.0" stroke="#3a4a8a" stroke-width="3"/> +<line x1="1220.0" y1="318.0" x2="1264.0" y2="372.0" stroke="#3a4a8a" stroke-width="3"/> +<line x1="1520.0" y1="318.0" x2="1476.0" y2="372.0" stroke="#eee6d2" stroke-width="4"/> +<line x1="916.0" y1="372.0" x2="880.0" y2="426.0" stroke="#3a4a8a" stroke-width="3"/> +<line x1="916.0" y1="372.0" x2="952.0" y2="426.0" stroke="#3a4a8a" stroke-width="3"/> +<circle cx="1340.0" cy="210.0" r="22" fill="#0a1030" stroke="#eee6d2" stroke-width="4"/> +<text x="1331.0" y="220.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<circle cx="1100.0" cy="264.0" r="24" fill="#16245f"/> +<text x="1091.0" y="274.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">4</text> +<rect x="1114.0" y="230.0" width="28.0" height="28.0" fill="#0a1030"/> +<rect x="1115.0" y="231.0" width="26.0" height="26.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="1120.5" y="253.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">3</text> +<circle cx="1600.0" cy="264.0" r="22" fill="#0a1030" stroke="#eee6d2" stroke-width="4"/> +<text x="1591.0" y="274.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3</text> +<circle cx="980.0" cy="318.0" r="24" fill="#16245f"/> +<text x="971.0" y="328.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">3</text> +<rect x="994.0" y="284.0" width="28.0" height="28.0" fill="#0a1030"/> +<rect x="995.0" y="285.0" width="26.0" height="26.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="1000.5" y="307.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">2</text> +<circle cx="1220.0" cy="318.0" r="24" fill="#16245f"/> +<text x="1211.0" y="328.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">2</text> +<rect x="1234.0" y="284.0" width="28.0" height="28.0" fill="#0a1030"/> +<rect x="1235.0" y="285.0" width="26.0" height="26.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="1240.5" y="307.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1</text> +<circle cx="1520.0" cy="318.0" r="22" fill="#0a1030" stroke="#eee6d2" stroke-width="4"/> +<text x="1511.0" y="328.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<circle cx="916.0" cy="372.0" r="24" fill="#16245f"/> +<text x="907.0" y="382.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">2</text> +<rect x="930.0" y="338.0" width="28.0" height="28.0" fill="#0a1030"/> +<rect x="931.0" y="339.0" width="26.0" height="26.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="936.5" y="361.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1</text> +<circle cx="1044.0" cy="372.0" r="24" fill="#16245f"/> +<text x="1035.0" y="382.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">1</text> +<rect x="1058.0" y="338.0" width="28.0" height="28.0" fill="#0a1030"/> +<rect x="1059.0" y="339.0" width="26.0" height="26.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="1064.5" y="361.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1</text> +<circle cx="1176.0" cy="372.0" r="24" fill="#16245f"/> +<text x="1167.0" y="382.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">1</text> +<rect x="1190.0" y="338.0" width="28.0" height="28.0" fill="#0a1030"/> +<rect x="1191.0" y="339.0" width="26.0" height="26.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="1196.5" y="361.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1</text> +<circle cx="1264.0" cy="372.0" r="24" fill="#16245f"/> +<text x="1255.0" y="382.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">0</text> +<rect x="1278.0" y="338.0" width="28.0" height="28.0" fill="#0a1030"/> +<rect x="1279.0" y="339.0" width="26.0" height="26.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="1284.5" y="361.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">0</text> +<circle cx="1476.0" cy="372.0" r="24" fill="#e8c46a"/> +<text x="1467.0" y="382.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">1</text> +<circle cx="880.0" cy="426.0" r="24" fill="#16245f"/> +<text x="871.0" y="436.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">1</text> +<rect x="894.0" y="392.0" width="28.0" height="28.0" fill="#0a1030"/> +<rect x="895.0" y="393.0" width="26.0" height="26.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="900.5" y="415.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1</text> +<circle cx="952.0" cy="426.0" r="24" fill="#16245f"/> +<text x="943.0" y="436.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">0</text> +<rect x="966.0" y="392.0" width="28.0" height="28.0" fill="#0a1030"/> +<rect x="967.0" y="393.0" width="26.0" height="26.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="972.5" y="415.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">0</text> +<rect x="824.0" y="480.0" width="424.0" height="48.0" fill="#16245f"/> +<rect x="825.0" y="481.0" width="422.0" height="406.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="824.0" y1="528.0" x2="1248.0" y2="528.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="839.0" y="495.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="872.0" y="514.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">call stack</text> +<text x="1232.0" y="512.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">newest on top</text> +<rect x="838.0" y="544.0" width="396.0" height="56.0" fill="#4a3d1c"/> +<rect x="838.0" y="544.0" width="12.0" height="56.0" fill="#e8c46a"/> +<text x="866.0 884.0 902.0" y="582.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve" font-weight="bold">fib</text> +<text x="938.0 956.0 974.0 992.0 1010.0" y="582.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">n = 1</text> +<text x="1190.0 1205.0" y="581.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">:4</text> +<rect x="838.0" y="612.0" width="396.0" height="56.0" fill="#16245f"/> +<rect x="838.0" y="612.0" width="12.0" height="56.0" fill="#3a4a8a"/> +<text x="866.0 884.0 902.0" y="650.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">fib</text> +<text x="938.0 956.0 974.0 992.0 1010.0" y="650.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">n = 2</text> +<text x="1190.0 1205.0" y="649.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">:6</text> +<rect x="838.0" y="680.0" width="396.0" height="56.0" fill="#16245f"/> +<rect x="838.0" y="680.0" width="12.0" height="56.0" fill="#3a4a8a"/> +<text x="866.0 884.0 902.0" y="718.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">fib</text> +<text x="938.0 956.0 974.0 992.0 1010.0" y="718.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">n = 3</text> +<text x="1190.0 1205.0" y="717.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">:6</text> +<rect x="838.0" y="748.0" width="396.0" height="56.0" fill="#16245f"/> +<rect x="838.0" y="748.0" width="12.0" height="56.0" fill="#3a4a8a"/> +<text x="866.0 884.0 902.0" y="786.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">fib</text> +<text x="938.0 956.0 974.0 992.0 1010.0" y="786.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">n = 5</text> +<text x="1190.0 1205.0" y="785.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">:6</text> +<rect x="838.0" y="816.0" width="396.0" height="56.0" fill="#16245f"/> +<rect x="838.0" y="816.0" width="12.0" height="56.0" fill="#3a4a8a"/> +<text x="866.0 884.0 902.0 920.0" y="854.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">main</text> +<text x="1175.0 1190.0 1205.0" y="853.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">:10</text> +<rect x="1280.0" y="480.0" width="576.0" height="48.0" fill="#16245f"/> +<rect x="1281.0" y="481.0" width="574.0" height="406.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="1280.0" y1="528.0" x2="1856.0" y2="528.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1295.0" y="495.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="1328.0" y="514.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">registers</text> +<text x="1840.0" y="512.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">x86-64</text> +<rect x="1282.0" y="545.0" width="572.0" height="42.0" fill="#4a3d1c"/> +<rect x="1282.0" y="545.0" width="84.0" height="42.0" fill="#e8c46a"/> +<text x="1521.0" y="576.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1539.0" y="576.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1557.0" y="576.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1575.0" y="576.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1602.0" y="576.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="1620.0" y="576.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="1638.0" y="576.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="1656.0" y="576.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">4</text> +<text x="1683.0" y="576.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="1701.0" y="576.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="1719.0" y="576.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="1737.0" y="576.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1764.0" y="576.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="1782.0" y="576.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="1800.0" y="576.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">4</text> +<text x="1818.0" y="576.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="1300.0 1318.0 1336.0" y="576.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">rip</text> +<rect x="1511.0" y="593.0" width="335.0" height="42.0" fill="#5a2218"/> +<rect x="1511.0" y="629.0" width="335.0" height="6.0" fill="#ff6a4a"/> +<text x="1521.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1539.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1557.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1575.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1602.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1620.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1638.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1656.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1683.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1701.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1719.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1737.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1764.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1782.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1800.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1818.0" y="624.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="1300.0 1318.0 1336.0" y="624.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">rax</text> +<rect x="1511.0" y="641.0" width="335.0" height="42.0" fill="#ff6a4a"/> +<text x="1521.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1539.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1557.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1575.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1602.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1620.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1638.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1656.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1683.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1701.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1719.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1737.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1764.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1782.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1800.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1818.0" y="672.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">1</text> +<text x="1300.0 1318.0 1336.0" y="672.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">rdi</text> +<rect x="1511.0" y="689.0" width="335.0" height="42.0" fill="#5a2218"/> +<rect x="1511.0" y="725.0" width="335.0" height="6.0" fill="#ff6a4a"/> +<text x="1521.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1539.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1557.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1575.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1602.0" y="720.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">7</text> +<text x="1620.0" y="720.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="1638.0" y="720.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="1656.0" y="720.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="1683.0" y="720.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3</text> +<text x="1701.0" y="720.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="1719.0" y="720.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<text x="1737.0" y="720.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="1764.0" y="720.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="1782.0" y="720.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="1800.0" y="720.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="1818.0" y="720.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1300.0 1318.0 1336.0" y="720.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">rsp</text> +<text x="1521.0" y="768.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1539.0" y="768.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1557.0" y="768.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1575.0" y="768.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1602.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">7</text> +<text x="1620.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="1638.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="1656.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="1683.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3</text> +<text x="1701.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="1719.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<text x="1737.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="1764.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="1782.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="1800.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">e</text> +<text x="1818.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1300.0 1318.0 1336.0" y="768.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">rbp</text> +<rect x="1301.0" y="793.0" width="58.0" height="34.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<text x="1315.0 1330.0" y="819.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">CF</text> +<rect x="1373.0" y="793.0" width="58.0" height="34.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<text x="1387.0 1402.0" y="819.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">ZF</text> +<rect x="1372.0" y="832.0" width="60.0" height="6.0" fill="#ff6a4a"/> +<rect x="1444.0" y="792.0" width="60.0" height="36.0" fill="#16245f"/> +<rect x="1445.5" y="793.5" width="57.0" height="33.0" fill="none" stroke="#eee6d2" stroke-width="3"/> +<text x="1459.0 1474.0" y="819.0" font-family="Go Mono" font-size="25" fill="#fff8e8" xml:space="preserve" font-weight="bold">SF</text> +<rect x="1444.0" y="832.0" width="60.0" height="6.0" fill="#ff6a4a"/> +<rect x="1517.0" y="793.0" width="58.0" height="34.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<text x="1531.0 1546.0" y="819.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">OF</text> +<text x="64.0" y="964.0" font-size="40" xml:space="preserve"><tspan font-family="Go" font-weight="normal" fill="#eee6d2">Four calls to </tspan><tspan font-family="Go Mono" font-weight="normal" fill="#eee6d2" font-size="35">fib</tspan><tspan font-family="Go" font-weight="normal" fill="#eee6d2"> are still waiting, each with its own </tspan><tspan font-family="Go Mono" font-weight="normal" fill="#eee6d2" font-size="35">n</tspan><tspan font-family="Go" font-weight="normal" fill="#eee6d2">.</tspan></text> +<text x="64.0" y="1018.0" font-size="40" xml:space="preserve"><tspan font-family="Go" font-weight="normal" fill="#eee6d2">The newest one just received </tspan><tspan font-family="Go Mono" font-weight="normal" fill="#eee6d2" font-size="35">1</tspan><tspan font-family="Go" font-weight="normal" fill="#eee6d2"> in </tspan><tspan font-family="Go Mono" font-weight="normal" fill="#eee6d2" font-size="35">rdi</tspan><tspan font-family="Go" font-weight="normal" fill="#eee6d2">.</tspan></text> +</svg> diff --git a/design/mock/02-list-insert-480.png b/design/mock/02-list-insert-480.png Binary files differnew file mode 100644 index 0000000..8cc538f --- /dev/null +++ b/design/mock/02-list-insert-480.png diff --git a/design/mock/02-list-insert.png b/design/mock/02-list-insert.png Binary files differnew file mode 100644 index 0000000..6e99916 --- /dev/null +++ b/design/mock/02-list-insert.png diff --git a/design/mock/02-list-insert.svg b/design/mock/02-list-insert.svg new file mode 100644 index 0000000..878740d --- /dev/null +++ b/design/mock/02-list-insert.svg @@ -0,0 +1,286 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="1920" height="1080" viewBox="0 0 1920 1080"> +<defs><pattern id="hatch" width="20" height="20" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="5" height="20" fill="#3a4a8a"/></pattern><pattern id="hazard" width="24" height="24" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="24" height="24" fill="#050a24"/><rect width="12" height="24" fill="#ff6a4a"/></pattern></defs> +<rect width="1920" height="1080" fill="#0a1030"/> +<text x="64.0" y="81.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">Linked lists</text> +<text x="248.2 263.2 278.2 293.2 308.2 323.2 338.2 353.2 368.2 383.2 398.2 413.2 428.2 443.2 458.2 473.2 488.2 503.2 518.2" y="81.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">insert after a node</text> +<text x="1790.9" y="80.0" font-family="Go Medium" font-size="22" fill="#6a7ab8" xml:space="preserve">kernel</text> +<rect x="1767.9" y="66.0" width="14.0" height="14.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<text x="1646.4" y="80.0" font-family="Go Medium" font-size="22" fill="#eee6d2" xml:space="preserve">memory</text> +<rect x="1622.4" y="65.0" width="16.0" height="16.0" fill="#e8c46a"/> +<text x="1547.1" y="80.0" font-family="Go Medium" font-size="22" fill="#6a7ab8" xml:space="preserve">cpu</text> +<rect x="1524.1" y="66.0" width="14.0" height="14.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<text x="1416.1" y="80.0" font-family="Go Medium" font-size="22" fill="#9aa6d9" xml:space="preserve">source</text> +<rect x="1392.1" y="65.0" width="16.0" height="16.0" fill="#9aa6d9"/> +<line x1="64.0" y1="104.0" x2="1856.0" y2="104.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="64.0" y="120.0" width="728.0" height="48.0" fill="#16245f"/> +<rect x="65.0" y="121.0" width="726.0" height="766.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="64.0" y1="168.0" x2="792.0" y2="168.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="79.0" y="135.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="112.0" y="154.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">list.c</text> +<text x="112.0" y="218.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">3</text> +<text x="156.0 174.0 192.0 210.0 228.0 246.0" y="218.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">struct</text> +<text x="282.0 300.0 318.0 336.0 354.0 372.0" y="218.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">node {</text> +<text x="112.0" y="266.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">4</text> +<text x="228.0 246.0 264.0 282.0" y="266.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">long</text> +<text x="318.0 336.0 354.0 372.0 390.0 408.0" y="266.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">value;</text> +<text x="112.0" y="314.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">5</text> +<text x="228.0 246.0 264.0 282.0 300.0 318.0" y="314.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">struct</text> +<text x="354.0 372.0 390.0 408.0 426.0 444.0 462.0 480.0 498.0 516.0 534.0" y="314.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">node *next;</text> +<text x="112.0" y="362.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">6</text> +<text x="156.0 174.0" y="362.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">};</text> +<rect x="156.0" y="393.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="170.0" y="393.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="184.0" y="393.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="94.0 112.0" y="450.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">21</text> +<text x="156.0 174.0 192.0 210.0 228.0 246.0 264.0 282.0 300.0 318.0 336.0" y="450.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">n = malloc(</text> +<text x="354.0 372.0 390.0 408.0 426.0 444.0" y="450.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">sizeof</text> +<text x="480.0 498.0 516.0 534.0" y="450.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">*n);</text> +<rect x="66.0" y="466.0" width="6.0" height="44.0" fill="#746235"/> +<text x="94.0 112.0" y="498.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">22</text> +<text x="156.0 174.0 192.0 210.0 228.0 246.0 264.0 282.0 300.0 318.0 336.0 354.0 372.0" y="498.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">n->value = v;</text> +<rect x="66.0" y="514.0" width="6.0" height="44.0" fill="#ae9350"/> +<text x="94.0 112.0" y="546.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">23</text> +<text x="156.0 174.0 192.0 210.0 228.0 246.0 264.0 282.0 300.0 318.0 336.0 354.0 372.0 390.0 408.0 426.0 444.0 462.0 480.0" y="546.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">n->next = at->next;</text> +<rect x="66.0" y="562.0" width="724.0" height="44.0" fill="#4a3d1c"/> +<rect x="66.0" y="562.0" width="74.0" height="44.0" fill="#e8c46a"/> +<text x="94.0 112.0" y="594.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">24</text> +<text x="156.0 174.0 192.0 210.0 228.0 246.0 264.0 282.0 300.0 318.0 336.0 354.0 372.0" y="594.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">at->next = n;</text> +<text x="94.0 112.0" y="642.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">25</text> +<text x="156.0 174.0 192.0 210.0 228.0 246.0" y="642.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">return</text> +<text x="282.0 300.0" y="642.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">n;</text> +<line x1="84.0" y1="676.0" x2="772.0" y2="676.0" stroke="#3a4a8a" stroke-width="2"/> +<text x="86.0" y="706.0" font-family="Go Medium" font-size="22" fill="#6a7ab8" xml:space="preserve">locals</text> +<rect x="84.0" y="724.0" width="12.0" height="46.0" fill="#8a5e0c"/> +<text x="112.0 130.0" y="757.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">at</text> +<text x="182.0" y="757.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="200.0" y="757.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="218.0" y="757.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="236.0" y="757.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="263.0" y="757.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="281.0" y="757.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="299.0" y="757.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="317.0" y="757.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">4</text> +<text x="344.0" y="757.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="362.0" y="757.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="380.0" y="757.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="398.0" y="757.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="425.0" y="757.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3</text> +<text x="443.0" y="757.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<text x="461.0" y="757.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="479.0" y="757.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="521.0" y="756.1" font-family="Go" font-size="28" fill="#9aa6d9" xml:space="preserve">node 7</text> +<rect x="84.0" y="776.0" width="12.0" height="46.0" fill="#17707c"/> +<text x="112.0" y="809.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">n</text> +<text x="182.0" y="809.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="200.0" y="809.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="218.0" y="809.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="236.0" y="809.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="263.0" y="809.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="281.0" y="809.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="299.0" y="809.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="317.0" y="809.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">4</text> +<text x="344.0" y="809.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="362.0" y="809.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="380.0" y="809.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="398.0" y="809.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="425.0" y="809.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3</text> +<text x="443.0" y="809.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<text x="461.0" y="809.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">e</text> +<text x="479.0" y="809.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="521.0" y="808.1" font-family="Go" font-size="28" fill="#9aa6d9" xml:space="preserve">node 9</text> +<text x="112.0" y="861.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">v</text> +<text x="182.0" y="861.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">9</text> +<rect x="824.0" y="120.0" width="1032.0" height="48.0" fill="#16245f"/> +<rect x="825.0" y="121.0" width="1030.0" height="238.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="824.0" y1="168.0" x2="1856.0" y2="168.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="839.0" y="135.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="872.0" y="154.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">the list</text> +<text x="1840.0" y="152.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">what the code means</text> +<rect x="861.0" y="199.0" width="82.0" height="38.0" fill="none" stroke="#9aa6d9" stroke-width="2"/> +<text x="872.0 887.0 902.0 917.0" y="227.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">head</text> +<path d="M944.0,218.0 L1000.0,218.0" fill="none" stroke="#d59cf5" stroke-width="4" stroke-linejoin="round" stroke-linecap="butt"/> +<path d="M1016.0,218.0 L998.0,226.0 L998.0,210.0 Z" fill="#d59cf5"/> +<rect x="1020.0" y="182.0" width="108.0" height="72.0" fill="#8a5e0c"/> +<text x="1063.5" y="230.6" font-family="Go Mono" font-size="35" fill="#eee6d2" xml:space="preserve">7</text> +<rect x="1130.0" y="182.0" width="70.0" height="72.0" fill="#ff6a4a"/> +<rect x="1158.0" y="211.0" width="14.0" height="14.0" fill="#050a24"/> +<rect x="1464.0" y="182.0" width="108.0" height="72.0" fill="#16245f"/> +<text x="1497.0 1518.0" y="230.6" font-family="Go Mono" font-size="35" fill="#eee6d2" xml:space="preserve">12</text> +<rect x="1574.0" y="182.0" width="70.0" height="72.0" fill="#111b4a"/> +<path d="M1588,240 L1630,196" fill="none" stroke="#9aa6d9" stroke-width="3" stroke-linejoin="round" stroke-linecap="butt"/> +<rect x="1242.0" y="278.0" width="108.0" height="72.0" fill="#17707c"/> +<text x="1285.5" y="326.6" font-family="Go Mono" font-size="35" fill="#eee6d2" xml:space="preserve">9</text> +<rect x="1352.0" y="278.0" width="70.0" height="72.0" fill="#5a2218"/> +<rect x="1352.0" y="344.0" width="70.0" height="6.0" fill="#ff6a4a"/> +<rect x="1380.0" y="307.0" width="14.0" height="14.0" fill="#d59cf5"/> +<path d="M1179.0,218.0 L1458.0,218.0" fill="none" stroke="#6a7ab8" stroke-width="3" stroke-linejoin="round" stroke-linecap="butt" stroke-dasharray="12 8"/> +<path d="M1165.0,232.0 L1165.0,302.0 Q1165.0,314.0 1177.0,314.0 L1222.0,314.0" fill="none" stroke="#d59cf5" stroke-width="4" stroke-linejoin="round" stroke-linecap="butt"/> +<path d="M1238.0,314.0 L1220.0,322.0 L1220.0,306.0 Z" fill="#d59cf5"/> +<path d="M1401.0,314.0 L1506.0,314.0 Q1518.0,314.0 1518.0,302.0 L1518.0,274.0" fill="none" stroke="#d59cf5" stroke-width="4" stroke-linejoin="round" stroke-linecap="butt"/> +<path d="M1518.0,258.0 L1526.0,276.0 L1510.0,276.0 Z" fill="#d59cf5"/> +<text x="1022.0 1037.0" y="284.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">at</text> +<text x="1438.0" y="344.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">n</text> +<text x="1668.0" y="226.6" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">the end</text> +<rect x="824.0" y="384.0" width="1032.0" height="48.0" fill="#16245f"/> +<rect x="825.0" y="385.0" width="1030.0" height="502.0" fill="none" stroke="#9aa6d9" stroke-width="2"/> +<line x1="824.0" y1="432.0" x2="1856.0" y2="432.0" stroke="#9aa6d9" stroke-width="2"/> +<rect x="838.0" y="398.0" width="20.0" height="20.0" fill="#e8c46a"/> +<text x="872.0" y="418.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">heap</text> +<text x="1840.0" y="416.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">eight bytes a row, as one number · low addresses on top</text> +<rect x="1224.0" y="450.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1238.0" y="450.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1252.0" y="450.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="1280.0" y="461.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve">malloc's own 16 bytes</text> +<text x="932.0 947.0 962.0 977.0" y="498.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">55d4</text> +<text x="1000.0 1015.0 1030.0 1045.0" y="498.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">a1c0</text> +<text x="1068.0 1083.0 1098.0 1113.0" y="498.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">32a0</text> +<rect x="1224.0" y="466.0" width="382.0" height="46.0" fill="#16245f"/> +<text x="1257.5" y="499.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1275.5" y="499.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1293.5" y="499.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1311.5" y="499.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1338.5" y="499.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1356.5" y="499.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1374.5" y="499.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1392.5" y="499.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1419.5" y="499.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1437.5" y="499.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1455.5" y="499.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1473.5" y="499.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1500.5" y="499.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1518.5" y="499.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1536.5" y="499.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1554.5" y="499.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">7</text> +<text x="1626.0 1641.0 1656.0 1671.0 1686.0" y="498.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">value</text> +<text x="1716.0 1731.0 1746.0" y="498.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">= 7</text> +<rect x="862.0" y="469.0" width="50.0" height="40.0" fill="#8a5e0c"/> +<text x="872.0 887.0" y="498.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">at</text> +<rect x="916.0" y="466.0" width="6.0" height="106.0" fill="#8a5e0c"/> +<text x="932.0 947.0 962.0 977.0" y="558.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">55d4</text> +<text x="1000.0 1015.0 1030.0 1045.0" y="558.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">a1c0</text> +<text x="1068.0 1083.0 1098.0 1113.0" y="558.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">32a8</text> +<rect x="1224.0" y="526.0" width="382.0" height="46.0" fill="#ff6a4a"/> +<text x="1257.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1275.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1293.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1311.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1338.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">5</text> +<text x="1356.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">5</text> +<text x="1374.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">d</text> +<text x="1392.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">4</text> +<text x="1419.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">a</text> +<text x="1437.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">1</text> +<text x="1455.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">c</text> +<text x="1473.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1500.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">3</text> +<text x="1518.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">2</text> +<text x="1536.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">e</text> +<text x="1554.5" y="559.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="1626.0 1641.0 1656.0 1671.0" y="558.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">next</text> +<rect x="1224.0" y="594.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1238.0" y="594.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1252.0" y="594.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="932.0 947.0 962.0 977.0" y="642.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">55d4</text> +<text x="1000.0 1015.0 1030.0 1045.0" y="642.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">a1c0</text> +<text x="1068.0 1083.0 1098.0 1113.0" y="642.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">32c0</text> +<rect x="1224.0" y="610.0" width="382.0" height="46.0" fill="#16245f"/> +<text x="1257.5" y="643.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1275.5" y="643.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1293.5" y="643.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1311.5" y="643.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1338.5" y="643.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1356.5" y="643.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1374.5" y="643.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1392.5" y="643.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1419.5" y="643.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1437.5" y="643.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1455.5" y="643.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1473.5" y="643.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1500.5" y="643.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1518.5" y="643.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1536.5" y="643.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1554.5" y="643.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="1626.0 1641.0 1656.0 1671.0 1686.0" y="642.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">value</text> +<text x="1716.0 1731.0 1746.0 1761.0" y="642.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">= 12</text> +<text x="932.0 947.0 962.0 977.0" y="702.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">55d4</text> +<text x="1000.0 1015.0 1030.0 1045.0" y="702.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">a1c0</text> +<text x="1068.0 1083.0 1098.0 1113.0" y="702.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">32c8</text> +<rect x="1224.0" y="670.0" width="382.0" height="46.0" fill="#16245f"/> +<text x="1257.5" y="703.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1275.5" y="703.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1293.5" y="703.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1311.5" y="703.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1338.5" y="703.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1356.5" y="703.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1374.5" y="703.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1392.5" y="703.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1419.5" y="703.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1437.5" y="703.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1455.5" y="703.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1473.5" y="703.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1500.5" y="703.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1518.5" y="703.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1536.5" y="703.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1554.5" y="703.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1626.0 1641.0 1656.0 1671.0" y="702.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">next</text> +<text x="1716.0 1731.0 1746.0 1761.0 1776.0 1791.0" y="702.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">= NULL</text> +<rect x="1224.0" y="738.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1238.0" y="738.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1252.0" y="738.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="932.0 947.0 962.0 977.0" y="786.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">55d4</text> +<text x="1000.0 1015.0 1030.0 1045.0" y="786.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">a1c0</text> +<text x="1068.0 1083.0 1098.0 1113.0" y="786.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">32e0</text> +<rect x="1224.0" y="754.0" width="382.0" height="46.0" fill="#16245f"/> +<text x="1257.5" y="787.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1275.5" y="787.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1293.5" y="787.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1311.5" y="787.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1338.5" y="787.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1356.5" y="787.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1374.5" y="787.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1392.5" y="787.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1419.5" y="787.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1437.5" y="787.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1455.5" y="787.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1473.5" y="787.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1500.5" y="787.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1518.5" y="787.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1536.5" y="787.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1554.5" y="787.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">9</text> +<text x="1626.0 1641.0 1656.0 1671.0 1686.0" y="786.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">value</text> +<text x="1716.0 1731.0 1746.0" y="786.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">= 9</text> +<rect x="877.0" y="757.0" width="35.0" height="40.0" fill="#17707c"/> +<text x="887.0" y="786.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">n</text> +<rect x="916.0" y="754.0" width="6.0" height="106.0" fill="#17707c"/> +<text x="932.0 947.0 962.0 977.0" y="846.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">55d4</text> +<text x="1000.0 1015.0 1030.0 1045.0" y="846.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">a1c0</text> +<text x="1068.0 1083.0 1098.0 1113.0" y="846.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">32e8</text> +<rect x="1224.0" y="814.0" width="382.0" height="46.0" fill="#5a2218"/> +<rect x="1224.0" y="854.0" width="382.0" height="6.0" fill="#ff6a4a"/> +<text x="1257.5" y="847.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1275.5" y="847.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1293.5" y="847.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1311.5" y="847.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1338.5" y="847.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="1356.5" y="847.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="1374.5" y="847.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="1392.5" y="847.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">4</text> +<text x="1419.5" y="847.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="1437.5" y="847.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="1455.5" y="847.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="1473.5" y="847.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1500.5" y="847.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3</text> +<text x="1518.5" y="847.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<text x="1536.5" y="847.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="1554.5" y="847.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1626.0 1641.0 1656.0 1671.0" y="846.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">next</text> +<path d="M1218.0,549.0 L1206.0,549.0 Q1194.0,549.0 1194.0,561.0 L1194.0,621.0 Q1194.0,633.0 1206.0,633.0 L1220.0,633.0" fill="none" stroke="#6a7ab8" stroke-width="3" stroke-linejoin="round" stroke-linecap="butt" stroke-dasharray="12 8"/> +<path d="M1218.0,837.0 L1184.0,837.0 Q1172.0,837.0 1172.0,825.0 L1172.0,645.0 Q1172.0,633.0 1184.0,633.0 L1204.0,633.0" fill="none" stroke="#d59cf5" stroke-width="4" stroke-linejoin="round" stroke-linecap="butt"/> +<path d="M1220.0,633.0 L1202.0,641.0 L1202.0,625.0 Z" fill="#d59cf5"/> +<path d="M1218.0,549.0 L1162.0,549.0 Q1150.0,549.0 1150.0,561.0 L1150.0,765.0 Q1150.0,777.0 1162.0,777.0 L1204.0,777.0" fill="none" stroke="#d59cf5" stroke-width="4" stroke-linejoin="round" stroke-linecap="butt"/> +<path d="M1220.0,777.0 L1202.0,785.0 L1202.0,769.0 Z" fill="#d59cf5"/> +<rect x="1220.0" y="522.0" width="390.0" height="54.0" fill="none" stroke="#d59cf5" stroke-width="4"/> +<rect x="1220.0" y="810.0" width="390.0" height="54.0" fill="none" stroke="#d59cf5" stroke-width="4"/> +<text x="64.0" y="964.0" font-size="40" xml:space="preserve"><tspan font-family="Go" font-weight="normal" fill="#eee6d2">Inserting moves nothing. One word changes: the </tspan><tspan font-family="Go Mono" font-weight="normal" fill="#eee6d2" font-size="35">next</tspan><tspan font-family="Go" font-weight="normal" fill="#eee6d2"> field of </tspan><tspan font-family="Go Mono" font-weight="normal" fill="#eee6d2" font-size="35">at</tspan></text> +<text x="64.0" y="1018.0" font-size="40" xml:space="preserve"><tspan font-family="Go" font-weight="normal" fill="#eee6d2">now holds the address of the new node.</tspan></text> +</svg> diff --git a/design/mock/03-syscall-write-480.png b/design/mock/03-syscall-write-480.png Binary files differnew file mode 100644 index 0000000..ebaf2af --- /dev/null +++ b/design/mock/03-syscall-write-480.png diff --git a/design/mock/03-syscall-write.png b/design/mock/03-syscall-write.png Binary files differnew file mode 100644 index 0000000..b56f743 --- /dev/null +++ b/design/mock/03-syscall-write.png diff --git a/design/mock/03-syscall-write.svg b/design/mock/03-syscall-write.svg new file mode 100644 index 0000000..140369e --- /dev/null +++ b/design/mock/03-syscall-write.svg @@ -0,0 +1,293 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="1920" height="1080" viewBox="0 0 1920 1080"> +<defs><pattern id="hatch" width="20" height="20" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="5" height="20" fill="#3a4a8a"/></pattern><pattern id="hazard" width="24" height="24" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="24" height="24" fill="#050a24"/><rect width="12" height="24" fill="#ff6a4a"/></pattern></defs> +<rect width="1920" height="1080" fill="#0a1030"/> +<rect x="0.0" y="576.0" width="1920.0" height="504.0" fill="#eee6d2"/> +<text x="64.0" y="81.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">System calls</text> +<text x="265.3 280.3 295.3 310.3 325.3 340.3 355.3 370.3 385.3 400.3 415.3 430.3 445.3 460.3 475.3 490.3 505.3" y="81.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">write(1, msg, 14)</text> +<text x="1790.9" y="80.0" font-family="Go Medium" font-size="22" fill="#eee6d2" xml:space="preserve">kernel</text> +<rect x="1766.9" y="65.0" width="16.0" height="16.0" fill="#e8c46a"/> +<text x="1646.4" y="80.0" font-family="Go Medium" font-size="22" fill="#9aa6d9" xml:space="preserve">memory</text> +<rect x="1622.4" y="65.0" width="16.0" height="16.0" fill="#9aa6d9"/> +<text x="1547.1" y="80.0" font-family="Go Medium" font-size="22" fill="#9aa6d9" xml:space="preserve">cpu</text> +<rect x="1523.1" y="65.0" width="16.0" height="16.0" fill="#9aa6d9"/> +<text x="1416.1" y="80.0" font-family="Go Medium" font-size="22" fill="#9aa6d9" xml:space="preserve">source</text> +<rect x="1392.1" y="65.0" width="16.0" height="16.0" fill="#9aa6d9"/> +<line x1="64.0" y1="104.0" x2="1856.0" y2="104.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="64.0" y="120.0" width="576.0" height="48.0" fill="#16245f"/> +<rect x="65.0" y="121.0" width="574.0" height="406.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="64.0" y1="168.0" x2="640.0" y2="168.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="79.0" y="135.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="112.0" y="154.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">hello.c</text> +<rect x="66.0" y="182.0" width="572.0" height="44.0" fill="#4a3d1c"/> +<rect x="66.0" y="182.0" width="74.0" height="44.0" fill="#e8c46a"/> +<text x="94.0 112.0" y="214.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">11</text> +<text x="156.0 174.0 192.0 210.0 228.0 246.0" y="214.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">write(</text> +<text x="264.0" y="214.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">1</text> +<text x="282.0 300.0 318.0 336.0 354.0 372.0 390.0" y="214.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">, msg, </text> +<text x="408.0 426.0" y="214.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">14</text> +<text x="444.0 462.0" y="214.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">);</text> +<line x1="174.0" y1="230.0" x2="174.0" y2="466.0" stroke="#3a4a8a" stroke-width="2"/> +<text x="192.0 210.0 228.0" y="262.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">mov</text> +<text x="282.0 300.0 318.0 336.0 354.0 372.0" y="262.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">eax, 1</text> +<text x="192.0 210.0 228.0" y="310.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">mov</text> +<text x="282.0 300.0 318.0 336.0 354.0 372.0" y="310.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">edi, 1</text> +<text x="192.0 210.0 228.0" y="358.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">lea</text> +<text x="282.0 300.0 318.0 336.0 354.0 372.0 390.0 408.0 426.0 444.0" y="358.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">rsi, [msg]</text> +<text x="192.0 210.0 228.0" y="406.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">mov</text> +<text x="282.0 300.0 318.0 336.0 354.0 372.0 390.0" y="406.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">edx, 14</text> +<rect x="170.0" y="423.0" width="468.0" height="42.0" fill="#4a3d1c"/> +<rect x="170.0" y="423.0" width="8.0" height="42.0" fill="#e8c46a"/> +<text x="192.0 210.0 228.0 246.0 264.0 282.0 300.0" y="454.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve" font-weight="bold">syscall</text> +<text x="94.0 112.0" y="502.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">12</text> +<text x="156.0 174.0 192.0 210.0 228.0 246.0" y="502.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">return</text> +<text x="282.0" y="502.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">0</text> +<text x="300.0" y="502.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">;</text> +<rect x="672.0" y="120.0" width="576.0" height="48.0" fill="#16245f"/> +<rect x="673.0" y="121.0" width="574.0" height="406.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="672.0" y1="168.0" x2="1248.0" y2="168.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="687.0" y="135.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="720.0" y="154.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">registers</text> +<text x="1232.0" y="152.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">x86-64</text> +<rect x="674.0" y="183.0" width="572.0" height="42.0" fill="#4a3d1c"/> +<rect x="674.0" y="183.0" width="84.0" height="42.0" fill="#e8c46a"/> +<text x="913.0" y="214.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="931.0" y="214.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="949.0" y="214.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="967.0" y="214.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="994.0" y="214.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="1012.0" y="214.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="1030.0" y="214.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="1048.0" y="214.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">4</text> +<text x="1075.0" y="214.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="1093.0" y="214.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="1111.0" y="214.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="1129.0" y="214.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1156.0" y="214.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="1174.0" y="214.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="1192.0" y="214.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="1210.0" y="214.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="692.0 710.0 728.0" y="214.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">rip</text> +<rect x="903.0" y="231.0" width="335.0" height="42.0" fill="#1c4652"/> +<rect x="904.5" y="232.5" width="332.0" height="39.0" fill="none" stroke="#6fd6e6" stroke-width="3"/> +<text x="913.0" y="262.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="931.0" y="262.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="949.0" y="262.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="967.0" y="262.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="994.0" y="262.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1012.0" y="262.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1030.0" y="262.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1048.0" y="262.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1075.0" y="262.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1093.0" y="262.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1111.0" y="262.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1129.0" y="262.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1156.0" y="262.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1174.0" y="262.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1192.0" y="262.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1210.0" y="262.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="692.0 710.0 728.0" y="262.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">rax</text> +<rect x="903.0" y="279.0" width="335.0" height="42.0" fill="#1c4652"/> +<rect x="904.5" y="280.5" width="332.0" height="39.0" fill="none" stroke="#6fd6e6" stroke-width="3"/> +<text x="913.0" y="310.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="931.0" y="310.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="949.0" y="310.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="967.0" y="310.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="994.0" y="310.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1012.0" y="310.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1030.0" y="310.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1048.0" y="310.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1075.0" y="310.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1093.0" y="310.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1111.0" y="310.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1129.0" y="310.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1156.0" y="310.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1174.0" y="310.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1192.0" y="310.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1210.0" y="310.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="692.0 710.0 728.0" y="310.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">rdi</text> +<rect x="903.0" y="327.0" width="335.0" height="42.0" fill="#1c4652"/> +<rect x="904.5" y="328.5" width="332.0" height="39.0" fill="none" stroke="#6fd6e6" stroke-width="3"/> +<text x="913.0" y="358.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="931.0" y="358.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="949.0" y="358.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="967.0" y="358.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="994.0" y="358.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="1012.0" y="358.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="1030.0" y="358.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="1048.0" y="358.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">4</text> +<text x="1075.0" y="358.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="1093.0" y="358.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="1111.0" y="358.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="1129.0" y="358.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1156.0" y="358.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<text x="1174.0" y="358.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1192.0" y="358.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1210.0" y="358.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">4</text> +<text x="692.0 710.0 728.0" y="358.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">rsi</text> +<rect x="903.0" y="375.0" width="335.0" height="42.0" fill="#1c4652"/> +<rect x="904.5" y="376.5" width="332.0" height="39.0" fill="none" stroke="#6fd6e6" stroke-width="3"/> +<text x="913.0" y="406.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="931.0" y="406.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="949.0" y="406.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="967.0" y="406.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="994.0" y="406.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1012.0" y="406.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1030.0" y="406.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1048.0" y="406.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1075.0" y="406.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1093.0" y="406.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1111.0" y="406.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1129.0" y="406.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1156.0" y="406.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1174.0" y="406.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1192.0" y="406.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1210.0" y="406.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">e</text> +<text x="692.0 710.0 728.0" y="406.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">rdx</text> +<text x="766.0" y="260.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">which call</text> +<text x="766.0" y="308.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">1st</text> +<text x="766.0" y="356.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">2nd</text> +<text x="766.0" y="404.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">3rd</text> +<text x="692.0" y="464.0" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">four registers, read by the kernel</text> +<rect x="1280.0" y="120.0" width="576.0" height="48.0" fill="#16245f"/> +<rect x="1281.0" y="121.0" width="574.0" height="406.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="1280.0" y1="168.0" x2="1856.0" y2="168.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1295.0" y="135.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="1328.0" y="154.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">memory</text> +<text x="1840.0" y="152.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">read-only data</text> +<text x="1300.0 1315.0 1330.0 1345.0" y="255.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">a1c0</text> +<text x="1368.0 1383.0 1398.0 1413.0" y="255.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">2004</text> +<rect x="1456.0" y="204.0" width="46.0" height="84.0" fill="#1c4652"/> +<text x="1470.0" y="242.0" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">H</text> +<text x="1464.0 1479.0" y="276.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">48</text> +<rect x="1504.0" y="204.0" width="46.0" height="84.0" fill="#1c4652"/> +<text x="1518.0" y="242.0" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">e</text> +<text x="1512.0 1527.0" y="276.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">65</text> +<rect x="1552.0" y="204.0" width="46.0" height="84.0" fill="#1c4652"/> +<text x="1566.0" y="242.0" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">l</text> +<text x="1560.0 1575.0" y="276.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">6c</text> +<rect x="1600.0" y="204.0" width="46.0" height="84.0" fill="#1c4652"/> +<text x="1614.0" y="242.0" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">l</text> +<text x="1608.0 1623.0" y="276.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">6c</text> +<rect x="1648.0" y="204.0" width="46.0" height="84.0" fill="#1c4652"/> +<text x="1662.0" y="242.0" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">o</text> +<text x="1656.0 1671.0" y="276.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">6f</text> +<rect x="1696.0" y="204.0" width="46.0" height="84.0" fill="#1c4652"/> +<text x="1710.0" y="242.0" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">,</text> +<text x="1704.0 1719.0" y="276.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">2c</text> +<rect x="1744.0" y="204.0" width="46.0" height="84.0" fill="#1c4652"/> +<path d="M1759,234 v8 h16 v-8" fill="none" stroke="#eee6d2" stroke-width="3" stroke-linejoin="miter" stroke-linecap="butt"/> +<text x="1752.0 1767.0" y="276.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">20</text> +<rect x="1792.0" y="204.0" width="46.0" height="84.0" fill="#1c4652"/> +<text x="1806.0" y="242.0" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">w</text> +<text x="1800.0 1815.0" y="276.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">77</text> +<text x="1300.0 1315.0 1330.0 1345.0" y="359.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">a1c0</text> +<text x="1368.0 1383.0 1398.0 1413.0" y="359.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">200c</text> +<rect x="1456.0" y="308.0" width="46.0" height="84.0" fill="#1c4652"/> +<text x="1470.0" y="346.0" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">o</text> +<text x="1464.0 1479.0" y="380.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">6f</text> +<rect x="1504.0" y="308.0" width="46.0" height="84.0" fill="#1c4652"/> +<text x="1518.0" y="346.0" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">r</text> +<text x="1512.0 1527.0" y="380.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">72</text> +<rect x="1552.0" y="308.0" width="46.0" height="84.0" fill="#1c4652"/> +<text x="1566.0" y="346.0" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">l</text> +<text x="1560.0 1575.0" y="380.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">6c</text> +<rect x="1600.0" y="308.0" width="46.0" height="84.0" fill="#1c4652"/> +<text x="1614.0" y="346.0" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="1608.0 1623.0" y="380.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">64</text> +<rect x="1648.0" y="308.0" width="46.0" height="84.0" fill="#1c4652"/> +<text x="1662.0" y="346.0" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">!</text> +<text x="1656.0 1671.0" y="380.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">21</text> +<rect x="1696.0" y="308.0" width="46.0" height="84.0" fill="#1c4652"/> +<text x="1701.0 1719.0" y="346.0" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">\n</text> +<text x="1704.0 1719.0" y="380.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">0a</text> +<rect x="1744.0" y="308.0" width="46.0" height="84.0" fill="#16245f"/> +<text x="1752.0 1767.0" y="380.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">00</text> +<rect x="1804.0" y="347.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1820.0" y="347.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1452.5" y="200.5" width="389.0" height="91.0" fill="none" stroke="#6fd6e6" stroke-width="3"/> +<rect x="1452.5" y="304.5" width="293.0" height="91.0" fill="none" stroke="#6fd6e6" stroke-width="3"/> +<text x="1456.0" y="434.0" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">14 bytes, read by the kernel</text> +<text x="64.0" y="560.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">user</text> +<text x="64.0" y="618.0" font-family="Go Medium" font-size="28" fill="#0a1030" xml:space="preserve">kernel</text> +<line x1="960.0" y1="528.0" x2="960.0" y2="576.0" stroke="#eee6d2" stroke-width="6"/> +<path d="M960.0,576.0 L960.0,618.0" fill="none" stroke="#0a1030" stroke-width="6" stroke-linejoin="round" stroke-linecap="butt"/> +<path d="M960.0,640.0 L948.0,616.0 L972.0,616.0 Z" fill="#0a1030"/> +<text x="982.0 997.0 1012.0 1027.0 1042.0 1057.0 1072.0" y="562.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">syscall</text> +<line x1="1648.0" y1="528.0" x2="1648.0" y2="576.0" stroke="#6fd6e6" stroke-width="6"/> +<path d="M1648.0,576.0 L1648.0,670.0" fill="none" stroke="#0a1030" stroke-width="6" stroke-linejoin="round" stroke-linecap="butt"/> +<path d="M1648.0,692.0 L1636.0,668.0 L1660.0,668.0 Z" fill="#0a1030"/> +<text x="1670.0" y="562.0" font-family="Go" font-size="24" fill="#eee6d2" xml:space="preserve">the bytes</text> +<text x="64.0" y="668.0" font-family="Go" font-size="24" fill="#4a5488" xml:space="preserve">what it runs</text> +<rect x="64.0" y="684.0" width="576.0" height="56.0" fill="#e8c46a"/> +<rect x="65.0" y="685.0" width="574.0" height="54.0" fill="none" stroke="#0a1030" stroke-width="2"/> +<text x="92.0 110.0 128.0 146.0 164.0 182.0 200.0 218.0 236.0" y="722.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve" font-weight="bold">tty_write</text> +<rect x="65.0" y="753.0" width="574.0" height="54.0" fill="none" stroke="#0a1030" stroke-width="2"/> +<text x="92.0 110.0 128.0 146.0 164.0 182.0 200.0 218.0 236.0" y="790.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">vfs_write</text> +<rect x="65.0" y="821.0" width="574.0" height="54.0" fill="none" stroke="#0a1030" stroke-width="2"/> +<text x="92.0 110.0 128.0 146.0 164.0 182.0 200.0 218.0 236.0 254.0" y="858.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">ksys_write</text> +<text x="672.0 708.0 744.0 780.0 816.0" y="698.0" font-family="Go Mono" font-size="60" fill="#0a1030" xml:space="preserve" font-weight="bold">write</text> +<text x="876.0" y="698.0" font-family="Go" font-size="28" fill="#4a5488" xml:space="preserve">system call 1</text> +<line x1="672.0" y1="722.0" x2="1248.0" y2="722.0" stroke="#b9ad8e" stroke-width="2"/> +<text x="672.0 690.0 708.0" y="754.8" font-family="Go Mono" font-size="30" fill="#4a5488" xml:space="preserve">rdi</text> +<text x="756.0" y="753.8" font-family="Go Medium" font-size="28" fill="#0a1030" xml:space="preserve">fd</text> +<text x="892.0" y="754.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">1</text> +<text x="930.0" y="753.8" font-family="Go" font-size="28" fill="#4a5488" xml:space="preserve">the terminal</text> +<line x1="672.0" y1="766.0" x2="1248.0" y2="766.0" stroke="#b9ad8e" stroke-width="2"/> +<text x="672.0 690.0 708.0" y="798.8" font-family="Go Mono" font-size="30" fill="#4a5488" xml:space="preserve">rsi</text> +<text x="756.0" y="797.8" font-family="Go Medium" font-size="28" fill="#0a1030" xml:space="preserve">buf</text> +<text x="892.0" y="798.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">5</text> +<text x="910.0" y="798.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">5</text> +<text x="928.0" y="798.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">d</text> +<text x="946.0" y="798.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">4</text> +<text x="973.0" y="798.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">a</text> +<text x="991.0" y="798.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">1</text> +<text x="1009.0" y="798.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">c</text> +<text x="1027.0" y="798.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">0</text> +<text x="1054.0" y="798.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">2</text> +<text x="1072.0" y="798.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">0</text> +<text x="1090.0" y="798.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">0</text> +<text x="1108.0" y="798.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">4</text> +<line x1="672.0" y1="810.0" x2="1248.0" y2="810.0" stroke="#b9ad8e" stroke-width="2"/> +<text x="672.0 690.0 708.0" y="842.8" font-family="Go Mono" font-size="30" fill="#4a5488" xml:space="preserve">rdx</text> +<text x="756.0" y="841.8" font-family="Go Medium" font-size="28" fill="#0a1030" xml:space="preserve">count</text> +<text x="892.0 910.0" y="842.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve">14</text> +<text x="948.0" y="841.8" font-family="Go" font-size="28" fill="#4a5488" xml:space="preserve">bytes</text> +<line x1="672.0" y1="854.0" x2="1248.0" y2="854.0" stroke="#b9ad8e" stroke-width="2"/> +<text x="672.0 690.0 708.0" y="886.8" font-family="Go Mono" font-size="30" fill="#4a5488" xml:space="preserve">rax</text> +<text x="756.0" y="885.8" font-family="Go Medium" font-size="28" fill="#0a1030" xml:space="preserve">returns</text> +<text x="892.0" y="885.8" font-family="Go" font-size="28" fill="#4a5488" xml:space="preserve">not yet</text> +<text x="1280.0" y="736.0" font-family="Go" font-size="24" fill="#4a5488" xml:space="preserve">the terminal's buffer</text> +<rect x="1280.0" y="752.0" width="46.0" height="46.0" fill="#f3b9a0"/> +<rect x="1281.0" y="753.0" width="44.0" height="44.0" fill="none" stroke="#0a1030" stroke-width="2"/> +<text x="1294.0" y="785.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve">H</text> +<rect x="1328.0" y="752.0" width="46.0" height="46.0" fill="#f3b9a0"/> +<rect x="1329.0" y="753.0" width="44.0" height="44.0" fill="none" stroke="#0a1030" stroke-width="2"/> +<text x="1342.0" y="785.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve">e</text> +<rect x="1376.0" y="752.0" width="46.0" height="46.0" fill="#f3b9a0"/> +<rect x="1377.0" y="753.0" width="44.0" height="44.0" fill="none" stroke="#0a1030" stroke-width="2"/> +<text x="1390.0" y="785.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve">l</text> +<rect x="1424.0" y="752.0" width="46.0" height="46.0" fill="#f3b9a0"/> +<rect x="1425.0" y="753.0" width="44.0" height="44.0" fill="none" stroke="#0a1030" stroke-width="2"/> +<text x="1438.0" y="785.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve">l</text> +<rect x="1472.0" y="752.0" width="46.0" height="46.0" fill="#f3b9a0"/> +<rect x="1473.0" y="753.0" width="44.0" height="44.0" fill="none" stroke="#0a1030" stroke-width="2"/> +<text x="1486.0" y="785.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve">o</text> +<rect x="1520.0" y="752.0" width="46.0" height="46.0" fill="#f3b9a0"/> +<rect x="1521.0" y="753.0" width="44.0" height="44.0" fill="none" stroke="#0a1030" stroke-width="2"/> +<text x="1534.0" y="785.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve">,</text> +<rect x="1568.0" y="752.0" width="46.0" height="46.0" fill="#f3b9a0"/> +<rect x="1569.0" y="753.0" width="44.0" height="44.0" fill="none" stroke="#0a1030" stroke-width="2"/> +<path d="M1583,777.8 v8 h16 v-8" fill="none" stroke="#050a24" stroke-width="3" stroke-linejoin="miter" stroke-linecap="butt"/> +<rect x="1616.0" y="752.0" width="46.0" height="46.0" fill="#f3b9a0"/> +<rect x="1617.0" y="753.0" width="44.0" height="44.0" fill="none" stroke="#0a1030" stroke-width="2"/> +<text x="1630.0" y="785.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve">w</text> +<rect x="1664.0" y="752.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<rect x="1665.0" y="753.0" width="44.0" height="44.0" fill="none" stroke="#0a1030" stroke-width="2"/> +<text x="1678.0" y="785.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">o</text> +<rect x="1713.0" y="753.0" width="44.0" height="44.0" fill="none" stroke="#b9ad8e" stroke-width="2"/> +<rect x="1761.0" y="753.0" width="44.0" height="44.0" fill="none" stroke="#b9ad8e" stroke-width="2"/> +<rect x="1809.0" y="753.0" width="44.0" height="44.0" fill="none" stroke="#b9ad8e" stroke-width="2"/> +<text x="1280.0" y="830.0" font-family="Go" font-size="24" fill="#4a5488" xml:space="preserve">9 of 14 copied</text> +<text x="64.0" y="964.0" font-size="40" xml:space="preserve"><tspan font-family="Go" font-weight="normal" fill="#0a1030">The program cannot reach the terminal. It leaves four numbers</tspan></text> +<text x="64.0" y="1018.0" font-size="40" xml:space="preserve"><tspan font-family="Go" font-weight="normal" fill="#0a1030">in registers, and </tspan><tspan font-family="Go Mono" font-weight="normal" fill="#0a1030" font-size="35">syscall</tspan><tspan font-family="Go" font-weight="normal" fill="#0a1030"> hands them to the kernel.</tspan></text> +</svg> diff --git a/design/mock/04-malloc-glibc-musl-480.png b/design/mock/04-malloc-glibc-musl-480.png Binary files differnew file mode 100644 index 0000000..d69374f --- /dev/null +++ b/design/mock/04-malloc-glibc-musl-480.png diff --git a/design/mock/04-malloc-glibc-musl.png b/design/mock/04-malloc-glibc-musl.png Binary files differnew file mode 100644 index 0000000..8d392dd --- /dev/null +++ b/design/mock/04-malloc-glibc-musl.png diff --git a/design/mock/04-malloc-glibc-musl.svg b/design/mock/04-malloc-glibc-musl.svg new file mode 100644 index 0000000..a638d28 --- /dev/null +++ b/design/mock/04-malloc-glibc-musl.svg @@ -0,0 +1,273 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="1920" height="1080" viewBox="0 0 1920 1080"> +<defs><pattern id="hatch" width="20" height="20" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="5" height="20" fill="#3a4a8a"/></pattern><pattern id="hazard" width="24" height="24" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="24" height="24" fill="#050a24"/><rect width="12" height="24" fill="#ff6a4a"/></pattern></defs> +<rect width="1920" height="1080" fill="#0a1030"/> +<text x="64.0" y="81.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">malloc: glibc and musl</text> +<text x="393.2 408.2 423.2 438.2 453.2 468.2 483.2 498.2 513.2 528.2 543.2 558.2 573.2 588.2 603.2 618.2 633.2 648.2" y="81.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">heap.c:9 free(b);</text> +<text x="1790.9" y="80.0" font-family="Go Medium" font-size="22" fill="#6a7ab8" xml:space="preserve">kernel</text> +<rect x="1767.9" y="66.0" width="14.0" height="14.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<text x="1646.4" y="80.0" font-family="Go Medium" font-size="22" fill="#eee6d2" xml:space="preserve">memory</text> +<rect x="1622.4" y="65.0" width="16.0" height="16.0" fill="#e8c46a"/> +<text x="1547.1" y="80.0" font-family="Go Medium" font-size="22" fill="#6a7ab8" xml:space="preserve">cpu</text> +<rect x="1524.1" y="66.0" width="14.0" height="14.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<text x="1416.1" y="80.0" font-family="Go Medium" font-size="22" fill="#9aa6d9" xml:space="preserve">source</text> +<rect x="1392.1" y="65.0" width="16.0" height="16.0" fill="#9aa6d9"/> +<line x1="64.0" y1="104.0" x2="1856.0" y2="104.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="64.0" y="120.0" width="880.0" height="48.0" fill="#16245f"/> +<rect x="65.0" y="121.0" width="878.0" height="766.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="64.0" y1="168.0" x2="944.0" y2="168.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="79.0" y="135.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="112.0" y="154.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">glibc 2.39</text> +<text x="928.0" y="152.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">ptmalloc</text> +<text x="92.0" y="212.0" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">the heap: one run of chunks</text> +<rect x="92.0" y="266.0" width="70.0" height="88.0" fill="#3a4a8a"/> +<rect x="164.0" y="266.0" width="126.0" height="88.0" fill="#1f4a33"/> +<rect x="165.5" y="267.5" width="123.0" height="85.0" fill="none" stroke="#7fdc9a" stroke-width="3"/> +<rect x="167.0" y="269.0" width="29.0" height="82.0" fill="#3a4a8a"/> +<text x="232.5" y="322.6" font-family="Go Mono" font-size="35" fill="#eee6d2" xml:space="preserve">a</text> +<rect x="292.0" y="266.0" width="126.0" height="88.0" fill="url(#hatch)"/> +<rect x="293.5" y="267.5" width="123.0" height="85.0" fill="none" stroke="#9aa6d9" stroke-width="3" stroke-dasharray="12 8"/> +<rect x="295.0" y="269.0" width="29.0" height="82.0" fill="#3a4a8a"/> +<rect x="324.0" y="269.0" width="31.0" height="82.0" fill="#ff6a4a"/> +<rect x="356.0" y="269.0" width="31.0" height="82.0" fill="#ff6a4a"/> +<rect x="386.0" y="288.0" width="32.0" height="44.0" fill="#0a1030"/> +<text x="391.5" y="322.6" font-family="Go Mono" font-size="35" fill="#eee6d2" xml:space="preserve">b</text> +<rect x="420.0" y="266.0" width="446.0" height="88.0" fill="#1f4a33"/> +<rect x="421.5" y="267.5" width="443.0" height="85.0" fill="none" stroke="#7fdc9a" stroke-width="3"/> +<rect x="423.0" y="269.0" width="29.0" height="82.0" fill="#3a4a8a"/> +<text x="648.5" y="322.6" font-family="Go Mono" font-size="35" fill="#eee6d2" xml:space="preserve">c</text> +<rect x="869.0" y="267.0" width="46.0" height="86.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="886.0" y="307.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="900.0" y="307.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="914.0" y="307.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="92.0" y="252.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve">tcache</text> +<text x="916.0" y="252.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">unused</text> +<path d="M739,366 v16 m0,-8 H865 m0,-8 v16" fill="none" stroke="#6a7ab8" stroke-width="3" stroke-linejoin="round" stroke-linecap="butt"/> +<text x="724.0" y="382.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">32 bytes</text> +<text x="370.0" y="452.0" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve" text-anchor="middle">inside b</text> +<path d="M292,358 L178,472 M418,358 L560,472" fill="none" stroke="#3a4a8a" stroke-width="2" stroke-linejoin="round" stroke-linecap="butt"/> +<rect x="178.0" y="478.0" width="382.0" height="46.0" fill="#16245f"/> +<text x="211.5" y="511.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="229.5" y="511.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="247.5" y="511.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="265.5" y="511.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="292.5" y="511.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="310.5" y="511.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="328.5" y="511.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="346.5" y="511.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="373.5" y="511.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="391.5" y="511.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="409.5" y="511.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="427.5" y="511.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="454.5" y="511.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="472.5" y="511.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="490.5" y="511.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<text x="508.5" y="511.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="580.0 595.0 610.0 625.0" y="510.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">size</text> +<text x="654.0" y="509.6" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">of this chunk</text> +<rect x="178.0" y="538.0" width="382.0" height="46.0" fill="#ff6a4a"/> +<text x="211.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="229.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="247.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="265.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="292.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="310.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="328.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="346.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">5</text> +<text x="373.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">5</text> +<text x="391.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">d</text> +<text x="409.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">4</text> +<text x="427.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">a</text> +<text x="454.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">1</text> +<text x="472.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">c</text> +<text x="490.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="508.5" y="571.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">3</text> +<text x="580.0 595.0 610.0 625.0" y="570.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">next</text> +<text x="654.0" y="569.6" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">free chunk: none</text> +<rect x="178.0" y="598.0" width="382.0" height="46.0" fill="#ff6a4a"/> +<text x="211.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">8</text> +<text x="229.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">f</text> +<text x="247.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">3</text> +<text x="265.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">a</text> +<text x="292.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">6</text> +<text x="310.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">1</text> +<text x="328.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">c</text> +<text x="346.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">2</text> +<text x="373.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">d</text> +<text x="391.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">0</text> +<text x="409.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">7</text> +<text x="427.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">b</text> +<text x="454.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">4</text> +<text x="472.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">e</text> +<text x="490.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">1</text> +<text x="508.5" y="631.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">9</text> +<text x="580.0 595.0 610.0" y="630.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">key</text> +<text x="639.0" y="629.6" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">marks it freed</text> +<rect x="178.0" y="658.0" width="382.0" height="46.0" fill="#16245f"/> +<text x="211.5" y="691.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="229.5" y="691.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="247.5" y="691.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="265.5" y="691.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="292.5" y="691.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="310.5" y="691.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="328.5" y="691.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="346.5" y="691.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="373.5" y="691.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="391.5" y="691.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="409.5" y="691.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="427.5" y="691.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="454.5" y="691.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="472.5" y="691.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="490.5" y="691.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<text x="508.5" y="691.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="580.0" y="689.6" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">your old data</text> +<text x="122.0 137.0 152.0 167.0" y="824.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">0x20</text> +<rect x="92.0" y="748.0" width="120.0" height="46.0" fill="#ff6a4a"/> +<text x="98.0 116.0 134.0 152.0 170.0 188.0" y="781.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">1 free</text> +<text x="258.0 273.0 288.0 303.0" y="824.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">0x30</text> +<rect x="228.0" y="748.0" width="120.0" height="46.0" fill="#16245f"/> +<text x="279.0" y="781.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="394.0 409.0 424.0 439.0" y="824.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">0x40</text> +<rect x="364.0" y="748.0" width="120.0" height="46.0" fill="#16245f"/> +<text x="415.0" y="781.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="530.0 545.0 560.0 575.0" y="824.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">0x50</text> +<rect x="500.0" y="748.0" width="120.0" height="46.0" fill="#16245f"/> +<text x="551.0" y="781.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="666.0 681.0 696.0 711.0" y="824.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">0x60</text> +<rect x="636.0" y="748.0" width="120.0" height="46.0" fill="#16245f"/> +<text x="687.0" y="781.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="802.0 817.0 832.0 847.0" y="824.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">0x70</text> +<rect x="772.0" y="748.0" width="120.0" height="46.0" fill="#16245f"/> +<text x="823.0" y="781.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<path d="M122.0,748.0 L122.0,573.0 Q122.0,561.0 134.0,561.0 L158.0,561.0" fill="none" stroke="#d59cf5" stroke-width="4" stroke-linejoin="round" stroke-linecap="butt"/> +<path d="M174.0,561.0 L156.0,569.0 L156.0,553.0 Z" fill="#d59cf5"/> +<text x="92.0" y="868.0" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">its notes: a list for each size, kept in the heap itself</text> +<rect x="976.0" y="120.0" width="880.0" height="48.0" fill="#16245f"/> +<rect x="977.0" y="121.0" width="878.0" height="766.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="976.0" y1="168.0" x2="1856.0" y2="168.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="991.0" y="135.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="1024.0" y="154.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">musl 1.2.5</text> +<text x="1840.0" y="152.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">mallocng</text> +<text x="1004.0" y="212.0" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">the heap: groups of equal slots</text> +<rect x="1004.0" y="238.0" width="62.0" height="56.0" fill="#3a4a8a"/> +<rect x="1068.0" y="238.0" width="446.0" height="56.0" fill="#1f4a33"/> +<rect x="1069.5" y="239.5" width="443.0" height="53.0" fill="none" stroke="#7fdc9a" stroke-width="3"/> +<text x="1280.5" y="278.6" font-family="Go Mono" font-size="35" fill="#eee6d2" xml:space="preserve">c</text> +<rect x="1517.0" y="239.0" width="310.0" height="54.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1534.0" y="263.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1548.0" y="263.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1562.0" y="263.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="1828.0" y="226.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">112-byte slots</text> +<rect x="1004.0" y="334.0" width="62.0" height="56.0" fill="#3a4a8a"/> +<rect x="1068.0" y="334.0" width="126.0" height="56.0" fill="#1f4a33"/> +<rect x="1069.5" y="335.5" width="123.0" height="53.0" fill="none" stroke="#7fdc9a" stroke-width="3"/> +<text x="1120.5" y="374.6" font-family="Go Mono" font-size="35" fill="#eee6d2" xml:space="preserve">a</text> +<rect x="1196.0" y="334.0" width="126.0" height="56.0" fill="url(#hatch)"/> +<rect x="1197.5" y="335.5" width="123.0" height="53.0" fill="none" stroke="#9aa6d9" stroke-width="3" stroke-dasharray="12 8"/> +<rect x="1199.0" y="337.0" width="14.0" height="50.0" fill="#ff6a4a"/> +<rect x="1243.0" y="340.0" width="32.0" height="44.0" fill="#0a1030"/> +<text x="1248.5" y="374.6" font-family="Go Mono" font-size="35" fill="#eee6d2" xml:space="preserve">b</text> +<rect x="1325.0" y="335.0" width="124.0" height="54.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1453.0" y="335.0" width="124.0" height="54.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1581.0" y="335.0" width="124.0" height="54.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1722.0" y="359.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1736.0" y="359.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1750.0" y="359.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="1828.0" y="322.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">32-byte slots</text> +<text x="1282.0" y="452.0" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve" text-anchor="middle">inside b</text> +<path d="M1196,394 L1090,472 M1322,394 L1472,472" fill="none" stroke="#3a4a8a" stroke-width="2" stroke-linejoin="round" stroke-linecap="butt"/> +<rect x="1090.0" y="478.0" width="190.0" height="46.0" fill="#5a2218"/> +<rect x="1090.0" y="518.0" width="190.0" height="6.0" fill="#ff6a4a"/> +<text x="1108.5" y="511.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="1126.5" y="511.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="1144.5" y="511.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1162.5" y="511.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1189.5" y="511.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1207.5" y="511.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1225.5" y="511.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1243.5" y="511.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1300.0" y="509.6" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">its tag, cleared</text> +<rect x="1090.0" y="538.0" width="382.0" height="46.0" fill="#16245f"/> +<text x="1123.5" y="571.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1141.5" y="571.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1159.5" y="571.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1177.5" y="571.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1204.5" y="571.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1222.5" y="571.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1240.5" y="571.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1258.5" y="571.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1285.5" y="571.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1303.5" y="571.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1321.5" y="571.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1339.5" y="571.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1366.5" y="571.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1384.5" y="571.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1402.5" y="571.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<text x="1420.5" y="571.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="1492.0" y="569.6" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">your old data,</text> +<rect x="1090.0" y="598.0" width="382.0" height="46.0" fill="#16245f"/> +<text x="1123.5" y="631.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1141.5" y="631.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1159.5" y="631.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1177.5" y="631.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1204.5" y="631.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1222.5" y="631.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1240.5" y="631.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1258.5" y="631.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1285.5" y="631.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1303.5" y="631.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1321.5" y="631.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1339.5" y="631.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1366.5" y="631.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1384.5" y="631.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1402.5" y="631.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1420.5" y="631.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1492.0" y="629.6" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">all of it untouched</text> +<text x="1180.0" y="719.6" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve" text-anchor="end">can hand out</text> +<rect x="1200.0" y="688.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1214.0" y="721.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<rect x="1248.0" y="688.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1262.0" y="721.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<rect x="1296.0" y="688.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1310.0" y="721.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<rect x="1344.0" y="688.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1358.0" y="721.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<rect x="1392.0" y="688.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1406.0" y="721.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<rect x="1440.0" y="688.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1454.0" y="721.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<rect x="1488.0" y="688.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1502.0" y="721.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<rect x="1536.0" y="688.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1550.0" y="721.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<rect x="1584.0" y="688.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1598.0" y="721.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<rect x="1632.0" y="688.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1646.0" y="721.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="1180.0" y="771.6" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve" text-anchor="end">freed</text> +<rect x="1200.0" y="740.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1214.0" y="773.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<rect x="1248.0" y="740.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1262.0" y="773.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">1</text> +<rect x="1296.0" y="740.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1310.0" y="773.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<rect x="1344.0" y="740.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1358.0" y="773.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<rect x="1392.0" y="740.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1406.0" y="773.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<rect x="1440.0" y="740.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1454.0" y="773.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<rect x="1488.0" y="740.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1502.0" y="773.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<rect x="1536.0" y="740.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1550.0" y="773.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<rect x="1584.0" y="740.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1598.0" y="773.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<rect x="1632.0" y="740.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1646.0" y="773.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1215.5" y="824.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">a</text> +<text x="1263.5" y="824.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">b</text> +<text x="1306.0" y="824.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve">one bit for each slot</text> +<text x="1004.0" y="868.0" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">its notes: one record for each group, kept apart</text> +<text x="64.0" y="964.0" font-size="40" xml:space="preserve"><tspan font-family="Go" font-weight="normal" fill="#eee6d2">glibc threads its free list through the freed chunk itself.</tspan></text> +<text x="64.0" y="1018.0" font-size="40" xml:space="preserve"><tspan font-family="Go" font-weight="normal" fill="#eee6d2">musl flips one bit in a record it keeps apart from your data.</tspan></text> +</svg> diff --git a/design/mock/05-memory-write-480.png b/design/mock/05-memory-write-480.png Binary files differnew file mode 100644 index 0000000..37f6caf --- /dev/null +++ b/design/mock/05-memory-write-480.png diff --git a/design/mock/05-memory-write.png b/design/mock/05-memory-write.png Binary files differnew file mode 100644 index 0000000..370aa82 --- /dev/null +++ b/design/mock/05-memory-write.png diff --git a/design/mock/05-memory-write.svg b/design/mock/05-memory-write.svg new file mode 100644 index 0000000..2d0d264 --- /dev/null +++ b/design/mock/05-memory-write.svg @@ -0,0 +1,401 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="1920" height="1080" viewBox="0 0 1920 1080"> +<defs><pattern id="hatch" width="20" height="20" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="5" height="20" fill="#3a4a8a"/></pattern><pattern id="hazard" width="24" height="24" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="24" height="24" fill="#050a24"/><rect width="12" height="24" fill="#ff6a4a"/></pattern></defs> +<rect width="1920" height="1080" fill="#0a1030"/> +<text x="64.0" y="81.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">Where a pointer lives</text> +<text x="374.3 389.3 404.3 419.3 434.3 449.3 464.3 479.3 494.3" y="81.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">hello.c:8</text> +<text x="1790.9" y="80.0" font-family="Go Medium" font-size="22" fill="#6a7ab8" xml:space="preserve">kernel</text> +<rect x="1767.9" y="66.0" width="14.0" height="14.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<text x="1646.4" y="80.0" font-family="Go Medium" font-size="22" fill="#eee6d2" xml:space="preserve">memory</text> +<rect x="1622.4" y="65.0" width="16.0" height="16.0" fill="#e8c46a"/> +<text x="1547.1" y="80.0" font-family="Go Medium" font-size="22" fill="#9aa6d9" xml:space="preserve">cpu</text> +<rect x="1523.1" y="65.0" width="16.0" height="16.0" fill="#9aa6d9"/> +<text x="1416.1" y="80.0" font-family="Go Medium" font-size="22" fill="#9aa6d9" xml:space="preserve">source</text> +<rect x="1392.1" y="65.0" width="16.0" height="16.0" fill="#9aa6d9"/> +<line x1="64.0" y1="104.0" x2="1856.0" y2="104.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="64.0" y="120.0" width="728.0" height="48.0" fill="#16245f"/> +<rect x="65.0" y="121.0" width="726.0" height="382.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="64.0" y1="168.0" x2="792.0" y2="168.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="79.0" y="135.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="112.0" y="154.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">hello.c</text> +<rect x="66.0" y="186.0" width="6.0" height="44.0" fill="#ae9350"/> +<text x="112.0" y="218.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">7</text> +<text x="156.0 174.0 192.0 210.0" y="218.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">char</text> +<text x="246.0 264.0 282.0 300.0" y="218.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">buf[</text> +<text x="318.0 336.0" y="218.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">16</text> +<text x="354.0 372.0 390.0 408.0" y="218.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">] = </text> +<text x="426.0 444.0 462.0 480.0 498.0 516.0 534.0 552.0 570.0 588.0 606.0 624.0 642.0 660.0 678.0 696.0 714.0" y="218.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">"Hello, world!\n"</text> +<text x="732.0" y="218.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">;</text> +<rect x="66.0" y="234.0" width="724.0" height="44.0" fill="#4a3d1c"/> +<rect x="66.0" y="234.0" width="74.0" height="44.0" fill="#e8c46a"/> +<text x="112.0" y="266.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">8</text> +<text x="156.0 174.0 192.0 210.0" y="266.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">char</text> +<text x="246.0 264.0 282.0 300.0 318.0 336.0 354.0 372.0 390.0" y="266.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">*p = buf;</text> +<line x1="174.0" y1="282.0" x2="174.0" y2="374.0" stroke="#3a4a8a" stroke-width="2"/> +<text x="192.0 210.0 228.0" y="314.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">lea</text> +<text x="282.0 300.0 318.0 336.0 354.0 372.0 390.0 408.0 426.0 444.0 462.0 480.0 498.0 516.0 534.0" y="314.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">rax, [rbp-0x20]</text> +<rect x="170.0" y="331.0" width="620.0" height="42.0" fill="#4a3d1c"/> +<rect x="170.0" y="331.0" width="8.0" height="42.0" fill="#e8c46a"/> +<text x="192.0 210.0 228.0" y="362.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve" font-weight="bold">mov</text> +<text x="282.0 300.0 318.0 336.0 354.0 372.0 390.0 408.0 426.0 444.0 462.0 480.0 498.0 516.0" y="362.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">[rbp-0x8], rax</text> +<text x="112.0" y="410.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">9</text> +<text x="156.0 174.0 192.0 210.0 228.0 246.0" y="410.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">write(</text> +<text x="264.0" y="410.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">1</text> +<text x="282.0 300.0 318.0 336.0 354.0" y="410.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">, p, </text> +<text x="372.0 390.0" y="410.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">14</text> +<text x="408.0 426.0" y="410.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">);</text> +<text x="94.0 112.0" y="458.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">10</text> +<text x="156.0 174.0 192.0 210.0 228.0 246.0" y="458.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">return</text> +<text x="282.0" y="458.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">0</text> +<text x="300.0" y="458.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">;</text> +<rect x="64.0" y="528.0" width="728.0" height="48.0" fill="#16245f"/> +<rect x="65.0" y="529.0" width="726.0" height="358.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="64.0" y1="576.0" x2="792.0" y2="576.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="79.0" y="543.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="112.0" y="562.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">registers</text> +<text x="776.0" y="560.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">x86-64</text> +<rect x="66.0" y="593.0" width="724.0" height="42.0" fill="#4a3d1c"/> +<rect x="66.0" y="593.0" width="84.0" height="42.0" fill="#e8c46a"/> +<text x="457.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="475.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="493.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="511.0" y="624.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="538.0" y="624.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="556.0" y="624.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="574.0" y="624.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="592.0" y="624.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">4</text> +<text x="619.0" y="624.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="637.0" y="624.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="655.0" y="624.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="673.0" y="624.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="700.0" y="624.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="718.0" y="624.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="736.0" y="624.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">6</text> +<text x="754.0" y="624.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="84.0 102.0 120.0" y="624.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">rip</text> +<rect x="447.0" y="641.0" width="335.0" height="42.0" fill="#1c4652"/> +<rect x="448.5" y="642.5" width="332.0" height="39.0" fill="none" stroke="#6fd6e6" stroke-width="3"/> +<text x="457.0" y="672.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="475.0" y="672.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="493.0" y="672.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="511.0" y="672.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="538.0" y="672.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">7</text> +<text x="556.0" y="672.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="574.0" y="672.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="592.0" y="672.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="619.0" y="672.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3</text> +<text x="637.0" y="672.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="655.0" y="672.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<text x="673.0" y="672.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="700.0" y="672.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="718.0" y="672.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">e</text> +<text x="736.0" y="672.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">4</text> +<text x="754.0" y="672.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="84.0 102.0 120.0" y="672.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">rax</text> +<text x="457.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="475.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="493.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="511.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="538.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="556.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="574.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="592.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="619.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="637.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="655.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="673.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="700.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="718.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="736.0" y="720.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="754.0" y="720.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="84.0 102.0 120.0" y="720.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">rdi</text> +<text x="457.0" y="768.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="475.0" y="768.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="493.0" y="768.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="511.0" y="768.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="538.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">7</text> +<text x="556.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="574.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="592.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="619.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3</text> +<text x="637.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="655.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<text x="673.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="700.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="718.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">e</text> +<text x="736.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3</text> +<text x="754.0" y="768.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="84.0 102.0 120.0" y="768.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">rsp</text> +<text x="457.0" y="816.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="475.0" y="816.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="493.0" y="816.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="511.0" y="816.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="538.0" y="816.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">7</text> +<text x="556.0" y="816.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="574.0" y="816.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="592.0" y="816.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="619.0" y="816.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3</text> +<text x="637.0" y="816.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="655.0" y="816.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<text x="673.0" y="816.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="700.0" y="816.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="718.0" y="816.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">e</text> +<text x="736.0" y="816.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">6</text> +<text x="754.0" y="816.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="84.0 102.0 120.0" y="816.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">rbp</text> +<rect x="824.0" y="120.0" width="1032.0" height="48.0" fill="#16245f"/> +<rect x="825.0" y="121.0" width="1030.0" height="766.0" fill="none" stroke="#9aa6d9" stroke-width="2"/> +<line x1="824.0" y1="168.0" x2="1856.0" y2="168.0" stroke="#9aa6d9" stroke-width="2"/> +<rect x="838.0" y="134.0" width="20.0" height="20.0" fill="#e8c46a"/> +<text x="872.0" y="154.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">stack</text> +<text x="1840.0" y="152.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">from 7ffd 3a2c 1e30 · low addresses on top</text> +<text x="1124.0 1139.0" y="204.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">+0</text> +<text x="1172.0 1187.0" y="204.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">+1</text> +<text x="1220.0 1235.0" y="204.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">+2</text> +<text x="1268.0 1283.0" y="204.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">+3</text> +<text x="1316.0 1331.0" y="204.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">+4</text> +<text x="1364.0 1379.0" y="204.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">+5</text> +<text x="1412.0 1427.0" y="204.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">+6</text> +<text x="1460.0 1475.0" y="204.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">+7</text> +<text x="1522.0" y="204.0" font-family="Go Medium" font-size="22" fill="#6a7ab8" xml:space="preserve">as text</text> +<rect x="842.0" y="224.0" width="12.0" height="12.0" fill="#e8c46a"/> +<text x="866.0 881.0 896.0 911.0" y="238.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">main</text> +<line x1="942.0" y1="230.0" x2="1838.0" y2="230.0" stroke="#3a4a8a" stroke-width="2"/> +<text x="936.0 951.0 966.0 981.0" y="286.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">3a2c</text> +<text x="1004.0 1019.0 1034.0 1049.0" y="286.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1e30</text> +<rect x="1128.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1144.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1176.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1192.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1224.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1240.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1272.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1288.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1320.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1336.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1368.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1384.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1416.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1432.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1464.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1480.0" y="274.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="936.0 951.0 966.0 981.0" y="346.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">3a2c</text> +<text x="1004.0 1019.0 1034.0 1049.0" y="346.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1e38</text> +<rect x="1128.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1144.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1176.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1192.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1224.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1240.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1272.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1288.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1320.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1336.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1368.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1384.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1416.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1432.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1464.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1480.0" y="334.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="936.0 951.0 966.0 981.0" y="406.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">3a2c</text> +<text x="1004.0 1019.0 1034.0 1049.0" y="406.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1e40</text> +<rect x="1116.0" y="374.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1121.0 1139.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">48</text> +<rect x="1164.0" y="374.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1169.0 1187.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">65</text> +<rect x="1212.0" y="374.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1217.0 1235.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">6c</text> +<rect x="1260.0" y="374.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1265.0 1283.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">6c</text> +<rect x="1308.0" y="374.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1313.0 1331.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">6f</text> +<rect x="1356.0" y="374.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1361.0 1379.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2c</text> +<rect x="1404.0" y="374.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1409.0 1427.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">20</text> +<rect x="1452.0" y="374.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1457.0 1475.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">77</text> +<text x="1522.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">H</text> +<text x="1540.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">e</text> +<text x="1558.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">l</text> +<text x="1576.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">l</text> +<text x="1594.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">o</text> +<text x="1612.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">,</text> +<text x="1630.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve"> </text> +<text x="1648.0" y="407.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">w</text> +<text x="1700.0 1718.0 1736.0" y="407.8" font-family="Go Mono" font-size="30" fill="#9aa6d9" xml:space="preserve">buf</text> +<text x="936.0 951.0 966.0 981.0" y="466.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">3a2c</text> +<text x="1004.0 1019.0 1034.0 1049.0" y="466.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1e48</text> +<rect x="1116.0" y="434.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1121.0 1139.0" y="467.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">6f</text> +<rect x="1164.0" y="434.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1169.0 1187.0" y="467.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">72</text> +<rect x="1212.0" y="434.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1217.0 1235.0" y="467.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">6c</text> +<rect x="1260.0" y="434.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1265.0 1283.0" y="467.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">64</text> +<rect x="1308.0" y="434.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1313.0 1331.0" y="467.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">21</text> +<rect x="1356.0" y="434.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1361.0 1379.0" y="467.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0a</text> +<rect x="1404.0" y="434.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1409.0 1427.0" y="467.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">00</text> +<rect x="1452.0" y="434.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1457.0 1475.0" y="467.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">00</text> +<text x="1522.0" y="467.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">o</text> +<text x="1540.0" y="467.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">r</text> +<text x="1558.0" y="467.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">l</text> +<text x="1576.0" y="467.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="1594.0" y="467.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">!</text> +<text x="1612.0" y="467.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1630.0" y="467.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1648.0" y="467.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="936.0 951.0 966.0 981.0" y="526.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">3a2c</text> +<text x="1004.0 1019.0 1034.0 1049.0" y="526.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1e50</text> +<rect x="1116.0" y="494.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1121.0 1139.0" y="527.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">00</text> +<rect x="1164.0" y="494.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1169.0 1187.0" y="527.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3f</text> +<rect x="1212.0" y="494.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1217.0 1235.0" y="527.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">9a</text> +<rect x="1260.0" y="494.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1265.0 1283.0" y="527.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c1</text> +<rect x="1308.0" y="494.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1313.0 1331.0" y="527.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">77</text> +<rect x="1356.0" y="494.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1361.0 1379.0" y="527.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d2</text> +<rect x="1404.0" y="494.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1409.0 1427.0" y="527.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">8e</text> +<rect x="1452.0" y="494.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1457.0 1475.0" y="527.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5b</text> +<text x="1522.0" y="527.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1540.0" y="527.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">?</text> +<text x="1558.0" y="527.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1576.0" y="527.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1594.0" y="527.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">w</text> +<text x="1612.0" y="527.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1630.0" y="527.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1648.0" y="527.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">[</text> +<text x="1700.0" y="527.1" font-family="Go" font-size="28" fill="#9aa6d9" xml:space="preserve">canary</text> +<text x="936.0 951.0 966.0 981.0" y="586.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">3a2c</text> +<text x="1004.0 1019.0 1034.0 1049.0" y="586.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1e58</text> +<rect x="1116.0" y="554.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1121.0 1139.0" y="587.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">40</text> +<rect x="1164.0" y="554.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1169.0 1187.0" y="587.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">1e</text> +<rect x="1212.0" y="554.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1217.0 1235.0" y="587.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">2c</text> +<rect x="1260.0" y="554.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1265.0 1283.0" y="587.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">3a</text> +<rect x="1308.0" y="554.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1313.0 1331.0" y="587.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">fd</text> +<rect x="1356.0" y="554.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1361.0 1379.0" y="587.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">7f</text> +<rect x="1404.0" y="554.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1409.0 1427.0" y="587.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">00</text> +<rect x="1452.0" y="554.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1457.0 1475.0" y="587.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">00</text> +<text x="1522.0" y="587.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">@</text> +<text x="1540.0" y="587.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1558.0" y="587.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">,</text> +<text x="1576.0" y="587.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">:</text> +<text x="1594.0" y="587.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1612.0" y="587.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1630.0" y="587.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1648.0" y="587.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1700.0" y="587.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">p</text> +<text x="936.0 951.0 966.0 981.0" y="646.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">3a2c</text> +<text x="1004.0 1019.0 1034.0 1049.0" y="646.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1e60</text> +<rect x="1116.0" y="614.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1121.0 1139.0" y="647.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">00</text> +<rect x="1164.0" y="614.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1169.0 1187.0" y="647.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1f</text> +<rect x="1212.0" y="614.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1217.0 1235.0" y="647.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2c</text> +<rect x="1260.0" y="614.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1265.0 1283.0" y="647.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3a</text> +<rect x="1308.0" y="614.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1313.0 1331.0" y="647.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">fd</text> +<rect x="1356.0" y="614.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1361.0 1379.0" y="647.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">7f</text> +<rect x="1404.0" y="614.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1409.0 1427.0" y="647.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">00</text> +<rect x="1452.0" y="614.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1457.0 1475.0" y="647.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">00</text> +<text x="1522.0" y="647.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1540.0" y="647.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1558.0" y="647.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">,</text> +<text x="1576.0" y="647.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">:</text> +<text x="1594.0" y="647.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1612.0" y="647.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1630.0" y="647.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1648.0" y="647.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1700.0" y="647.1" font-family="Go" font-size="28" fill="#9aa6d9" xml:space="preserve">saved rbp</text> +<text x="936.0 951.0 966.0 981.0" y="706.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">3a2c</text> +<text x="1004.0 1019.0 1034.0 1049.0" y="706.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1e68</text> +<rect x="1116.0" y="674.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1121.0 1139.0" y="707.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">90</text> +<rect x="1164.0" y="674.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1169.0 1187.0" y="707.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">9d</text> +<rect x="1212.0" y="674.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1217.0 1235.0" y="707.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">22</text> +<rect x="1260.0" y="674.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1265.0 1283.0" y="707.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5e</text> +<rect x="1308.0" y="674.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1313.0 1331.0" y="707.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3c</text> +<rect x="1356.0" y="674.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1361.0 1379.0" y="707.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">7f</text> +<rect x="1404.0" y="674.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1409.0 1427.0" y="707.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">00</text> +<rect x="1452.0" y="674.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1457.0 1475.0" y="707.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">00</text> +<text x="1522.0" y="707.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1540.0" y="707.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1558.0" y="707.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">"</text> +<text x="1576.0" y="707.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">^</text> +<text x="1594.0" y="707.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve"><</text> +<text x="1612.0" y="707.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1630.0" y="707.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1648.0" y="707.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">·</text> +<text x="1700.0" y="707.1" font-family="Go" font-size="28" fill="#9aa6d9" xml:space="preserve">return to</text> +<path d="M1680,376 h8 V478 h-8" fill="none" stroke="#9aa6d9" stroke-width="3" stroke-linejoin="miter" stroke-linecap="butt"/> +<rect x="843.0" y="737.0" width="10.0" height="10.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="866.0 881.0 896.0 911.0 926.0 941.0 956.0 971.0 986.0 1001.0 1016.0 1031.0 1046.0 1061.0 1076.0 1091.0 1106.0 1121.0 1136.0 1151.0 1166.0 1181.0" y="750.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">__libc_start_call_main</text> +<line x1="1212.0" y1="742.0" x2="1838.0" y2="742.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1112.0" y="550.0" width="390.0" height="54.0" fill="none" stroke="#d59cf5" stroke-width="4"/> +<path d="M1110.0,577.0 L1098.0,577.0 Q1086.0,577.0 1086.0,565.0 L1086.0,402.5 Q1086.0,397.0 1091.5,397.0 L1097.0,397.0" fill="none" stroke="#d59cf5" stroke-width="4" stroke-linejoin="round" stroke-linecap="butt"/> +<path d="M1113.0,397.0 L1095.0,405.0 L1095.0,389.0 Z" fill="#d59cf5"/> +<rect x="849.0" y="257.0" width="65.0" height="40.0" fill="#16245f"/> +<rect x="850.0" y="258.0" width="63.0" height="38.0" fill="none" stroke="#d59cf5" stroke-width="2"/> +<text x="859.0 874.0 889.0" y="286.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">rsp</text> +<path d="M930,277 l-14,-9 v18 Z" fill="#d59cf5"/> +<rect x="849.0" y="617.0" width="65.0" height="40.0" fill="#16245f"/> +<rect x="850.0" y="618.0" width="63.0" height="38.0" fill="none" stroke="#d59cf5" stroke-width="2"/> +<text x="859.0 874.0 889.0" y="646.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">rbp</text> +<path d="M930,637 l-14,-9 v18 Z" fill="#d59cf5"/> +<path d="M778.0,662.0 L796.0,662.0 Q808.0,662.0 808.0,650.0 L808.0,589.0 Q808.0,577.0 820.0,577.0 L912.0,577.0" fill="none" stroke="#eee6d2" stroke-width="3" stroke-linejoin="round" stroke-linecap="butt"/> +<path d="M926.0,577.0 L910.0,584.0 L910.0,570.0 Z" fill="#eee6d2"/> +<text x="1116.0" y="794.0" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">the same eight bytes, low byte first, as one number</text> +<rect x="1116.0" y="816.0" width="382.0" height="46.0" fill="#16245f"/> +<text x="1149.5" y="849.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1167.5" y="849.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1185.5" y="849.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1203.5" y="849.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="1230.5" y="849.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">7</text> +<text x="1248.5" y="849.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="1266.5" y="849.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="1284.5" y="849.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="1311.5" y="849.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3</text> +<text x="1329.5" y="849.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="1347.5" y="849.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<text x="1365.5" y="849.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="1392.5" y="849.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="1410.5" y="849.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">e</text> +<text x="1428.5" y="849.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">4</text> +<text x="1446.5" y="849.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<rect x="1112.0" y="812.0" width="390.0" height="54.0" fill="none" stroke="#d59cf5" stroke-width="4"/> +<text x="1522.0" y="849.1" font-family="Go" font-size="28" fill="#9aa6d9" xml:space="preserve">= where </text> +<text x="1630.2 1648.2 1666.2" y="849.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">buf</text> +<text x="1694.2" y="849.1" font-family="Go" font-size="28" fill="#9aa6d9" xml:space="preserve">starts</text> +<text x="64.0" y="964.0" font-size="40" xml:space="preserve"><tspan font-family="Go" font-weight="normal" fill="#eee6d2">The pointer </tspan><tspan font-family="Go Mono" font-weight="normal" fill="#eee6d2" font-size="35">p</tspan><tspan font-family="Go" font-weight="normal" fill="#eee6d2"> is eight ordinary bytes on the stack.</tspan></text> +<text x="64.0" y="1018.0" font-size="40" xml:space="preserve"><tspan font-family="Go" font-weight="normal" fill="#eee6d2">Read as one number, they are the address of </tspan><tspan font-family="Go Mono" font-weight="normal" fill="#eee6d2" font-size="35">buf</tspan><tspan font-family="Go" font-weight="normal" fill="#eee6d2">.</tspan></text> +</svg> diff --git a/design/mock/06-title-legend-480.png b/design/mock/06-title-legend-480.png Binary files differnew file mode 100644 index 0000000..7daa823 --- /dev/null +++ b/design/mock/06-title-legend-480.png diff --git a/design/mock/06-title-legend.png b/design/mock/06-title-legend.png Binary files differnew file mode 100644 index 0000000..696b59a --- /dev/null +++ b/design/mock/06-title-legend.png diff --git a/design/mock/06-title-legend.svg b/design/mock/06-title-legend.svg new file mode 100644 index 0000000..8e57394 --- /dev/null +++ b/design/mock/06-title-legend.svg @@ -0,0 +1,79 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="1920" height="1080" viewBox="0 0 1920 1080"> +<defs><pattern id="hatch" width="20" height="20" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="5" height="20" fill="#3a4a8a"/></pattern><pattern id="hazard" width="24" height="24" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="24" height="24" fill="#050a24"/><rect width="12" height="24" fill="#ff6a4a"/></pattern></defs> +<rect width="1920" height="1080" fill="#0a1030"/> +<rect x="64.0" y="150.0" width="24.0" height="24.0" fill="#e8c46a"/> +<text x="108.0" y="172.0" font-family="Go Medium" font-size="30" fill="#9aa6d9" xml:space="preserve">How programs really run</text> +<text x="1856.0" y="172.0" font-family="Go Medium" font-size="30" fill="#6a7ab8" xml:space="preserve" text-anchor="end">part 3</text> +<text x="60.0" y="330.0" font-family="Go" font-size="116" fill="#fff8e8" xml:space="preserve" font-weight="bold">Where does malloc</text> +<text x="60.0" y="458.0" font-family="Go" font-size="116" fill="#fff8e8" xml:space="preserve" font-weight="bold">keep its notes?</text> +<text x="64.0" y="540.0" font-size="44" xml:space="preserve"><tspan font-family="Go" font-weight="normal" fill="#9aa6d9">glibc and musl, one </tspan><tspan font-family="Go Mono" font-weight="normal" fill="#eee6d2" font-size="38">free()</tspan><tspan font-family="Go" font-weight="normal" fill="#9aa6d9"> at a time</tspan></text> +<rect x="64.0" y="624.0" width="1792.0" height="48.0" fill="#16245f"/> +<rect x="65.0" y="625.0" width="1790.0" height="262.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="64.0" y1="672.0" x2="1856.0" y2="672.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="79.0" y="639.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="112.0" y="658.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">legend</text> +<text x="1840.0" y="656.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">the same marks in every picture</text> +<rect x="88.0" y="706.0" width="94.0" height="46.0" fill="#e8c46a"/> +<text x="108.0 126.0 144.0" y="739.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">rip</text> +<text x="198.0" y="724.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">current</text> +<text x="198.0" y="754.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">executing now</text> +<rect x="380.0" y="706.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="385.0 403.0" y="739.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">2a</text> +<rect x="428.0" y="706.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="433.0 451.0" y="739.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">00</text> +<text x="490.0" y="724.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">written</text> +<text x="490.0" y="754.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">by this step</text> +<rect x="672.0" y="706.0" width="46.0" height="46.0" fill="#5a2218"/> +<rect x="672.0" y="746.0" width="46.0" height="6.0" fill="#ff6a4a"/> +<text x="677.0 695.0" y="739.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2a</text> +<rect x="720.0" y="706.0" width="46.0" height="46.0" fill="#5a2218"/> +<rect x="720.0" y="746.0" width="46.0" height="6.0" fill="#ff6a4a"/> +<text x="725.0 743.0" y="739.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">00</text> +<text x="782.0" y="724.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">changed</text> +<text x="782.0" y="754.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">a moment ago</text> +<rect x="964.0" y="706.0" width="46.0" height="46.0" fill="#1c4652"/> +<rect x="965.5" y="707.5" width="43.0" height="43.0" fill="none" stroke="#6fd6e6" stroke-width="3"/> +<text x="969.0 987.0" y="739.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2a</text> +<rect x="1012.0" y="706.0" width="46.0" height="46.0" fill="#1c4652"/> +<rect x="1013.5" y="707.5" width="43.0" height="43.0" fill="none" stroke="#6fd6e6" stroke-width="3"/> +<text x="1017.0 1035.0" y="739.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">00</text> +<text x="1074.0" y="724.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">read</text> +<text x="1074.0" y="754.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">by this step</text> +<rect x="1256.0" y="706.0" width="34.0" height="46.0" fill="#16245f"/> +<rect x="1252.0" y="702.0" width="42.0" height="54.0" fill="none" stroke="#d59cf5" stroke-width="4"/> +<path d="M1296.0,729.0 L1334.0,729.0" fill="none" stroke="#d59cf5" stroke-width="4" stroke-linejoin="round" stroke-linecap="butt"/> +<path d="M1350.0,729.0 L1332.0,737.0 L1332.0,721.0 Z" fill="#d59cf5"/> +<text x="1366.0" y="724.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">pointer</text> +<text x="1366.0" y="754.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">an address</text> +<path d="M1548.0,729.0 L1628.0,729.0" fill="none" stroke="#eee6d2" stroke-width="3" stroke-linejoin="round" stroke-linecap="butt"/> +<path d="M1642.0,729.0 L1626.0,736.0 L1626.0,722.0 Z" fill="#eee6d2"/> +<text x="1658.0" y="724.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">moving</text> +<text x="1658.0" y="754.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">in transit</text> +<rect x="88.0" y="802.0" width="94.0" height="46.0" fill="#1f4a33"/> +<rect x="89.5" y="803.5" width="91.0" height="43.0" fill="none" stroke="#7fdc9a" stroke-width="3"/> +<text x="198.0" y="820.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">allocated</text> +<text x="198.0" y="850.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">handed out</text> +<rect x="380.0" y="802.0" width="94.0" height="46.0" fill="url(#hatch)"/> +<rect x="381.5" y="803.5" width="91.0" height="43.0" fill="none" stroke="#9aa6d9" stroke-width="3" stroke-dasharray="12 8"/> +<text x="490.0" y="820.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">freed</text> +<text x="490.0" y="850.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">handed back</text> +<rect x="684.0" y="822.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="700.0" y="822.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="732.0" y="822.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="748.0" y="822.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="782.0" y="820.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">not seen</text> +<text x="782.0" y="850.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">never observed</text> +<rect x="964.0" y="802.0" width="94.0" height="46.0" fill="#eee6d2"/> +<text x="984.0 1002.0 1020.0" y="835.8" font-family="Go Mono" font-size="30" fill="#0a1030" xml:space="preserve" font-weight="bold">sys</text> +<text x="1074.0" y="820.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">kernel</text> +<text x="1074.0" y="850.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">the other side</text> +<rect x="1256.0" y="802.0" width="94.0" height="46.0" fill="url(#hazard)"/> +<rect x="1264.0" y="810.0" width="78.0" height="30.0" fill="#050a24"/> +<text x="1273.0 1288.0 1303.0 1318.0" y="834.0" font-family="Go Mono" font-size="25" fill="#fff8e8" xml:space="preserve" font-weight="bold">SEGV</text> +<text x="1366.0" y="820.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">fault</text> +<text x="1366.0" y="850.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">signal or error</text> +<rect x="1548.0" y="802.0" width="43.0" height="46.0" fill="#8a5e0c"/> +<rect x="1599.0" y="802.0" width="43.0" height="46.0" fill="#17707c"/> +<text x="1658.0" y="820.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">one object</text> +<text x="1658.0" y="850.0" font-family="Go" font-size="22" fill="#9aa6d9" xml:space="preserve">in every view</text> +</svg> diff --git a/design/mock/07-sort-swap-480.png b/design/mock/07-sort-swap-480.png Binary files differnew file mode 100644 index 0000000..a2b75f0 --- /dev/null +++ b/design/mock/07-sort-swap-480.png diff --git a/design/mock/07-sort-swap.png b/design/mock/07-sort-swap.png Binary files differnew file mode 100644 index 0000000..e6127b2 --- /dev/null +++ b/design/mock/07-sort-swap.png diff --git a/design/mock/07-sort-swap.svg b/design/mock/07-sort-swap.svg new file mode 100644 index 0000000..6e866e5 --- /dev/null +++ b/design/mock/07-sort-swap.svg @@ -0,0 +1,129 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="1920" height="1080" viewBox="0 0 1920 1080"> +<defs><pattern id="hatch" width="20" height="20" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="5" height="20" fill="#3a4a8a"/></pattern><pattern id="hazard" width="24" height="24" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="24" height="24" fill="#050a24"/><rect width="12" height="24" fill="#ff6a4a"/></pattern></defs> +<rect width="1920" height="1080" fill="#0a1030"/> +<text x="64.0" y="81.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">Insertion sort</text> +<text x="275.1 290.1 305.1 320.1 335.1 350.1 365.1 380.1" y="81.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">sort.c:6</text> +<text x="1790.9" y="80.0" font-family="Go Medium" font-size="22" fill="#6a7ab8" xml:space="preserve">kernel</text> +<rect x="1767.9" y="66.0" width="14.0" height="14.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<text x="1646.4" y="80.0" font-family="Go Medium" font-size="22" fill="#6a7ab8" xml:space="preserve">memory</text> +<rect x="1623.4" y="66.0" width="14.0" height="14.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<text x="1547.1" y="80.0" font-family="Go Medium" font-size="22" fill="#6a7ab8" xml:space="preserve">cpu</text> +<rect x="1524.1" y="66.0" width="14.0" height="14.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<text x="1416.1" y="80.0" font-family="Go Medium" font-size="22" fill="#eee6d2" xml:space="preserve">source</text> +<rect x="1392.1" y="65.0" width="16.0" height="16.0" fill="#e8c46a"/> +<line x1="64.0" y1="104.0" x2="1856.0" y2="104.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="64.0" y="120.0" width="1792.0" height="48.0" fill="#16245f"/> +<rect x="65.0" y="121.0" width="1790.0" height="406.0" fill="none" stroke="#9aa6d9" stroke-width="2"/> +<line x1="64.0" y1="168.0" x2="1856.0" y2="168.0" stroke="#9aa6d9" stroke-width="2"/> +<rect x="78.0" y="134.0" width="20.0" height="20.0" fill="#e8c46a"/> +<text x="112.0" y="154.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">a</text> +<text x="1840.0" y="152.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">int a[8]</text> +<rect x="288.0" y="308.0" width="166.0" height="132.0" fill="#16245f"/> +<text x="302.0" y="342.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">0</text> +<text x="353.0" y="413.6" font-family="Go Mono" font-size="60" fill="#eee6d2" xml:space="preserve">4</text> +<rect x="456.0" y="308.0" width="166.0" height="132.0" fill="#16245f"/> +<text x="470.0" y="342.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">1</text> +<text x="521.0" y="413.6" font-family="Go Mono" font-size="60" fill="#eee6d2" xml:space="preserve">9</text> +<rect x="624.0" y="308.0" width="166.0" height="132.0" fill="#16245f"/> +<text x="638.0" y="342.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">2</text> +<text x="671.0 707.0" y="413.6" font-family="Go Mono" font-size="60" fill="#eee6d2" xml:space="preserve">17</text> +<rect x="792.0" y="308.0" width="166.0" height="132.0" fill="#1c4652"/> +<rect x="794.0" y="310.0" width="162.0" height="128.0" fill="none" stroke="#6fd6e6" stroke-width="4"/> +<text x="806.0" y="342.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">3</text> +<rect x="883.0" y="318.0" width="65.0" height="36.0" fill="#0a1030"/> +<text x="893.0 908.0 923.0" y="345.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve" font-weight="bold">j-1</text> +<text x="839.0 875.0" y="413.6" font-family="Go Mono" font-size="60" fill="#6a7ab8" xml:space="preserve">31</text> +<rect x="960.0" y="308.0" width="166.0" height="132.0" fill="#1c4652"/> +<rect x="962.0" y="310.0" width="162.0" height="128.0" fill="none" stroke="#6fd6e6" stroke-width="4"/> +<text x="974.0" y="342.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">4</text> +<rect x="1081.0" y="318.0" width="35.0" height="36.0" fill="#0a1030"/> +<text x="1091.0" y="345.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve" font-weight="bold">j</text> +<text x="1007.0 1043.0" y="413.6" font-family="Go Mono" font-size="60" fill="#6a7ab8" xml:space="preserve">12</text> +<rect x="1128.0" y="308.0" width="166.0" height="132.0" fill="#5a2218"/> +<rect x="1128.0" y="434.0" width="166.0" height="6.0" fill="#ff6a4a"/> +<text x="1142.0" y="342.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">5</text> +<rect x="1249.0" y="318.0" width="35.0" height="36.0" fill="#0a1030"/> +<text x="1259.0" y="345.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve" font-weight="bold">i</text> +<text x="1175.0 1211.0" y="413.6" font-family="Go Mono" font-size="60" fill="#eee6d2" xml:space="preserve">26</text> +<rect x="1296.0" y="308.0" width="166.0" height="132.0" fill="#16245f"/> +<text x="1310.0" y="342.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">6</text> +<text x="1361.0" y="413.6" font-family="Go Mono" font-size="60" fill="#eee6d2" xml:space="preserve">5</text> +<rect x="1464.0" y="308.0" width="166.0" height="132.0" fill="#16245f"/> +<text x="1478.0" y="342.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">7</text> +<text x="1511.0 1547.0" y="413.6" font-family="Go Mono" font-size="60" fill="#eee6d2" xml:space="preserve">20</text> +<rect x="882.0" y="179.0" width="156.0" height="44.0" fill="none" stroke="#9aa6d9" stroke-width="2"/> +<text x="897.0 915.0 933.0 951.0 969.0 987.0 1005.0" y="211.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">31 > 12</text> +<text x="1055.0" y="209.6" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">so they trade places</text> +<path d="M876.0,304 Q960.0,212.0 1044.0,304" fill="none" stroke="#9aa6d9" stroke-width="3" stroke-linejoin="round" stroke-linecap="butt"/> +<path d="M1044.0,304.0 L1028.0,296.9 L1038.4,287.5 Z" fill="#9aa6d9"/> +<rect x="886.5" y="231.6" width="100.0" height="60.0" fill="#0a1030"/> +<rect x="888.0" y="233.1" width="97.0" height="57.0" fill="none" stroke="#fff8e8" stroke-width="3"/> +<text x="909.5 936.5" y="277.8" font-family="Go Mono" font-size="45" fill="#fff8e8" xml:space="preserve" font-weight="bold">31</text> +<path d="M1044.0,444 Q960.0,536.0 876.0,444" fill="none" stroke="#9aa6d9" stroke-width="3" stroke-linejoin="round" stroke-linecap="butt"/> +<path d="M876.0,444.0 L892.0,451.1 L881.6,460.5 Z" fill="#9aa6d9"/> +<rect x="933.5" y="456.4" width="100.0" height="60.0" fill="#0a1030"/> +<rect x="935.0" y="457.9" width="97.0" height="57.0" fill="none" stroke="#fff8e8" stroke-width="3"/> +<text x="956.5 983.5" y="502.6" font-family="Go Mono" font-size="45" fill="#fff8e8" xml:space="preserve" font-weight="bold">12</text> +<rect x="64.0" y="552.0" width="1032.0" height="48.0" fill="#16245f"/> +<rect x="65.0" y="553.0" width="1030.0" height="334.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="64.0" y1="600.0" x2="1096.0" y2="600.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="79.0" y="567.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="112.0" y="586.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">sort.c</text> +<text x="112.0" y="650.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">3</text> +<text x="156.0 174.0 192.0" y="650.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">for</text> +<text x="228.0" y="650.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">(</text> +<text x="246.0 264.0 282.0" y="650.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">int</text> +<text x="318.0 336.0 354.0 372.0" y="650.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">i = </text> +<text x="390.0" y="650.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">1</text> +<text x="408.0 426.0 444.0 462.0 480.0 498.0 516.0 534.0 552.0 570.0 588.0 606.0 624.0 642.0 660.0" y="650.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">; i < n; i++) {</text> +<text x="112.0" y="698.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">4</text> +<text x="228.0 246.0 264.0" y="698.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">int</text> +<text x="300.0 318.0 336.0 354.0 372.0 390.0" y="698.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">j = i;</text> +<rect x="66.0" y="714.0" width="6.0" height="44.0" fill="#ae9350"/> +<text x="112.0" y="746.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">5</text> +<text x="228.0 246.0 264.0 282.0 300.0" y="746.8" font-family="Go Mono" font-size="30" fill="#c0dcff" xml:space="preserve" font-weight="bold">while</text> +<text x="336.0 354.0 372.0 390.0 408.0" y="746.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">(j > </text> +<text x="426.0" y="746.8" font-family="Go Mono" font-size="30" fill="#c8f0d8" xml:space="preserve">0</text> +<text x="462.0 480.0 498.0 516.0 534.0 552.0 570.0 588.0 606.0 624.0 642.0 660.0 678.0 696.0 714.0 732.0 750.0 768.0 786.0" y="746.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">&& a[j-1] > a[j]) {</text> +<rect x="66.0" y="762.0" width="1028.0" height="44.0" fill="#4a3d1c"/> +<rect x="66.0" y="762.0" width="74.0" height="44.0" fill="#e8c46a"/> +<text x="112.0" y="794.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">6</text> +<text x="300.0 318.0 336.0 354.0 372.0 390.0 408.0 426.0 444.0 462.0 480.0 498.0 516.0 534.0 552.0 570.0 588.0 606.0 624.0 642.0 660.0" y="794.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">swap(&a[j-1], &a[j]);</text> +<rect x="66.0" y="810.0" width="6.0" height="44.0" fill="#746235"/> +<text x="112.0" y="842.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">7</text> +<text x="300.0 318.0 336.0 354.0" y="842.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">j--;</text> +<rect x="1128.0" y="552.0" width="728.0" height="48.0" fill="#16245f"/> +<rect x="1129.0" y="553.0" width="726.0" height="334.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="1128.0" y1="600.0" x2="1856.0" y2="600.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1143.0" y="567.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="1176.0" y="586.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">locals</text> +<text x="1840.0" y="584.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">of sort()</text> +<text x="1152.0" y="645.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">i</text> +<text x="1212.0 1227.0 1242.0" y="644.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">int</text> +<text x="1340.0" y="645.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5</text> +<text x="1152.0" y="701.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">j</text> +<text x="1212.0 1227.0 1242.0" y="700.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">int</text> +<rect x="1324.0" y="668.0" width="76.0" height="46.0" fill="#5a2218"/> +<rect x="1324.0" y="708.0" width="76.0" height="6.0" fill="#ff6a4a"/> +<text x="1340.0" y="701.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">4</text> +<text x="1152.0" y="757.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">n</text> +<text x="1212.0 1227.0 1242.0" y="756.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">int</text> +<text x="1340.0" y="757.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">8</text> +<text x="1152.0" y="813.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="1212.0 1227.0 1242.0 1257.0 1272.0" y="812.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">int *</text> +<text x="1340.0" y="813.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">7</text> +<text x="1358.0" y="813.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="1376.0" y="813.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">f</text> +<text x="1394.0" y="813.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d</text> +<text x="1421.0" y="813.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3</text> +<text x="1439.0" y="813.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">a</text> +<text x="1457.0" y="813.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<text x="1475.0" y="813.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c</text> +<text x="1502.0" y="813.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">1</text> +<text x="1520.0" y="813.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">e</text> +<text x="1538.0" y="813.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2</text> +<text x="1556.0" y="813.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0</text> +<text x="1594.0" y="811.6" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve">where a[0] is</text> +<text x="64.0" y="964.0" font-size="40" xml:space="preserve"><tspan font-family="Go" font-weight="normal" fill="#eee6d2">While the one on the left is larger, they trade places,</tspan></text> +<text x="64.0" y="1018.0" font-size="40" xml:space="preserve"><tspan font-family="Go" font-weight="normal" fill="#eee6d2">and </tspan><tspan font-family="Go Mono" font-weight="normal" fill="#eee6d2" font-size="35">j</tspan><tspan font-family="Go" font-weight="normal" fill="#eee6d2"> follows the smaller value down.</tspan></text> +</svg> diff --git a/design/mock/08-far-view-480.png b/design/mock/08-far-view-480.png Binary files differnew file mode 100644 index 0000000..d182a84 --- /dev/null +++ b/design/mock/08-far-view-480.png diff --git a/design/mock/08-far-view.png b/design/mock/08-far-view.png Binary files differnew file mode 100644 index 0000000..e148dd4 --- /dev/null +++ b/design/mock/08-far-view.png diff --git a/design/mock/08-far-view.svg b/design/mock/08-far-view.svg new file mode 100644 index 0000000..d97688f --- /dev/null +++ b/design/mock/08-far-view.svg @@ -0,0 +1,329 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="1920" height="1080" viewBox="0 0 1920 1080"> +<defs><pattern id="hatch" width="20" height="20" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="5" height="20" fill="#3a4a8a"/></pattern><pattern id="hazard" width="24" height="24" patternUnits="userSpaceOnUse" patternTransform="rotate(45)"><rect width="24" height="24" fill="#050a24"/><rect width="12" height="24" fill="#ff6a4a"/></pattern></defs> +<rect width="1920" height="1080" fill="#0a1030"/> +<text x="64.0" y="81.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">A process, from far away</text> +<text x="421.8 436.8 451.8 466.8 481.8" y="81.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">hello</text> +<text x="1790.9" y="80.0" font-family="Go Medium" font-size="22" fill="#9aa6d9" xml:space="preserve">kernel</text> +<rect x="1766.9" y="65.0" width="16.0" height="16.0" fill="#9aa6d9"/> +<text x="1646.4" y="80.0" font-family="Go Medium" font-size="22" fill="#eee6d2" xml:space="preserve">memory</text> +<rect x="1622.4" y="65.0" width="16.0" height="16.0" fill="#e8c46a"/> +<text x="1547.1" y="80.0" font-family="Go Medium" font-size="22" fill="#6a7ab8" xml:space="preserve">cpu</text> +<rect x="1524.1" y="66.0" width="14.0" height="14.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<text x="1416.1" y="80.0" font-family="Go Medium" font-size="22" fill="#6a7ab8" xml:space="preserve">source</text> +<rect x="1393.1" y="66.0" width="14.0" height="14.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="64.0" y1="104.0" x2="1856.0" y2="104.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="64.0" y="120.0" width="1184.0" height="48.0" fill="#16245f"/> +<rect x="65.0" y="121.0" width="1182.0" height="478.0" fill="none" stroke="#9aa6d9" stroke-width="2"/> +<line x1="64.0" y1="168.0" x2="1248.0" y2="168.0" stroke="#9aa6d9" stroke-width="2"/> +<rect x="78.0" y="134.0" width="20.0" height="20.0" fill="#e8c46a"/> +<text x="112.0" y="154.0" font-family="Go Medium" font-size="28" fill="#eee6d2" xml:space="preserve">address space</text> +<text x="1232.0" y="152.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">one square a page of 4096 bytes · low addresses on top</text> +<text x="88.0 103.0 118.0 133.0" y="212.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">55d4</text> +<text x="156.0 171.0 186.0 201.0" y="212.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">a1c0</text> +<text x="224.0 239.0 254.0 269.0" y="212.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1000</text> +<rect x="308.0" y="188.0" width="26.0" height="30.0" fill="#16245f"/> +<text x="313.5" y="212.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">r</text> +<rect x="348.0" y="200.0" width="6.0" height="6.0" fill="#3a4a8a"/> +<rect x="368.0" y="188.0" width="26.0" height="30.0" fill="#16245f"/> +<text x="373.5" y="212.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">x</text> +<text x="414.0 429.0 444.0 459.0 474.0" y="212.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">hello</text> +<text x="614.0 629.0" y="212.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">4K</text> +<rect x="668.0" y="192.0" width="22.0" height="22.0" fill="#e8c46a"/> +<text x="88.0 103.0 118.0 133.0" y="254.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">55d4</text> +<text x="156.0 171.0 186.0 201.0" y="254.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">a1c0</text> +<text x="224.0 239.0 254.0 269.0" y="254.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">2000</text> +<rect x="308.0" y="230.0" width="26.0" height="30.0" fill="#16245f"/> +<text x="313.5" y="254.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">r</text> +<rect x="348.0" y="242.0" width="6.0" height="6.0" fill="#3a4a8a"/> +<rect x="378.0" y="242.0" width="6.0" height="6.0" fill="#3a4a8a"/> +<text x="414.0 429.0 444.0 459.0 474.0" y="254.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">hello</text> +<text x="614.0 629.0" y="254.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">4K</text> +<rect x="668.0" y="234.0" width="22.0" height="22.0" fill="#6fd6e6"/> +<text x="88.0 103.0 118.0 133.0" y="296.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">55d4</text> +<text x="156.0 171.0 186.0 201.0" y="296.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">a1c0</text> +<text x="224.0 239.0 254.0 269.0" y="296.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">3000</text> +<rect x="308.0" y="272.0" width="26.0" height="30.0" fill="#16245f"/> +<text x="313.5" y="296.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">r</text> +<rect x="338.0" y="272.0" width="26.0" height="30.0" fill="#16245f"/> +<text x="343.5" y="296.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">w</text> +<rect x="378.0" y="284.0" width="6.0" height="6.0" fill="#3a4a8a"/> +<text x="414.0 429.0 444.0 459.0 474.0" y="296.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">hello</text> +<text x="614.0 629.0" y="296.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">8K</text> +<rect x="668.0" y="276.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="692.0" y="276.0" width="22.0" height="22.0" fill="#5a2218"/> +<rect x="692.0" y="292.0" width="22.0" height="6.0" fill="#ff6a4a"/> +<text x="88.0 103.0 118.0 133.0" y="338.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">55d4</text> +<text x="156.0 171.0 186.0 201.0" y="338.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">a2e5</text> +<text x="224.0 239.0 254.0 269.0" y="338.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">f000</text> +<rect x="308.0" y="314.0" width="26.0" height="30.0" fill="#16245f"/> +<text x="313.5" y="338.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">r</text> +<rect x="338.0" y="314.0" width="26.0" height="30.0" fill="#16245f"/> +<text x="343.5" y="338.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">w</text> +<rect x="378.0" y="326.0" width="6.0" height="6.0" fill="#3a4a8a"/> +<text x="414.0 429.0 444.0 459.0" y="338.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">heap</text> +<text x="584.0 599.0 614.0 629.0" y="338.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">132K</text> +<rect x="668.0" y="318.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="692.0" y="318.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="717.0" y="319.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="741.0" y="319.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="765.0" y="319.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="789.0" y="319.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="813.0" y="319.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="837.0" y="319.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="861.0" y="319.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="885.0" y="319.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="909.0" y="319.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="933.0" y="319.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="957.0" y="319.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="981.0" y="319.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1005.0" y="319.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1029.0" y="319.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1062.0" y="326.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1074.0" y="326.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1086.0" y="326.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="88.0 103.0 118.0 133.0" y="380.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">7f3c</text> +<text x="156.0 171.0 186.0 201.0" y="380.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">5e20</text> +<text x="224.0 239.0 254.0 269.0" y="380.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">0000</text> +<rect x="308.0" y="356.0" width="26.0" height="30.0" fill="#16245f"/> +<text x="313.5" y="380.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">r</text> +<rect x="348.0" y="368.0" width="6.0" height="6.0" fill="#3a4a8a"/> +<rect x="368.0" y="356.0" width="26.0" height="30.0" fill="#16245f"/> +<text x="373.5" y="380.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">x</text> +<text x="414.0 429.0 444.0 459.0 474.0 489.0 504.0 519.0 534.0" y="380.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">libc.so.6</text> +<text x="584.0 599.0 614.0 629.0" y="380.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">2.1M</text> +<rect x="668.0" y="360.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="692.0" y="360.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="717.0" y="361.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="740.0" y="360.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="765.0" y="361.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="789.0" y="361.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="812.0" y="360.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="836.0" y="360.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="860.0" y="360.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="885.0" y="361.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="908.0" y="360.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="933.0" y="361.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="957.0" y="361.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="981.0" y="361.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1005.0" y="361.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1028.0" y="360.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="1062.0" y="368.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1074.0" y="368.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1086.0" y="368.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="88.0 103.0 118.0 133.0" y="422.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">7f3c</text> +<text x="156.0 171.0 186.0 201.0" y="422.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">5e5c</text> +<text x="224.0 239.0 254.0 269.0" y="422.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">2000</text> +<rect x="308.0" y="398.0" width="26.0" height="30.0" fill="#16245f"/> +<text x="313.5" y="422.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">r</text> +<rect x="348.0" y="410.0" width="6.0" height="6.0" fill="#3a4a8a"/> +<rect x="368.0" y="398.0" width="26.0" height="30.0" fill="#16245f"/> +<text x="373.5" y="422.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">x</text> +<text x="414.0 429.0 444.0 459.0 474.0" y="422.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">ld.so</text> +<text x="584.0 599.0 614.0 629.0" y="422.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">216K</text> +<rect x="668.0" y="402.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="692.0" y="402.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="716.0" y="402.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="741.0" y="403.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="764.0" y="402.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="788.0" y="402.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="813.0" y="403.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="836.0" y="402.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="861.0" y="403.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="885.0" y="403.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="908.0" y="402.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="933.0" y="403.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="956.0" y="402.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="980.0" y="402.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="1004.0" y="402.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="1028.0" y="402.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="1062.0" y="410.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1074.0" y="410.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1086.0" y="410.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="88.0 103.0 118.0 133.0" y="464.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">7ffd</text> +<text x="156.0 171.0 186.0 201.0" y="464.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">3a2a</text> +<text x="224.0 239.0 254.0 269.0" y="464.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">2000</text> +<rect x="308.0" y="440.0" width="26.0" height="30.0" fill="#16245f"/> +<text x="313.5" y="464.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">r</text> +<rect x="338.0" y="440.0" width="26.0" height="30.0" fill="#16245f"/> +<text x="343.5" y="464.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">w</text> +<rect x="378.0" y="452.0" width="6.0" height="6.0" fill="#3a4a8a"/> +<text x="414.0 429.0 444.0 459.0 474.0" y="464.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">stack</text> +<text x="584.0 599.0 614.0 629.0" y="464.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">132K</text> +<rect x="713.0" y="445.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="737.0" y="445.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="761.0" y="445.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="785.0" y="445.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="809.0" y="445.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="833.0" y="445.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="857.0" y="445.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="881.0" y="445.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="905.0" y="445.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="929.0" y="445.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="953.0" y="445.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="977.0" y="445.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1001.0" y="445.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1024.0" y="444.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="1048.0" y="444.0" width="22.0" height="22.0" fill="#ff6a4a"/> +<rect x="1072.0" y="444.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="668.0" y="452.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="680.0" y="452.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="692.0" y="452.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="88.0 103.0 118.0 133.0" y="506.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">7ffd</text> +<text x="156.0 171.0 186.0 201.0" y="506.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">3a3d</text> +<text x="224.0 239.0 254.0 269.0" y="506.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1000</text> +<rect x="308.0" y="482.0" width="26.0" height="30.0" fill="#16245f"/> +<text x="313.5" y="506.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">r</text> +<rect x="348.0" y="494.0" width="6.0" height="6.0" fill="#3a4a8a"/> +<rect x="368.0" y="482.0" width="26.0" height="30.0" fill="#16245f"/> +<text x="373.5" y="506.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">x</text> +<text x="414.0 429.0 444.0 459.0" y="506.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">vdso</text> +<text x="614.0 629.0" y="506.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">8K</text> +<rect x="668.0" y="486.0" width="22.0" height="22.0" fill="#3a4a8a"/> +<rect x="693.0" y="487.0" width="20.0" height="20.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<rect x="66.0" y="530.0" width="1180.0" height="68.0" fill="#eee6d2"/> +<text x="88.0 103.0 118.0 133.0 148.0 163.0 178.0 193.0 208.0 223.0 238.0 253.0 268.0 283.0" y="574.0" font-family="Go Mono" font-size="25" fill="#0a1030" xml:space="preserve">ffff 8000 0000</text> +<text x="414.0" y="575.1" font-family="Go Medium" font-size="28" fill="#0a1030" xml:space="preserve">kernel</text> +<text x="544.0" y="573.6" font-family="Go" font-size="24" fill="#4a5488" xml:space="preserve">the upper half of every address space</text> +<rect x="1280.0" y="120.0" width="576.0" height="48.0" fill="#16245f"/> +<rect x="1281.0" y="121.0" width="574.0" height="478.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="1280.0" y1="168.0" x2="1856.0" y2="168.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="1295.0" y="135.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="1328.0" y="154.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">one page of the stack</text> +<text x="1840.0" y="152.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">4096 bytes</text> +<rect x="1456.0" y="195.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1470.0" y="195.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1484.0" y="195.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="1512.0" y="206.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve">3640 bytes above</text> +<text x="1300.0 1315.0 1330.0 1345.0" y="258.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">3a2c</text> +<text x="1368.0 1383.0 1398.0 1413.0" y="258.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1e38</text> +<rect x="1468.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1484.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1516.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1532.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1564.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1580.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1612.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1628.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1660.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1676.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1708.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1724.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1756.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1772.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1804.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1820.0" y="246.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="1300.0 1315.0 1330.0 1345.0" y="318.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">3a2c</text> +<text x="1368.0 1383.0 1398.0 1413.0" y="318.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1e40</text> +<rect x="1456.0" y="286.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1461.0 1479.0" y="319.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">48</text> +<rect x="1504.0" y="286.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1509.0 1527.0" y="319.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">65</text> +<rect x="1552.0" y="286.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1557.0 1575.0" y="319.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">6c</text> +<rect x="1600.0" y="286.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1605.0 1623.0" y="319.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">6c</text> +<rect x="1648.0" y="286.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1653.0 1671.0" y="319.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">6f</text> +<rect x="1696.0" y="286.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1701.0 1719.0" y="319.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">2c</text> +<rect x="1744.0" y="286.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1749.0 1767.0" y="319.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">20</text> +<rect x="1792.0" y="286.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1797.0 1815.0" y="319.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">77</text> +<text x="1300.0 1315.0 1330.0 1345.0" y="378.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">3a2c</text> +<text x="1368.0 1383.0 1398.0 1413.0" y="378.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1e48</text> +<rect x="1456.0" y="346.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1461.0 1479.0" y="379.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">6f</text> +<rect x="1504.0" y="346.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1509.0 1527.0" y="379.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">72</text> +<rect x="1552.0" y="346.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1557.0 1575.0" y="379.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">6c</text> +<rect x="1600.0" y="346.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1605.0 1623.0" y="379.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">64</text> +<rect x="1648.0" y="346.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1653.0 1671.0" y="379.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">21</text> +<rect x="1696.0" y="346.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1701.0 1719.0" y="379.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">0a</text> +<rect x="1744.0" y="346.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1749.0 1767.0" y="379.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">00</text> +<rect x="1792.0" y="346.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1797.0 1815.0" y="379.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">00</text> +<text x="1300.0 1315.0 1330.0 1345.0" y="438.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">3a2c</text> +<text x="1368.0 1383.0 1398.0 1413.0" y="438.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1e50</text> +<rect x="1456.0" y="406.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1461.0 1479.0" y="439.8" font-family="Go Mono" font-size="30" fill="#6a7ab8" xml:space="preserve">00</text> +<rect x="1504.0" y="406.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1509.0 1527.0" y="439.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">3f</text> +<rect x="1552.0" y="406.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1557.0 1575.0" y="439.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">9a</text> +<rect x="1600.0" y="406.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1605.0 1623.0" y="439.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">c1</text> +<rect x="1648.0" y="406.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1653.0 1671.0" y="439.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">77</text> +<rect x="1696.0" y="406.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1701.0 1719.0" y="439.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">d2</text> +<rect x="1744.0" y="406.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1749.0 1767.0" y="439.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">8e</text> +<rect x="1792.0" y="406.0" width="46.0" height="46.0" fill="#16245f"/> +<text x="1797.0 1815.0" y="439.8" font-family="Go Mono" font-size="30" fill="#eee6d2" xml:space="preserve">5b</text> +<text x="1300.0 1315.0 1330.0 1345.0" y="498.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">3a2c</text> +<text x="1368.0 1383.0 1398.0 1413.0" y="498.0" font-family="Go Mono" font-size="25" fill="#eee6d2" xml:space="preserve">1e58</text> +<rect x="1456.0" y="466.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1461.0 1479.0" y="499.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">40</text> +<rect x="1504.0" y="466.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1509.0 1527.0" y="499.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">1e</text> +<rect x="1552.0" y="466.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1557.0 1575.0" y="499.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">2c</text> +<rect x="1600.0" y="466.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1605.0 1623.0" y="499.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">3a</text> +<rect x="1648.0" y="466.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1653.0 1671.0" y="499.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">fd</text> +<rect x="1696.0" y="466.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1701.0 1719.0" y="499.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">7f</text> +<rect x="1744.0" y="466.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1749.0 1767.0" y="499.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">00</text> +<rect x="1792.0" y="466.0" width="46.0" height="46.0" fill="#ff6a4a"/> +<text x="1797.0 1815.0" y="499.8" font-family="Go Mono" font-size="30" fill="#050a24" xml:space="preserve" font-weight="bold">00</text> +<rect x="1456.0" y="537.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1470.0" y="537.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<rect x="1484.0" y="537.0" width="6.0" height="6.0" fill="#6a7ab8"/> +<text x="1512.0" y="548.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve">416 below</text> +<rect x="1044.5" y="440.5" width="29.0" height="29.0" fill="none" stroke="#fff8e8" stroke-width="3"/> +<path d="M1075,439 L1280,120 M1075,471 L1280,600" fill="none" stroke="#3a4a8a" stroke-width="2" stroke-linejoin="round" stroke-linecap="butt"/> +<rect x="64.0" y="624.0" width="1792.0" height="48.0" fill="#16245f"/> +<rect x="65.0" y="625.0" width="1790.0" height="262.0" fill="none" stroke="#3a4a8a" stroke-width="2"/> +<line x1="64.0" y1="672.0" x2="1856.0" y2="672.0" stroke="#3a4a8a" stroke-width="2"/> +<rect x="79.0" y="639.0" width="18.0" height="18.0" fill="none" stroke="#6a7ab8" stroke-width="2"/> +<text x="112.0" y="658.0" font-family="Go Medium" font-size="28" fill="#9aa6d9" xml:space="preserve">system calls</text> +<text x="1840.0" y="656.0" font-family="Go" font-size="22" fill="#6a7ab8" xml:space="preserve" text-anchor="end">time runs right · width is time spent in the kernel</text> +<line x1="66.0" y1="750.0" x2="1854.0" y2="750.0" stroke="#eee6d2" stroke-width="3"/> +<text x="88.0" y="736.0" font-family="Go Medium" font-size="22" fill="#9aa6d9" xml:space="preserve">user</text> +<text x="88.0" y="780.0" font-family="Go Medium" font-size="22" fill="#9aa6d9" xml:space="preserve">kernel</text> +<rect x="234.0" y="752.0" width="150.0" height="44.0" fill="#eee6d2"/> +<text x="264.0 279.0 294.0 309.0 324.0 339.0" y="830.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">execve</text> +<rect x="410.0" y="752.0" width="18.0" height="44.0" fill="#eee6d2"/> +<rect x="450.0" y="752.0" width="26.0" height="44.0" fill="#eee6d2"/> +<rect x="506.0" y="752.0" width="64.0" height="44.0" fill="#eee6d2"/> +<text x="493.0 508.0 523.0 538.0 553.0 568.0" y="830.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">openat</text> +<rect x="594.0" y="752.0" width="40.0" height="44.0" fill="#eee6d2"/> +<rect x="654.0" y="752.0" width="30.0" height="44.0" fill="#eee6d2"/> +<rect x="706.0" y="752.0" width="22.0" height="44.0" fill="#eee6d2"/> +<rect x="754.0" y="752.0" width="16.0" height="44.0" fill="#eee6d2"/> +<rect x="804.0" y="752.0" width="70.0" height="44.0" fill="#eee6d2"/> +<text x="779.0 794.0 809.0 824.0 839.0 854.0 869.0 884.0" y="830.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">mprotect</text> +<rect x="896.0" y="752.0" width="22.0" height="44.0" fill="#eee6d2"/> +<rect x="946.0" y="752.0" width="16.0" height="44.0" fill="#eee6d2"/> +<rect x="1102.0" y="752.0" width="44.0" height="44.0" fill="#eee6d2"/> +<rect x="1296.0" y="752.0" width="110.0" height="44.0" fill="#eee6d2"/> +<rect x="1301.5" y="808.0" width="99.0" height="40.0" fill="#e8c46a"/> +<text x="1313.5 1328.5 1343.5 1358.5 1373.5" y="837.0" font-family="Go Mono" font-size="25" fill="#050a24" xml:space="preserve" font-weight="bold">write</text> +<rect x="1467.0" y="753.0" width="118.0" height="42.0" fill="none" stroke="#9aa6d9" stroke-width="2"/> +<text x="1451.0 1466.0 1481.0 1496.0 1511.0 1526.0 1541.0 1556.0 1571.0 1586.0" y="830.0" font-family="Go Mono" font-size="25" fill="#6a7ab8" xml:space="preserve">exit_group</text> +<path d="M384,722 v-10 H1156 v10" fill="none" stroke="#6a7ab8" stroke-width="3" stroke-linejoin="miter" stroke-linecap="butt"/> +<text x="770.0" y="700.0" font-family="Go" font-size="24" fill="#9aa6d9" xml:space="preserve" text-anchor="middle">the dynamic loader</text> +<path d="M1176,722 v-10 H1796 v10" fill="none" stroke="#6a7ab8" stroke-width="3" stroke-linejoin="miter" stroke-linecap="butt"/> +<text x="1456.0 1471.0 1486.0 1501.0" y="700.0" font-family="Go Mono" font-size="25" fill="#9aa6d9" xml:space="preserve">main</text> +<line x1="1356.5" y1="680.0" x2="1356.5" y2="804.0" stroke="#e8c46a" stroke-width="4"/> +<text x="64.0" y="964.0" font-size="40" xml:space="preserve"><tspan font-family="Go" font-weight="normal" fill="#eee6d2">Before </tspan><tspan font-family="Go Mono" font-weight="normal" fill="#eee6d2" font-size="35">main</tspan><tspan font-family="Go" font-weight="normal" fill="#eee6d2"> runs a single line, the loader has already</tspan></text> +<text x="64.0" y="1018.0" font-size="40" xml:space="preserve"><tspan font-family="Go" font-weight="normal" fill="#eee6d2">asked the kernel for memory a dozen times.</tspan></text> +</svg> diff --git a/design/mock/gen.py b/design/mock/gen.py new file mode 100644 index 0000000..6a9733e --- /dev/null +++ b/design/mock/gen.py @@ -0,0 +1,1304 @@ +#!/usr/bin/env python3 +"""Mock frames for the canim design system (see ../README.md). + + python3 gen.py [n ...] # writes NN-name.svg next to this file + for f in 0?-*.svg; do resvg $f ${f%.svg}.png; resvg -w 480 $f ${f%.svg}-480.png; done + +The numbers here mirror src/anim/theme.zig; that file is the truth. +Needs the Go fonts (ttf-go) where resvg can find them; fontTools is optional. +""" +import math +import os + +W, H = 1920, 1080 +HERE = os.path.dirname(os.path.abspath(__file__)) + +# ---- tokens (mirror of theme.zig) ----------------------------------------- +PAGE, RAISED, RULE = "#0a1030", "#16245f", "#3a4a8a" +VELLUM, BRIGHT, DIM, FAINT = "#eee6d2", "#fff8e8", "#9aa6d9", "#6a7ab8" +INK = "#050a24" # letters on a bright fill +GOLD, VERM, READ, PTR, ALLOC = "#e8c46a", "#ff6a4a", "#6fd6e6", "#d59cf5", "#7fdc9a" +# An accent's ember: its hold state. Chosen, not alpha-blended: gold over lapis blends to grey. +EMBER = {GOLD: "#4a3d1c", VERM: "#5a2218", READ: "#1c4652", PTR: "#45305a", ALLOC: "#1f4a33"} +TRAIL = ["#ae9350", "#746235", "#463b20"] # gold, cooling: newest first +KERNEL, KERNEL_RULE, KERNEL_DIM, KERNEL_HELD = "#eee6d2", "#b9ad8e", "#4a5488", "#f3b9a0" +KW, LIT, COMMENT = "#c0dcff", "#c8f0d8", "#9aa6d9" +OCHRE, TEAL = "#8a5e0c", "#17707c" # the first two pigments: identity + +MX, MY = 64, 48 # margins +COL, GUT, VGAP = 120, 32, 24 +HEAD_Y, HEAD_H = 48, 48 +STAGE_Y, STAGE_H = 120, 768 +CAP_Y, CAP_H = 912, 120 +TAG_H = 48 +CELL = 48 # byte cell pitch; drawn 46 +ROW = 60 # memory row pitch +LH = 48 # code line, register row +ADV = 0.6 # Go Mono advance, em +SM, DATA, VAL, HERO = 25, 30, 35, 60 # mono sizes: multiples of 5, so an advance is whole units + + +def colx(i): + return MX + i * (COL + GUT) + + +def span(n): + return n * COL + (n - 1) * GUT + + +def mix(fg, bg, a): + f, b = fg.lstrip("#"), bg.lstrip("#") + return "#" + "".join("%02x" % round(int(f[i:i + 2], 16) * a + int(b[i:i + 2], 16) * (1 - a)) for i in (0, 2, 4)) + + +def esc(s): + return s.replace("&", "&").replace("<", "<").replace(">", ">") + + +FONTS = { + "mono": ("Go Mono", "normal", "normal"), + "monob": ("Go Mono", "bold", "normal"), + "monoi": ("Go Mono", "normal", "italic"), + "sans": ("Go", "normal", "normal"), + "sansm": ("Go Medium", "normal", "normal"), + "sansb": ("Go", "bold", "normal"), +} + + +def mw(s, size): + return len(s) * round(ADV * size) + + +try: + from fontTools.ttLib import TTFont + _F = {} + + def tw(s, size, font="sans"): + """Width of proportional text, from the font's own metrics.""" + if font.startswith("mono"): + return mw(s, size) + name = {"sans": "Go-Regular", "sansm": "Go-Medium", "sansb": "Go-Bold"}[font] + if name not in _F: + f = TTFont(f"/usr/share/fonts/go/{name}.ttf") + _F[name] = (f.getBestCmap(), f["hmtx"], f["head"].unitsPerEm) + cmap, hmtx, upm = _F[name] + return sum(hmtx[cmap.get(ord(c), cmap[ord("n")])][0] for c in s) * size / upm +except ImportError: + def tw(s, size, font="sans"): + return mw(s, size) if font.startswith("mono") else len(s) * size * 0.52 + + +class Svg: + def __init__(self): + self.o = [f'<svg xmlns="http://www.w3.org/2000/svg" width="{W}" height="{H}" viewBox="0 0 {W} {H}">', + # Freed: a coarse hatch (5 wide on a 20 pitch; anything finer is mush at 480p). + '<defs><pattern id="hatch" width="20" height="20" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">' + f'<rect width="5" height="20" fill="{RULE}"/></pattern>' + '<pattern id="hazard" width="24" height="24" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">' + f'<rect width="24" height="24" fill="{INK}"/><rect width="12" height="24" fill="{VERM}"/></pattern></defs>', + f'<rect width="{W}" height="{H}" fill="{PAGE}"/>'] + + def rect(self, x, y, w, h, fill="none", stroke=None, sw=2, dash=None): + a = f'<rect x="{x:.1f}" y="{y:.1f}" width="{w:.1f}" height="{h:.1f}" fill="{fill}"' + if stroke: + a += f' stroke="{stroke}" stroke-width="{sw}"' + if dash: + a += f' stroke-dasharray="{dash}"' + self.o.append(a + "/>") + + def frame(self, x, y, w, h, stroke, sw=2, dash=None): + """A stroke drawn wholly inside the rect.""" + self.rect(x + sw / 2, y + sw / 2, w - sw, h - sw, "none", stroke, sw, dash) + + def line(self, x1, y1, x2, y2, stroke=RULE, sw=2): + self.o.append(f'<line x1="{x1:.1f}" y1="{y1:.1f}" x2="{x2:.1f}" y2="{y2:.1f}" stroke="{stroke}" stroke-width="{sw}"/>') + + def path(self, d, stroke=None, sw=3, fill="none", dash=None, join="round", cap="butt"): + a = f'<path d="{d}" fill="{fill}"' + if stroke: + a += f' stroke="{stroke}" stroke-width="{sw}" stroke-linejoin="{join}" stroke-linecap="{cap}"' + if dash: + a += f' stroke-dasharray="{dash}"' + self.o.append(a + "/>") + + def circle(self, cx, cy, r, fill="none", stroke=None, sw=3): + a = f'<circle cx="{cx:.1f}" cy="{cy:.1f}" r="{r}" fill="{fill}"' + if stroke: + a += f' stroke="{stroke}" stroke-width="{sw}"' + self.o.append(a + "/>") + + def t(self, x, y, s, size=DATA, fill=VELLUM, font="mono", anchor="start"): + """One run of text; y is the baseline. Mono is laid a character at a time on its + whole-unit advance, as the renderer does.""" + fam, wt, st = FONTS[font] + a = f' font-family="{fam}" font-size="{size}" fill="{fill}" xml:space="preserve"' + if wt != "normal": + a += f' font-weight="{wt}"' + if st != "normal": + a += f' font-style="{st}"' + if font.startswith("mono"): + adv = round(ADV * size) + if anchor == "middle": + x -= len(s) * adv / 2 + elif anchor == "end": + x -= len(s) * adv + xs = " ".join(f"{x + i * adv:.1f}" for i in range(len(s))) + self.o.append(f'<text x="{xs}" y="{y:.1f}"{a}>{esc(s)}</text>') + return + if anchor != "start": + a += f' text-anchor="{anchor}"' + self.o.append(f'<text x="{x:.1f}" y="{y:.1f}"{a}>{esc(s)}</text>') + + def tc(self, x, y, w, h, s, size=DATA, fill=VELLUM, font="mono"): + """Text centred in a box, on its cap height.""" + self.t(x + w / 2, y + h / 2 + 0.36 * size, s, size, fill, font, "middle") + + def rich(self, x, y, parts, size=40): + """Proportional text with inline mono runs: [(text, fill[, font])], one <text> so it flows.""" + a = f'<text x="{x:.1f}" y="{y:.1f}" font-size="{size}" xml:space="preserve">' + for p in parts: + fam, wt, st = FONTS[p[2] if len(p) > 2 else "sans"] + sz = f' font-size="{round(size * 0.875)}"' if fam == "Go Mono" else "" + a += f'<tspan font-family="{fam}" font-weight="{wt}" fill="{p[1]}"{sz}>{esc(p[0])}</tspan>' + self.o.append(a + "</text>") + + def save(self, name): + self.o.append("</svg>") + open(os.path.join(HERE, name + ".svg"), "w").write("\n".join(self.o) + "\n") + + +def base(y, h, size): + """Baseline that centres cap-height text of `size` in a box at y, h tall.""" + return y + h / 2 + 0.36 * size + + +# ---- lines ---------------------------------------------------------------- +def head_tri(g, x2, y2, ux, uy, color, hl, hw): + bx, by = x2 - ux * hl, y2 - uy * hl + nx, ny = -uy * hw / 2, ux * hw / 2 + g.path(f"M{x2:.1f},{y2:.1f} L{bx + nx:.1f},{by + ny:.1f} L{bx - nx:.1f},{by - ny:.1f} Z", fill=color) + + +def arrow(g, pts, color=PTR, sw=4, r=12, head=True, dash=None, hl=18, hw=16): + """A polyline with filleted elbows and a filled head on its last point.""" + pts = [tuple(map(float, p)) for p in pts] + (x1, y1), (x2, y2) = pts[-2], pts[-1] + L = math.hypot(x2 - x1, y2 - y1) + ux, uy = (x2 - x1) / L, (y2 - y1) / L + q = pts[:-1] + [(x2 - ux * (hl - 2), y2 - uy * (hl - 2)) if head else (x2, y2)] + d = f"M{q[0][0]:.1f},{q[0][1]:.1f}" + for i in range(1, len(q) - 1): + (ax, ay), (bx, by), (cx, cy) = q[i - 1], q[i], q[i + 1] + la, lb = math.hypot(bx - ax, by - ay), math.hypot(cx - bx, cy - by) + rr = min(r, la / 2, lb / 2) + d += (f" L{bx - (bx - ax) / la * rr:.1f},{by - (by - ay) / la * rr:.1f}" + f" Q{bx:.1f},{by:.1f} {bx + (cx - bx) / lb * rr:.1f},{by + (cy - by) / lb * rr:.1f}") + d += f" L{q[-1][0]:.1f},{q[-1][1]:.1f}" + g.path(d, color, sw, dash=dash) + if head: + head_tri(g, x2, y2, ux, uy, color, hl, hw) + + +def flow(g, pts): + """A value in transit: bright, thinner than a pointer, gone a second after it lands.""" + arrow(g, pts, VELLUM, 3, hl=16, hw=14) + + +def wedge(g, x, y0, y1, X, Y0, Y1): + """This, magnified: two rules from a thing's corners to its enlargement's.""" + g.path(f"M{x},{y0} L{X},{Y0} M{x},{y1} L{X},{Y1}", RULE, 2) + + +def wedge_down(g, x0, x1, y, X0, X1, Y): + g.path(f"M{x0},{y} L{X0},{Y} M{x1},{y} L{X1},{Y}", RULE, 2) + + +# ---- frame furniture ------------------------------------------------------ +def panel(g, x, y, w, h, title, focus=False, right=None): + """An acme window: a tag with its box, a rule round the body. Returns the body rect.""" + g.rect(x, y, w, TAG_H, RAISED) + g.frame(x, y, w, h, DIM if focus else RULE, 2) + g.line(x, y + TAG_H, x + w, y + TAG_H, DIM if focus else RULE, 2) + if focus: + g.rect(x + 14, y + 14, 20, 20, GOLD) + else: + g.frame(x + 14, y + 14, 20, 20, FAINT, 2) + g.t(x + 48, y + 34, title, 28, VELLUM if focus else DIM, "sansm") + if right: + g.t(x + w - 16, y + 32, right, 22, FAINT, "sans", "end") + return x, y + TAG_H, w, h - TAG_H + + +LEVELS = ["source", "cpu", "memory", "kernel"] + + +def head(g, title, lit=(), focus=None, where=None): + """Running head: what the video is on, where the program is, and the level rail.""" + g.t(MX, HEAD_Y + 33, title, 28, DIM, "sansm") + if where: + g.t(MX + tw(title, 28, "sansm") + 36, HEAD_Y + 33, where, SM, FAINT, "mono") + x = W - MX + for name in reversed(LEVELS): + on, cur = name in lit, name == focus + x -= tw(name, 22, "sansm") + 2 + g.t(x, HEAD_Y + 32, name, 22, VELLUM if cur else (DIM if on else FAINT), "sansm") + x -= 24 + if cur: + g.rect(x, HEAD_Y + 17, 16, 16, GOLD) + elif on: + g.rect(x, HEAD_Y + 17, 16, 16, DIM) + else: + g.frame(x, HEAD_Y + 17, 16, 16, RULE, 2) + x -= 36 + g.line(MX, HEAD_Y + HEAD_H + 8, W - MX, HEAD_Y + HEAD_H + 8, RULE, 2) + + +def caption(g, lines, ink=VELLUM): + """One or two lines, ranged left on the margin. Each line: [(text[, font])].""" + y = CAP_Y + (52 if len(lines) == 2 else 78) + for parts in lines: + g.rich(MX, y, [(p[0], ink) + tuple(p[1:]) for p in parts], 40) + y += 54 + + +def plaque(g, x, y, s, size=SM, ink=VELLUM, fill=RAISED, stroke=None, h=40, pad=12, font="mono"): + w = tw(s, size, font) + 2 * pad + if fill != "none": + g.rect(x, y, w, h, fill) + if stroke: + g.frame(x, y, w, h, stroke, 2) + g.t(x + pad, base(y, h, size), s, size, ink, font) + return w + + +def elide(g, x, y, label="", h=24): + """Bytes (or lines) that are there and not shown: three squares and what they are.""" + for i in range(3): + g.rect(x + i * 14, y + h / 2 - 3, 6, 6, FAINT) + if label: + g.t(x + 56, y + h / 2 + 8, label, 22, FAINT, "sans") + + +# ---- numbers -------------------------------------------------------------- +def hexw(n, size=DATA): + adv = round(ADV * size) + return n * adv + (n // 4 - 1) * round(adv / 2) + + +def hexgroups(g, x, y, digits, size=DATA, lead=FAINT, fill=VELLUM, font="mono", right=False, all_fill=None): + """Hex in fours, half an advance apart; leading zeros in `lead`.""" + adv = round(ADV * size) + if right: + x -= hexw(len(digits), size) + nz = len(digits) - len(digits.lstrip("0")) + if nz == len(digits): + nz -= 1 + for i in range(0, len(digits), 4): + for k in range(i, min(i + 4, len(digits))): + g.t(x + (k - i) * adv, y, digits[k], size, all_fill or (lead if k < nz else fill), font) + x += 4 * adv + round(adv / 2) + + +def address(g, x, y, addr, h=CELL - 2, digits=12): + """An address gutter: only the end that changes row to row is in full ink. + digits=8 drops the top group where a panel is narrow (its tag names the region).""" + a = ("%012x" % addr)[12 - digits:] + n = digits // 4 + for i in range(n): + g.t(x + i * (4 * 15 + 8), base(y, h, SM), a[4 * i:4 * i + 4], SM, VELLUM if i == n - 1 else FAINT, "mono") + + +# ---- cells ---------------------------------------------------------------- +def space_glyph(g, cx, by, color=VELLUM): + """A visible space: Go Mono has no U+2423, and a drawn one is the same everywhere.""" + g.path(f"M{cx - 8},{by - 8} v8 h16 v-8", color, 3, join="miter") + + +def byte(g, x, y, v, state="plain"): + """One byte at pitch CELL. v: two hex digits, or None for never observed.""" + w = CELL - 2 + if v is None: + g.rect(x + 12, y + 20, 6, 6, FAINT) + g.rect(x + 28, y + 20, 6, 6, FAINT) + return + fill, ink, font = RAISED, VELLUM, "mono" + if v == "00" and state == "plain": + ink = FAINT + if state == "write": + fill, ink, font = VERM, INK, "monob" + elif state == "held": + fill = EMBER[VERM] + elif state == "read": + fill = EMBER[READ] + g.rect(x, y, w, w, fill) + if state == "held": + g.rect(x, y + w - 6, w, 6, VERM) + if state == "read": + g.frame(x, y, w, w, READ, 3) + g.tc(x, y, w, w, v, DATA, ink, font) + + +def word(g, x, y, digits, state="plain", nbytes=8): + """Bytes read as one number, on the footprint of the byte cells it is made of.""" + w, h = nbytes * CELL - 2, CELL - 2 + fill, all_fill, font = RAISED, None, "mono" + if state == "write": + fill, all_fill, font = VERM, INK, "monob" + elif state == "held": + fill = EMBER[VERM] + elif state == "read": + fill = EMBER[READ] + g.rect(x, y, w, h, fill) + if state == "held": + g.rect(x, y + h - 6, w, 6, VERM) + if state == "read": + g.frame(x, y, w, h, READ, 3) + hexgroups(g, x + (w - hexw(len(digits))) / 2, base(y, h, DATA), digits, all_fill=all_fill, font=font) + return w + + +def ptr_frame(g, x, y, nbytes=8): + """These bytes are one pointer.""" + g.frame(x - 6, y - 6, nbytes * CELL - 2 + 12, CELL - 2 + 12, PTR, 4) + + +def regmark(g, xr, y, name, fill=RAISED, rows=1): + """A register or pointer variable holding this row's address: left of the gutter, pointing in. + With a pigment, a spine runs down the rows of its object.""" + w = mw(name, SM) + 20 + x = xr - w - 16 + g.rect(x, y + 3, w, 40, fill) + if fill == RAISED: + g.frame(x, y + 3, w, 40, PTR, 2) + g.t(x + 10, base(y, CELL - 2, SM), name, SM, VELLUM, "mono") + if fill == RAISED: + g.path(f"M{xr},{y + 23} l-14,-9 v18 Z", fill=PTR) + else: + g.rect(xr - 12, y, 6, (rows - 1) * ROW + CELL - 2, fill) + + +# ---- components ----------------------------------------------------------- +def code(g, x, y, w, lines, cur=None, trail=(), unfold=None): + """Source lines: (number, [(text, class)]) with class in none|kw|lit|com. + cur: the current line. trail: recently executed, newest first. + unfold: (line, [(mnemonic, operands)], current instruction). Returns {line: baseline}.""" + ink = {"none": VELLUM, "kw": KW, "lit": LIT, "com": COMMENT} + fnt = {"none": "mono", "kw": "monob", "lit": "mono", "com": "monoi"} + gut = 3 * 18 + 16 + ys = {} + for num, parts in lines: + b = base(y, LH, DATA) + ys[num] = b + if num == cur: + g.rect(x, y + 2, w, LH - 4, EMBER[GOLD]) + g.rect(x, y + 2, gut + 4, LH - 4, GOLD) + g.t(x + gut - 6, b, str(num), DATA, INK, "monob", "end") + else: + if num in trail: + g.rect(x, y + 2, 6, LH - 4, TRAIL[min(trail.index(num), 2)]) + g.t(x + gut - 6, b, str(num), DATA, FAINT, "mono", "end") + xx = x + gut + 20 + for s, cls in parts: + if s.strip(): + g.t(xx + (len(s) - len(s.lstrip())) * 18, b, s.lstrip(), DATA, ink[cls], fnt[cls]) + xx += mw(s, DATA) + y += LH + if unfold and unfold[0] == num: + ax = x + gut + 20 + 36 + g.line(ax - 18, y + 2, ax - 18, y + len(unfold[1]) * LH - 2, RULE, 2) + for i, (op, args) in enumerate(unfold[1]): + b2 = base(y, LH, DATA) + on = i == unfold[2] + if on: + g.rect(ax - 22, y + 3, w - (ax - 22 - x), LH - 6, EMBER[GOLD]) + g.rect(ax - 22, y + 3, 8, LH - 6, GOLD) + g.t(ax, b2, op, DATA, VELLUM if on else DIM, "monob" if on else "mono") + if args: + g.t(ax + 5 * 18, b2, args, DATA, VELLUM if on else DIM, "mono") + ys[("asm", i)] = b2 + y += LH + return ys + + +def regs(g, x, y, w, rows, flags=None): + """rows: (name, 16 hex digits, state) with state in plain|write|held|read|pc. + Returns {name: row top}.""" + out = {} + vx = x + w - 18 + vw = hexw(16) + for name, val, st in rows: + b = base(y, LH, DATA) + cell = (vx - vw - 10, y + 3, vw + 20, LH - 6) + if st == "pc": + g.rect(x, y + 3, w, LH - 6, EMBER[GOLD]) + g.rect(x, y + 3, 16 + 3 * 18 + 14, LH - 6, GOLD) + if st == "write": + g.rect(*cell, VERM) + hexgroups(g, vx, b, val, right=True, all_fill=INK, font="monob") + else: + if st == "held": + g.rect(*cell, EMBER[VERM]) + g.rect(cell[0], cell[1] + cell[3] - 6, cell[2], 6, VERM) + if st == "read": + g.rect(*cell, EMBER[READ]) + g.frame(*cell, READ, 3) + hexgroups(g, vx, b, val, right=True) + g.t(x + 18, b, name, DATA, INK if st == "pc" else DIM, "monob" if st == "pc" else "mono") + out[name] = y + y += LH + if flags: + y += 10 + fx = x + 18 + for name, on, changed in flags: + if on: + g.rect(fx, y, 60, 36, RAISED) + g.frame(fx, y, 60, 36, VELLUM, 3) + g.tc(fx, y, 60, 36, name, SM, BRIGHT, "monob") + else: + g.frame(fx, y, 60, 36, RULE, 2) + g.tc(fx, y, 60, 36, name, SM, FAINT, "mono") + if changed: + g.rect(fx, y + 40, 60, 6, VERM) + fx += 72 + return out + + +def cards(g, x, y, w, items, h=56, gap=12, on_kernel=False): + """A call stack, newest on top. items: (name, args, where, current).""" + ink, dim = (PAGE, KERNEL_DIM) if on_kernel else (VELLUM, DIM) + for name, args, where, cur in items: + if on_kernel: + if cur: + g.rect(x, y, w, h, GOLD) + g.frame(x, y, w, h, PAGE, 2) + else: + g.rect(x, y, w, h, EMBER[GOLD] if cur else RAISED) + g.rect(x, y, 12, h, GOLD if cur else RULE) + b = base(y, h, DATA) + g.t(x + 28, b, name, DATA, ink, "monob" if cur else "mono") + if args: + g.t(x + 28 + mw(name, DATA) + 18, b, args, DATA, ink if cur else dim, "mono") + if where: + g.t(x + w - 14, base(y, h, SM), where, SM, dim if cur or on_kernel else FAINT, "mono", "end") + y += h + gap + + +def node(g, x, y, value, state="plain", body=RAISED, null=False, w=180, h=72): + """A list node: [ value | next ]. Returns the point its pointer leaves from.""" + pw = 72 + g.rect(x, y, w - pw, h, body) + g.t(x + (w - pw) / 2, base(y, h, VAL), str(value), VAL, VELLUM, "mono", "middle") + nx = x + w - pw + g.rect(nx + 2, y, pw - 2, h, {"write": VERM, "held": EMBER[VERM]}.get(state, mix(body, PAGE, 0.55))) + if state == "held": + g.rect(nx + 2, y + h - 6, pw - 2, 6, VERM) + cx, cy = nx + pw / 2 + 1, y + h / 2 + if null: + g.path(f"M{nx + 16},{y + h - 14} L{nx + pw - 14},{y + 14}", DIM, 3) + else: + g.rect(cx - 7, cy - 7, 14, 14, INK if state == "write" else PTR) + return cx, cy + + +def chunk(g, x, y, w, h, kind, name=None, hdr=32, writes=(), name_x=None): + """A block of the heap, to scale. kind: used | free | avail | meta. + hdr: width of the allocator's own bytes at its start. writes: (offset, width) struck.""" + if kind == "used": + g.rect(x, y, w, h, EMBER[ALLOC]) + g.frame(x, y, w, h, ALLOC, 3) + elif kind == "free": + g.rect(x, y, w, h, "url(#hatch)") + g.frame(x, y, w, h, DIM, 3, dash="12 8") + elif kind == "avail": + g.frame(x, y, w, h, RULE, 2) + elif kind == "meta": + g.rect(x, y, w, h, RULE) + if hdr and kind in ("used", "free"): + g.rect(x + 3, y + 3, hdr - 3, h - 6, RULE) + for off, ww_ in writes: + g.rect(x + off, y + 3, ww_, h - 6, VERM) + if name: + nx = name_x if name_x is not None else (w + (hdr if kind in ("used", "free") else 0)) / 2 + if kind == "free": + g.rect(x + nx - 16, y + h / 2 - 22, 32, 44, PAGE) + g.t(x + nx, base(y, h, VAL), name, VAL, VELLUM, "mono", "middle") + + +K, N, L = "kw", "none", "lit" + + +# ---- frame 1: recursive fib, four views ----------------------------------- +def frame1(): + g = Svg() + head(g, "Recursion", lit=("source", "cpu"), focus="source", where="fib(5)") + + bx, by, bw, bh = panel(g, colx(0), STAGE_Y, span(5), STAGE_H, "fib.c", focus=True) + lines = [ + (1, [("#include", K), (" <stdio.h>", L)]), + (2, []), + (3, [("long", K), (" fib(", N), ("long", K), (" n) {", N)]), + (4, [(" ", N), ("if", K), (" (n < ", N), ("2", L), (")", N)]), + (5, [(" ", N), ("return", K), (" n;", N)]), + (6, [(" ", N), ("return", K), (" fib(n-", N), ("1", L), (") + fib(n-", N), ("2", L), (");", N)]), + (7, [("}", N)]), + (8, []), + (9, [("int", K), (" main(", N), ("void", K), (") {", N)]), + (10, [(" printf(", N), ('"%ld\\n"', L), (", fib(", N), ("5", L), ("));", N)]), + (11, [(" ", N), ("return", K), (" ", N), ("0", L), (";", N)]), + (12, [("}", N)]), + ] + code(g, bx + 2, by + 16, bw - 4, lines, cur=4, trail=(3, 6)) + # what the current frame sees, at the end of its line + plaque(g, bx + 2 + 70 + 20 + mw(" if (n < 2)", DATA) + 36, by + 16 + 3 * LH + 4, "n = 1", SM, VELLUM, "none", DIM) + + # the calls so far + tx, ty, tw_, th = panel(g, colx(5), STAGE_Y, span(7), 336, "calls of fib(n)", right="each result on its call's shoulder") + Y = [ty + 42, ty + 96, ty + 150, ty + 204, ty + 258] + nodes = [ # id, n, x, level, parent, state, result + ("r", 5, 1340, 0, None, "active", None), + ("a", 4, 1100, 1, "r", "done", 3), ("b", 3, 1600, 1, "r", "active", None), + ("aa", 3, 980, 2, "a", "done", 2), ("ab", 2, 1220, 2, "a", "done", 1), ("ba", 2, 1520, 2, "b", "active", None), + ("aaa", 2, 916, 3, "aa", "done", 1), ("aab", 1, 1044, 3, "aa", "done", 1), + ("aba", 1, 1176, 3, "ab", "done", 1), ("abb", 0, 1264, 3, "ab", "done", 0), + ("baa", 1, 1476, 3, "ba", "current", None), + ("aaaa", 1, 880, 4, "aaa", "done", 1), ("aaab", 0, 952, 4, "aaa", "done", 0), + ] + pos = {i: (x, Y[l]) for i, n, x, l, p, s, r in nodes} + for i, n, x, l, p, s, r in nodes: + if p: + live = s in ("active", "current") + g.line(*pos[p], x, Y[l], VELLUM if live else RULE, 4 if live else 3) + R = 24 + for i, n, x, l, p, s, r in nodes: + y = Y[l] + if s == "current": + g.circle(x, y, R, GOLD) + g.t(x, y + 0.36 * DATA, str(n), DATA, INK, "monob", "middle") + elif s == "active": + g.circle(x, y, R - 2, PAGE, VELLUM, 4) + g.t(x, y + 0.36 * DATA, str(n), DATA, VELLUM, "mono", "middle") + else: + g.circle(x, y, R, RAISED) + g.t(x, y + 0.36 * DATA, str(n), DATA, DIM, "mono", "middle") + g.rect(x + 14, y - 34, 28, 28, PAGE) + g.frame(x + 14, y - 34, 28, 28, FAINT, 2) + g.t(x + 28, y - 20 + 0.36 * SM, str(r), SM, VELLUM, "mono", "middle") + + # the stack of calls + sx, sy, sw, sh = panel(g, colx(5), STAGE_Y + 336 + VGAP, span(3), 408, "call stack", right="newest on top") + cards(g, sx + 14, sy + 16, sw - 28, [ + ("fib", "n = 1", ":4", True), + ("fib", "n = 2", ":6", False), + ("fib", "n = 3", ":6", False), + ("fib", "n = 5", ":6", False), + ("main", "", ":10", False), + ]) + + rx, ry, rw, rh = panel(g, colx(8), STAGE_Y + 336 + VGAP, span(4), 408, "registers", right="x86-64") + regs(g, rx + 2, ry + 14, rw - 4, [ + ("rip", "000055d4a1c01141", "pc"), + ("rax", "0000000000000001", "held"), + ("rdi", "0000000000000001", "write"), + ("rsp", "00007ffd3a2c1dc0", "held"), + ("rbp", "00007ffd3a2c1de0", "plain"), + ], flags=[("CF", False, False), ("ZF", False, True), ("SF", True, True), ("OF", False, False)]) + + caption(g, [[("Four calls to ",), ("fib", "mono"), (" are still waiting, each with its own ",), ("n", "mono"), (".",)], + [("The newest one just received ",), ("1", "mono"), (" in ",), ("rdi", "mono"), (".",)]]) + g.save("01-fib-recursion") + + +# ---- frame 2: linked-list insert, nodes above the heap that holds them ---- +def frame2(): + g = Svg() + head(g, "Linked lists", lit=("source", "memory"), focus="memory", where="insert after a node") + + bx, by, bw, bh = panel(g, colx(0), STAGE_Y, span(5), STAGE_H, "list.c") + code(g, bx + 2, by + 16, bw - 4, [ + (3, [("struct", K), (" node {", N)]), + (4, [(" ", N), ("long", K), (" value;", N)]), + (5, [(" ", N), ("struct", K), (" node *next;", N)]), + (6, [("};", N)]), + ]) + elide(g, bx + 2 + 70 + 20, by + 16 + 4 * LH + 8) + y2 = by + 16 + 4 * LH + 40 + code(g, bx + 2, y2, bw - 4, [ + (21, [("n = malloc(", N), ("sizeof", K), (" *n);", N)]), + (22, [("n->value = v;", N)]), + (23, [("n->next = at->next;", N)]), + (24, [("at->next = n;", N)]), + (25, [("return", K), (" n;", N)]), + ], cur=24, trail=(23, 22)) + # locals: what the names hold right now + ly = y2 + 5 * LH + 40 + g.line(bx + 20, ly - 20, bx + bw - 20, ly - 20, RULE, 2) + g.t(bx + 22, ly + 10, "locals", 22, FAINT, "sansm") + for i, (name, pig, val, note) in enumerate((("at", OCHRE, "000055d4a1c032a0", "node 7"), ("n", TEAL, "000055d4a1c032e0", "node 9"), ("v", None, None, "9"))): + y = ly + 28 + i * 52 + if pig: + g.rect(bx + 20, y, 12, 46, pig) + g.t(bx + 48, base(y, 46, DATA), name, DATA, VELLUM, "mono") + if val: + hexgroups(g, bx + 118, base(y, 46, DATA), val) + g.t(bx + 118 + hexw(16) + 24, base(y, 46, 28) - 1, note, 28, DIM, "sans") + else: + g.t(bx + 118, base(y, 46, DATA), note, DATA, VELLUM, "mono") + + # the list, as the program thinks of it + lx, ly_, lw, lh = panel(g, colx(5), STAGE_Y, span(7), 240, "the list", right="what the code means") + y0 = ly_ + 14 + xh = lx + 36 + hw_ = plaque(g, xh, y0 + 16, "head", SM, VELLUM, "none", DIM) + n7 = (lx + 196, y0) + n12 = (lx + 640, y0) + n9 = (lx + 418, y0 + 96) + arrow(g, [(xh + hw_, y0 + 36), (n7[0] - 4, y0 + 36)]) + p7 = node(g, *n7, 7, "write", OCHRE) + p12 = node(g, *n12, 12, null=True) + p9 = node(g, *n9, 9, "held", TEAL) + # the old link on its way out; the new link; the link made a step ago + arrow(g, [(p7[0] + 14, p7[1]), (n12[0] - 6, p7[1])], FAINT, 3, dash="12 8", head=False) + arrow(g, [(p7[0], p7[1] + 14), (p7[0], n9[1] + 36), (n9[0] - 4, n9[1] + 36)]) + arrow(g, [(p9[0] + 14, p9[1]), (n12[0] + 54, p9[1]), (n12[0] + 54, n12[1] + 72 + 4)]) + g.t(n7[0] + 2, y0 + 72 + 30, "at", SM, VELLUM, "mono") + g.t(n9[0] + 180 + 16, n9[1] + 66, "n", SM, VELLUM, "mono") + g.t(n12[0] + 180 + 24, base(n12[1], 72, 24), "the end", 24, DIM, "sans") + + # the heap that holds it + hx, hy, hw, hh = panel(g, colx(5), STAGE_Y + 240 + VGAP, span(7), 504, "heap", focus=True, right="eight bytes a row, as one number · low addresses on top") + gx = hx + 108 + cx = gx + hexw(12, SM) + 96 + fx = cx + 8 * CELL + 18 + rows = [ + ("e", "malloc's own 16 bytes"), + (0x55d4a1c032a0, "0000000000000007", "plain", "value", "= 7", OCHRE, "at"), + (0x55d4a1c032a8, "000055d4a1c032e0", "write", "next", None, OCHRE, None), + ("e", ""), + (0x55d4a1c032c0, "000000000000000c", "plain", "value", "= 12", None, None), + (0x55d4a1c032c8, "0000000000000000", "plain", "next", "= NULL", None, None), + ("e", ""), + (0x55d4a1c032e0, "0000000000000009", "plain", "value", "= 9", TEAL, "n"), + (0x55d4a1c032e8, "000055d4a1c032c0", "held", "next", None, TEAL, None), + ] + y = hy + 10 + ry = {} + for r in rows: + if r[0] == "e": + elide(g, cx, y, r[1], 22) + y += 24 + continue + addr, digits, st, field, meaning, pig, name = r + ry[addr] = y + address(g, gx, y, addr) + word(g, cx, y, digits, st) + g.t(fx, base(y, CELL - 2, SM), field, SM, VELLUM if st == "write" else DIM, "mono") + if meaning: + g.t(fx + 6 * 15, base(y, CELL - 2, SM), meaning, SM, DIM, "mono") + if name: + regmark(g, gx - 4, y, name, pig, rows=2) + y += ROW + + # pointers, in the lane left of the words; the longest outermost + def ptr(src, dst, lane, color=PTR, dash=None, sw=4, head=True): + ys_, yd = ry[src] + 23, ry[dst] + 23 + arrow(g, [(cx - 6, ys_), (cx - lane, ys_), (cx - lane, yd), (cx - 4, yd)], color, sw, dash=dash, head=head) + ptr(0x55d4a1c032a8, 0x55d4a1c032c0, 30, FAINT, "12 8", 3, False) + ptr(0x55d4a1c032e8, 0x55d4a1c032c0, 52) + ptr(0x55d4a1c032a8, 0x55d4a1c032e0, 74) + for a in (0x55d4a1c032a8, 0x55d4a1c032e8): + ptr_frame(g, cx, ry[a]) + + caption(g, [[("Inserting moves nothing. One word changes: the ",), ("next", "mono"), (" field of ",), ("at", "mono")], + [("now holds the address of the new node.",)]]) + g.save("02-list-insert") + + +# ---- frame 3: a write() crossing from user to kernel ---------------------- +def frame3(): + g = Svg() + UH = 408 + BY = STAGE_Y + UH + 48 # the boundary: 576 + g.rect(0, BY, W, H - BY, KERNEL) + head(g, "System calls", lit=("source", "cpu", "memory", "kernel"), focus="kernel", where="write(1, msg, 14)") + + bx, by, bw, bh = panel(g, colx(0), STAGE_Y, span(4), UH, "hello.c") + asm = [("mov", "eax, 1"), ("mov", "edi, 1"), ("lea", "rsi, [msg]"), ("mov", "edx, 14"), ("syscall", "")] + code(g, bx + 2, by + 12, bw - 4, [ + (11, [("write(", N), ("1", L), (", msg, ", N), ("14", L), (");", N)]), + (12, [("return", K), (" ", N), ("0", L), (";", N)]), + ], cur=11, unfold=(11, asm, 4)) + + rx, ry, rw, rh = panel(g, colx(4), STAGE_Y, span(4), UH, "registers", right="x86-64") + rr = regs(g, rx + 2, ry + 12, rw - 4, [ + ("rip", "000055d4a1c0115c", "pc"), + ("rax", "0000000000000001", "read"), + ("rdi", "0000000000000001", "read"), + ("rsi", "000055d4a1c02004", "read"), + ("rdx", "000000000000000e", "read"), + ]) + for name, role in (("rax", "which call"), ("rdi", "1st"), ("rsi", "2nd"), ("rdx", "3rd")): + g.t(rx + 2 + 18 + 3 * 18 + 20, rr[name] + 24 + 8, role, 22, DIM, "sans") + g.t(rx + 20, rr["rdx"] + LH + 44, "four registers, read by the kernel", 24, DIM, "sans") + + mx_, my_, mw_, mh_ = panel(g, colx(8), STAGE_Y, span(4), UH, "memory", right="read-only data") + gx = mx_ + 20 + cx = gx + hexw(8, SM) + 28 + text = [("H", "48"), ("e", "65"), ("l", "6c"), ("l", "6c"), ("o", "6f"), (",", "2c"), (" ", "20"), ("w", "77"), + ("o", "6f"), ("r", "72"), ("l", "6c"), ("d", "64"), ("!", "21"), ("\\n", "0a"), (None, "00"), (None, None)] + TH = 84 # a text cell: the character over its byte + for r in range(2): + y = my_ + 36 + r * 104 + address(g, gx, y, 0x55d4a1c02004 + 8 * r, h=TH, digits=8) + for j in range(8): + ch, hx_ = text[r * 8 + j] + x = cx + j * CELL + if hx_ is None: + g.rect(x + 12, y + 39, 6, 6, FAINT) + g.rect(x + 28, y + 39, 6, 6, FAINT) + continue + rd = ch is not None + g.rect(x, y, CELL - 2, TH, EMBER[READ] if rd else RAISED) + if ch == " ": + space_glyph(g, x + 23, y + 38) + elif rd: + g.t(x + 23, y + 38, ch, DATA, VELLUM, "mono", "middle") + g.t(x + 23, y + 72, hx_, SM, DIM if rd else FAINT, "mono", "middle") + y1 = my_ + 36 + g.frame(cx - 5, y1 - 5, 8 * CELL + 8, TH + 10, READ, 3) + g.frame(cx - 5, y1 + 104 - 5, 6 * CELL + 8, TH + 10, READ, 3) + g.t(cx, y1 + 2 * 104 + 22, "14 bytes, read by the kernel", 24, DIM, "sans") + + # the boundary. The same three columns continue through it. + g.t(MX, BY - 16, "user", 28, VELLUM, "sansm") + g.t(MX, BY + 42, "kernel", 28, PAGE, "sansm") + # crossings: vellum above the line, ink below it + ax = colx(4) + span(4) / 2 + g.line(ax, STAGE_Y + UH, ax, BY, VELLUM, 6) + arrow(g, [(ax, BY), (ax, BY + 64)], PAGE, 6, hl=24, hw=24) + g.t(ax + 22, BY - 14, "syscall", SM, VELLUM, "mono") + dx = cx + 4 * CELL + g.line(dx, STAGE_Y + UH, dx, BY, READ, 6) + arrow(g, [(dx, BY), (dx, BY + 116)], PAGE, 6, hl=24, hw=24) + g.t(dx + 22, BY - 14, "the bytes", 24, VELLUM, "sans") + + # kernel, left: what it runs + g.t(MX, BY + 92, "what it runs", 24, KERNEL_DIM, "sans") + cards(g, MX, BY + 108, span(4), [ + ("tty_write", "", "", True), + ("vfs_write", "", "", False), + ("ksys_write", "", "", False), + ], on_kernel=True) + + # kernel, middle: the call, decoded + kx = colx(4) + g.t(kx, BY + 122, "write", HERO, PAGE, "monob") + g.t(kx + mw("write", HERO) + 24, BY + 122, "system call 1", 28, KERNEL_DIM, "sans") + for i, (reg, name, val, note) in enumerate((("rdi", "fd", "1", "the terminal"), ("rsi", "buf", "55d4a1c02004", ""), + ("rdx", "count", "14", "bytes"), ("rax", "returns", "", "not yet"))): + y = BY + 146 + i * 44 + g.line(kx, y, kx + span(4), y, KERNEL_RULE, 2) + b = base(y, 44, DATA) + g.t(kx, b, reg, DATA, KERNEL_DIM, "mono") + g.t(kx + 84, b - 1, name, 28, PAGE, "sansm") + vw = 0 + if len(val) > 4: + hexgroups(g, kx + 220, b, val, all_fill=PAGE) + vw = hexw(len(val)) + elif val: + g.t(kx + 220, b, val, DATA, PAGE, "mono") + vw = mw(val, DATA) + if note: + g.t(kx + 220 + (vw + 20 if val else 0), b - 1, note, 28, KERNEL_DIM, "sans") + + # kernel, right: the bytes arriving + tx = colx(8) + g.t(tx, BY + 160, "the terminal's buffer", 24, KERNEL_DIM, "sans") + chars = ["H", "e", "l", "l", "o", ",", " ", "w", "o", "r", "l", "d"] + for j in range(12): + x, y = tx + j * CELL, BY + 176 + if j < 9: + g.rect(x, y, CELL - 2, CELL - 2, VERM if j == 8 else KERNEL_HELD) + g.frame(x, y, CELL - 2, CELL - 2, PAGE, 2) + if chars[j] == " ": + space_glyph(g, x + 23, base(y, CELL - 2, DATA), INK) + else: + g.tc(x, y, CELL - 2, CELL - 2, chars[j], DATA, INK, "monob" if j == 8 else "mono") + else: + g.frame(x, y, CELL - 2, CELL - 2, KERNEL_RULE, 2) + g.t(tx, BY + 176 + 78, "9 of 14 copied", 24, KERNEL_DIM, "sans") + + caption(g, [[("The program cannot reach the terminal. It leaves four numbers",)], + [("in registers, and ",), ("syscall", "mono"), (" hands them to the kernel.",)]], PAGE) + g.save("03-syscall-write") + + +# ---- frame 4: glibc and musl malloc, side by side ------------------------- +def frame4(): + g = Svg() + head(g, "malloc: glibc and musl", lit=("source", "memory"), focus="memory", where="heap.c:9 free(b);") + S = 4 # logical units per byte, in the strips + T1, T2, T3 = 72, 288, 580 # three tiers, from the body's top, the same both sides + + def more(x, y, h): + for i in range(3): + g.rect(x + i * 14, y + h / 2 - 3, 6, 6, FAINT) + + # ---- glibc + x, y, w, h = panel(g, colx(0), STAGE_Y, span(6), STAGE_H, "glibc 2.39", right="ptmalloc") + px, pr = x + 28, x + w - 28 + g.t(px, y + 44, "the heap: one run of chunks", 24, DIM, "sans") + SH = 88 + sy = y + T1 + 26 + chunk(g, px, sy, 70, SH, "meta") + xa = px + 72 + chunk(g, xa, sy, 32 * S - 2, SH, "used", "a") + xb = xa + 32 * S + chunk(g, xb, sy, 32 * S - 2, SH, "free", "b", writes=((32, 31), (64, 31)), name_x=110) + xc = xb + 32 * S + chunk(g, xc, sy, 112 * S - 2, SH, "used", "c") + xt = xc + 112 * S + chunk(g, xt, sy, pr - xt, SH, "avail") + more(xt + 18, sy, SH) + g.t(px, sy - 14, "tcache", 22, FAINT, "sans") + g.t(pr, sy - 14, "unused", 22, FAINT, "sans", "end") + x1s = xc + 112 * S - 2 # scale, under the far end of c + g.path(f"M{x1s - 32 * S + 1},{sy + SH + 12} v16 m0,-8 H{x1s - 1} m0,-8 v16", FAINT, 3) + g.t(x1s - 32 * S - 14, sy + SH + 28, "32 bytes", 22, FAINT, "sans", "end") + + zy = y + T2 + zx = px + 86 + g.t(zx + 4 * CELL, zy - 4, "inside b", 24, DIM, "sans", "middle") + wedge_down(g, xb, xb + 32 * S - 2, sy + SH + 4, zx, zx + 8 * CELL - 2, zy + 16) + rowy = [] + for i, (d, st, f, note) in enumerate((("0000000000000021", "plain", "size", "of this chunk"), + ("000000055d4a1c03", "write", "next", "free chunk: none"), + ("8f3a61c2d07b4e19", "write", "key", "marks it freed"), + ("000000000000002a", "plain", "", "your old data"))): + yy = zy + 22 + i * ROW + rowy.append(yy) + word(g, zx, yy, d, st) + xx = zx + 8 * CELL + 18 + if f: + g.t(xx, base(yy, CELL - 2, SM), f, SM, VELLUM if st == "write" else DIM, "mono") + xx += mw(f, SM) + 14 + g.t(xx, base(yy, CELL - 2, 24), note, 24, DIM, "sans") + + ty = y + T3 + for i, (size, cnt) in enumerate((("0x20", 1), ("0x30", 0), ("0x40", 0), ("0x50", 0), ("0x60", 0), ("0x70", 0))): + bx_ = px + i * 136 + g.t(bx_ + 60, ty + CELL + 28, size, SM, DIM, "mono", "middle") + g.rect(bx_, ty, 120, CELL - 2, VERM if cnt else RAISED) + if cnt: + g.tc(bx_, ty, 120, CELL - 2, "1 free", DATA, INK, "monob") + else: + g.tc(bx_, ty, 120, CELL - 2, "0", DATA, FAINT, "mono") + arrow(g, [(px + 30, ty), (px + 30, rowy[1] + 23), (zx - 4, rowy[1] + 23)]) + g.t(px, ty + CELL + 72, "its notes: a list for each size, kept in the heap itself", 24, DIM, "sans") + + # ---- musl + x2, y2, w2, h2 = panel(g, colx(6), STAGE_Y, span(6), STAGE_H, "musl 1.2.5", right="mallocng") + qx, qr = x2 + 28, x2 + w2 - 28 + g.t(qx, y2 + 44, "the heap: groups of equal slots", 24, DIM, "sans") + SH2 = 56 + s1 = y2 + T1 - 2 + xs = qx + 64 + chunk(g, qx, s1, 62, SH2, "meta") + chunk(g, xs, s1, 112 * S - 2, SH2, "used", "c", hdr=0) + chunk(g, xs + 112 * S, s1, qr - xs - 112 * S, SH2, "avail") + more(xs + 112 * S + 18, s1, SH2) + g.t(qr, s1 - 12, "112-byte slots", 22, FAINT, "sans", "end") + s2 = s1 + SH2 + 40 + chunk(g, qx, s2, 62, SH2, "meta") + chunk(g, xs, s2, 32 * S - 2, SH2, "used", "a", hdr=0) + xb2 = xs + 32 * S + chunk(g, xb2, s2, 32 * S - 2, SH2, "free", "b", hdr=0, writes=((3, 14),)) + for i in range(2, 5): + chunk(g, xs + i * 32 * S, s2, 32 * S - 2, SH2, "avail") + more(xs + 5 * 32 * S + 14, s2, SH2) + g.t(qr, s2 - 12, "32-byte slots", 22, FAINT, "sans", "end") + + zx2 = qx + 86 + g.t(zx2 + 4 * CELL, zy - 4, "inside b", 24, DIM, "sans", "middle") + wedge_down(g, xb2, xb2 + 32 * S - 2, s2 + SH2 + 4, zx2, zx2 + 8 * CELL - 2, zy + 16) + for i, (d, st, nb, note) in enumerate((("ff000000", "held", 4, "its tag, cleared"), + ("000000000000002a", "plain", 8, "your old data,"), + ("0000000000000000", "plain", 8, "all of it untouched"))): + yy = zy + 22 + i * ROW + ww_ = word(g, zx2, yy, d, st, nb) + g.t(zx2 + ww_ + 20, base(yy, CELL - 2, 24), note, 24, DIM, "sans") + + bx0 = qx + 196 + for r, (label, bits, struck) in enumerate((("can hand out", "0011111111", None), ("freed", "0100000000", 1))): + yy = ty - 60 + r * 52 + g.t(bx0 - 20, base(yy, CELL - 2, 24), label, 24, DIM, "sans", "end") + for i, bch in enumerate(bits): + bx_ = bx0 + i * CELL + g.rect(bx_, yy, CELL - 2, CELL - 2, VERM if i == struck else RAISED) + if i == struck: + g.tc(bx_, yy, CELL - 2, CELL - 2, bch, DATA, INK, "monob") + else: + g.tc(bx_, yy, CELL - 2, CELL - 2, bch, DATA, VELLUM if bch == "1" else FAINT, "mono") + g.t(bx0 + 23, ty + CELL + 28, "a", SM, DIM, "mono", "middle") + g.t(bx0 + CELL + 23, ty + CELL + 28, "b", SM, VELLUM, "mono", "middle") + g.t(bx0 + 2 * CELL + 10, ty + CELL + 28, "one bit for each slot", 22, FAINT, "sans") + g.t(qx, ty + CELL + 72, "its notes: one record for each group, kept apart", 24, DIM, "sans") + + caption(g, [[("glibc threads its free list through the freed chunk itself.",)], + [("musl flips one bit in a record it keeps apart from your data.",)]]) + g.save("04-malloc-glibc-musl") + + +# ---- frame 5: a memory grid mid-write, with a pointer --------------------- +def frame5(): + g = Svg() + head(g, "Where a pointer lives", lit=("source", "cpu", "memory"), focus="memory", where="hello.c:8") + + sh = 384 + bx, by, bw, bh = panel(g, colx(0), STAGE_Y, span(5), sh, "hello.c") + code(g, bx + 2, by + 16, bw - 4, [ + (7, [("char", K), (" buf[", N), ("16", L), ("] = ", N), ('"Hello, world!\\n"', L), (";", N)]), + (8, [("char", K), (" *p = buf;", N)]), + (9, [("write(", N), ("1", L), (", p, ", N), ("14", L), (");", N)]), + (10, [("return", K), (" ", N), ("0", L), (";", N)]), + ], cur=8, trail=(7,), unfold=(8, [("lea", "rax, [rbp-0x20]"), ("mov", "[rbp-0x8], rax")], 1)) + + rx, ry, rw, rh = panel(g, colx(0), STAGE_Y + sh + VGAP, span(5), STAGE_H - sh - VGAP, "registers", right="x86-64") + rr = regs(g, rx + 2, ry + 14, rw - 4, [ + ("rip", "000055d4a1c0116d", "pc"), + ("rax", "00007ffd3a2c1e40", "read"), + ("rdi", "0000000000000001", "plain"), + ("rsp", "00007ffd3a2c1e30", "plain"), + ("rbp", "00007ffd3a2c1e60", "plain"), + ]) + + mx_, my_, mw_, mh_ = panel(g, colx(5), STAGE_Y, span(7), STAGE_H, "stack", focus=True, right="from 7ffd 3a2c 1e30 · low addresses on top") + gx = mx_ + 112 # gutter; register marks sit left of it + cx = gx + hexw(8, SM) + 52 # bytes + ax = cx + 8 * CELL + 22 # as text + lx = ax + 8 * 18 + 34 # names + top = my_ + 86 + for i in range(8): + g.t(cx + i * CELL + 23, top - 50, "+%d" % i, SM, FAINT, "mono", "middle") + g.t(ax, top - 50, "as text", 22, FAINT, "sansm") + # whose bytes these are + g.rect(mx_ + 18, top - 30, 12, 12, GOLD) + g.t(mx_ + 42, top - 16, "main", SM, VELLUM, "mono") + g.line(mx_ + 42 + mw("main", SM) + 16, top - 24, mx_ + mw_ - 18, top - 24, RULE, 2) + rows = [ + (0x7ffd3a2c1e30, [None] * 8, "plain", None, ""), + (0x7ffd3a2c1e38, [None] * 8, "plain", None, ""), + (0x7ffd3a2c1e40, "48 65 6c 6c 6f 2c 20 77".split(), "plain", "Hello, w", "buf"), + (0x7ffd3a2c1e48, "6f 72 6c 64 21 0a 00 00".split(), "plain", "orld!···", ""), + (0x7ffd3a2c1e50, "00 3f 9a c1 77 d2 8e 5b".split(), "plain", "·?··w··[", "canary"), + (0x7ffd3a2c1e58, "40 1e 2c 3a fd 7f 00 00".split(), "write", "@·,:····", "p"), + (0x7ffd3a2c1e60, "00 1f 2c 3a fd 7f 00 00".split(), "plain", "··,:····", "saved rbp"), + (0x7ffd3a2c1e68, "90 9d 22 5e 3c 7f 00 00".split(), "plain", "··\"^<···", "return to"), + ] + rowy = {} + for i, (addr, bs, st, asc, label) in enumerate(rows): + y = top + i * ROW + rowy[addr] = y + address(g, gx, y, addr, digits=8) + for j, v in enumerate(bs): + byte(g, cx + j * CELL, y, v, st) + if asc: + for j, ch in enumerate(asc): + g.t(ax + j * 18, base(y, CELL - 2, DATA), ch, DATA, FAINT if ch == "·" else VELLUM, "mono") + if label in ("buf", "p"): + g.t(lx, base(y, CELL - 2, DATA), label, DATA, VELLUM if st == "write" else DIM, "mono") + elif label: + g.t(lx, base(y, CELL - 2, 28), label, 28, DIM, "sans") + yb = rowy[0x7ffd3a2c1e40] + g.path(f"M{lx - 20},{yb + 2} h8 V{yb + ROW + 44} h-8", DIM, 3, join="miter") + yend = top + 8 * ROW + 2 + g.frame(mx_ + 18, yend, 12, 12, FAINT, 2) + g.t(mx_ + 42, yend + 14, "__libc_start_call_main", SM, DIM, "mono") + g.line(mx_ + 42 + mw("__libc_start_call_main", SM) + 16, yend + 6, mx_ + mw_ - 18, yend + 6, RULE, 2) + + # the pointer: the word at ...1e58 holds ...1e40 + yp = rowy[0x7ffd3a2c1e58] + ptr_frame(g, cx, yp) + lane = cx - 30 + arrow(g, [(cx - 6, yp + 23), (lane, yp + 23), (lane, yb + 23), (cx - 3, yb + 23)]) + regmark(g, gx - 6, rowy[0x7ffd3a2c1e30], "rsp") + regmark(g, gx - 6, rowy[0x7ffd3a2c1e60], "rbp") + + # the value in transit: rax to the row it is stored in + xk = colx(5) - 16 + flow(g, [(rx + rw - 14, rr["rax"] + 24), (xk, rr["rax"] + 24), (xk, yp + 23), (gx - 10, yp + 23)]) + + # the same eight bytes, read as one number + cy = yend + 46 + g.t(cx, cy + 12, "the same eight bytes, low byte first, as one number", 24, DIM, "sans", "start") + wy = cy + 34 + word(g, cx, wy, "00007ffd3a2c1e40") + ptr_frame(g, cx, wy) + g.t(cx + 8 * CELL + 22, base(wy, CELL - 2, 28), "= where ", 28, DIM, "sans") + g.t(cx + 8 * CELL + 22 + tw("= where ", 28), base(wy, CELL - 2, DATA), "buf", DATA, VELLUM, "mono") + g.t(cx + 8 * CELL + 22 + tw("= where ", 28) + 3 * 18 + 10, base(wy, CELL - 2, 28), "starts", 28, DIM, "sans") + + caption(g, [[("The pointer ",), ("p", "mono"), (" is eight ordinary bytes on the stack.",)], + [("Read as one number, they are the address of ",), ("buf", "mono"), (".",)]]) + g.save("05-memory-write") + + +# ---- frame 6: a title card and the legend --------------------------------- +def frame6(): + g = Svg() + g.rect(MX, 150, 24, 24, GOLD) + g.t(MX + 44, 172, "How programs really run", 30, DIM, "sansm") + g.t(W - MX, 172, "part 3", 30, FAINT, "sansm", "end") + g.t(MX - 4, 330, "Where does malloc", 116, BRIGHT, "sansb") + g.t(MX - 4, 458, "keep its notes?", 116, BRIGHT, "sansb") + g.rich(MX, 540, [("glibc and musl, one ", DIM), ("free()", VELLUM, "mono"), (" at a time", DIM)], 44) + + x, y, w, h = panel(g, MX, 624, W - 2 * MX, 264, "legend", right="the same marks in every picture") + EW = (w - 40) / 6 + entries = [ + ("current", "executing now", "cur"), ("written", "by this step", "write"), ("changed", "a moment ago", "held"), + ("read", "by this step", "read"), ("pointer", "an address", "ptr"), ("moving", "in transit", "flow"), + ("allocated", "handed out", "alloc"), ("freed", "handed back", "free"), ("not seen", "never observed", "unk"), + ("kernel", "the other side", "kern"), ("fault", "signal or error", "err"), ("one object", "in every view", "pig"), + ] + c = CELL - 2 + for i, (name, gloss, kind) in enumerate(entries): + ex = x + 24 + (i % 6) * EW + ey = y + 24 + (i // 6) * 96 + sx, sy = ex, ey + 10 + if kind == "cur": + g.rect(sx, sy, 94, c, GOLD) + g.tc(sx, sy, 94, c, "rip", DATA, INK, "monob") + elif kind in ("write", "held", "read"): + byte(g, sx, sy, "2a", kind) + byte(g, sx + CELL, sy, "00", kind) + elif kind == "ptr": + g.rect(sx, sy, 34, c, RAISED) + g.frame(sx - 6, sy - 6, 46, c + 12, PTR, 4) + arrow(g, [(sx + 40, sy + 23), (sx + 94, sy + 23)]) + elif kind == "flow": + flow(g, [(sx, sy + 23), (sx + 94, sy + 23)]) + elif kind == "alloc": + g.rect(sx, sy, 94, c, EMBER[ALLOC]) + g.frame(sx, sy, 94, c, ALLOC, 3) + elif kind == "free": + g.rect(sx, sy, 94, c, "url(#hatch)") + g.frame(sx, sy, 94, c, DIM, 3, dash="12 8") + elif kind == "unk": + byte(g, sx, sy, None) + byte(g, sx + CELL, sy, None) + elif kind == "kern": + g.rect(sx, sy, 94, c, KERNEL) + g.tc(sx, sy, 94, c, "sys", DATA, PAGE, "monob") + elif kind == "err": + g.rect(sx, sy, 94, c, "url(#hazard)") + g.rect(sx + 8, sy + 8, 78, c - 16, INK) + g.tc(sx + 8, sy + 8, 78, c - 16, "SEGV", SM, BRIGHT, "monob") + elif kind == "pig": + g.rect(sx, sy, 43, c, OCHRE) + g.rect(sx + 51, sy, 43, c, TEAL) + g.t(ex + 110, ey + 28, name, 28, VELLUM, "sansm") + g.t(ex + 110, ey + 58, gloss, 22, DIM, "sans") + g.save("06-title-legend") + + +# ---- frame 7: insertion sort, a compare and a swap ------------------------ +def frame7(): + g = Svg() + head(g, "Insertion sort", lit=("source",), focus="source", where="sort.c:6") + AH = 408 + x, y, w, h = panel(g, MX, STAGE_Y, W - 2 * MX, AH, "a", focus=True, right="int a[8]") + vals = [4, 9, 17, 31, 12, 26, 5, 20] + CW, CH = 168, 132 + x0 = MX + (W - 2 * MX - 8 * CW) / 2 + cy = y + 140 + J = 4 + tags = {J - 1: "j-1", J: "j", 5: "i"} + for i, v in enumerate(vals): + cx = x0 + i * CW + st = "read" if i in (J - 1, J) else ("held" if i == 5 else "plain") + g.rect(cx, cy, CW - 2, CH, {"read": EMBER[READ], "held": EMBER[VERM]}.get(st, RAISED)) + if st == "read": + g.frame(cx, cy, CW - 2, CH, READ, 4) + if st == "held": + g.rect(cx, cy + CH - 6, CW - 2, 6, VERM) + g.t(cx + 14, cy + 34, str(i), SM, DIM if i in tags else FAINT, "mono") + if i in tags: + pw = mw(tags[i], SM) + 20 + g.rect(cx + CW - 2 - pw - 10, cy + 10, pw, 36, PAGE) + g.t(cx + CW - 2 - pw, base(cy + 10, 36, SM), tags[i], SM, VELLUM, "monob") + g.t(cx + CW / 2 - 1, cy + CH / 2 + 18 + 0.36 * HERO, str(v), HERO, FAINT if i in (J - 1, J) else VELLUM, "mono", "middle") + # the comparison that decided it + xa, xb = x0 + (J - 1) * CW + CW / 2, x0 + J * CW + CW / 2 + mid = (xa + xb) / 2 + cw_ = mw("31 > 12", DATA) + 32 + g.frame(mid - cw_ / 2, y + 10, cw_, 46, DIM, 2) + g.t(mid, base(y + 10, 46, DATA), "31 > 12", DATA, VELLUM, "mono", "middle") + g.t(mid + cw_ / 2 + 16, base(y + 10, 46, 24), "so they trade places", 24, DIM, "sans") + + # the swap, in flight: one value over, one under + def fly(p0, p1, peak, t, label): + (ax, ay), (bx_, by_) = p0, p1 + mx_, my_ = (ax + bx_) / 2, (ay + by_) / 2 + 2 * peak + g.path(f"M{ax},{ay} Q{mx_},{my_} {bx_},{by_}", DIM, 3) + dl = math.hypot(bx_ - mx_, by_ - my_) + head_tri(g, bx_, by_, (bx_ - mx_) / dl, (by_ - my_) / dl, DIM, 16, 14) + px_ = (1 - t) ** 2 * ax + 2 * (1 - t) * t * mx_ + t * t * bx_ + py_ = (1 - t) ** 2 * ay + 2 * (1 - t) * t * my_ + t * t * by_ + g.rect(px_ - 50, py_ - 30, 100, 60, PAGE) + g.frame(px_ - 50, py_ - 30, 100, 60, BRIGHT, 3) + g.t(px_, py_ + 0.36 * 45, label, 45, BRIGHT, "monob", "middle") + fly((xa, cy - 4), (xb, cy - 4), -46, 0.36, "31") + fly((xb, cy + CH + 4), (xa, cy + CH + 4), 46, 0.36, "12") + + by0 = STAGE_Y + AH + VGAP + bh0 = STAGE_H - AH - VGAP + sx, sy, sw_, sh = panel(g, colx(0), by0, span(7), bh0, "sort.c") + code(g, sx + 2, sy + 16, sw_ - 4, [ + (3, [("for", K), (" (", N), ("int", K), (" i = ", N), ("1", L), ("; i < n; i++) {", N)]), + (4, [(" ", N), ("int", K), (" j = i;", N)]), + (5, [(" ", N), ("while", K), (" (j > ", N), ("0", L), (" && a[j-1] > a[j]) {", N)]), + (6, [(" swap(&a[j-1], &a[j]);", N)]), + (7, [(" j--;", N)]), + ], cur=6, trail=(5, 7)) + + lx, ly, lw, lh = panel(g, colx(7), by0, span(5), bh0, "locals", right="of sort()") + for k, (name, typ, val) in enumerate((("i", "int", "5"), ("j", "int", "4"), ("n", "int", "8"), ("a", "int *", None))): + yy = ly + 12 + k * 56 + b = base(yy, 46, DATA) + g.t(lx + 24, b, name, DATA, VELLUM, "mono") + g.t(lx + 84, base(yy, 46, SM), typ, SM, FAINT, "mono") + if val: + if name == "j": + g.rect(lx + 196, yy, 76, 46, EMBER[VERM]) + g.rect(lx + 196, yy + 40, 76, 6, VERM) + g.t(lx + 212, b, val, DATA, VELLUM, "mono") + else: + hexgroups(g, lx + 212, b, "7ffd3a2c1e20") + g.t(lx + 212 + hexw(12) + 20, base(yy, 46, 24), "where a[0] is", 24, DIM, "sans") + caption(g, [[("While the one on the left is larger, they trade places,",)], + [("and ",), ("j", "mono"), (" follows the smaller value down.",)]]) + g.save("07-sort-swap") + + +# ---- frame 8: the far view: pages and system calls ------------------------ +def frame8(): + g = Svg() + head(g, "A process, from far away", lit=("memory", "kernel"), focus="memory", where="hello") + PH = 480 + x, y, w, h = panel(g, colx(0), STAGE_Y, span(8), PH, "address space", focus=True, right="one square a page of 4096 bytes · low addresses on top") + gx = x + 24 + px_ = gx + hexw(12, SM) + 24 # permissions + nx = px_ + 3 * 30 + 16 # name + zx_ = nx + 150 + 80 # size, ranged right on this + cx = zx_ + 24 # pages + P = 24 # page pitch; drawn 22 + maps = [ + (0x55d4a1c01000, "r-x", "hello", "C", "4K"), + (0x55d4a1c02000, "r--", "hello", "R", "4K"), + (0x55d4a1c03000, "rw-", "hello", "ph", "8K"), + (0x55d4a2e5f000, "rw-", "heap", "pp" + "." * 14, "132K"), + (0x7f3c5e200000, "r-x", "libc.so.6", "pp.p..ppp.p....p", "2.1M"), + (0x7f3c5e5c2000, "r-x", "ld.so", "ppp.pp.p..p.pppp", "216K"), + (0x7ffd3a2a2000, "rw-", "stack", "." * 13 + "pWp", "132K"), + (0x7ffd3a3d1000, "r-x", "vdso", "p.", "8K"), + ] + ry = {} + for i, (addr, perm, name, pages, size) in enumerate(maps): + yy = y + 16 + i * 42 + ry[name + str(i)] = yy + address(g, gx, yy, addr, h=38) + for k, ch in enumerate("rwx"): + bx_ = px_ + k * 30 + if perm[k] != "-": + g.rect(bx_, yy + 4, 26, 30, RAISED) + g.t(bx_ + 13, base(yy, 38, SM), ch, SM, VELLUM, "mono", "middle") + else: + g.rect(bx_ + 10, yy + 16, 6, 6, RULE) + g.t(nx, base(yy, 38, SM), name, SM, VELLUM, "mono") + g.t(zx_, base(yy, 38, SM), size, SM, DIM, "mono", "end") + lead = 44 if name == "stack" else 0 # the stack's used end is its high end + for k, ch in enumerate(pages): + qx = cx + lead + k * P + if ch == ".": + g.frame(qx, yy + 8, P - 2, P - 2, RULE, 2) + else: + g.rect(qx, yy + 8, P - 2, P - 2, {"p": RULE, "C": GOLD, "R": READ, "W": VERM, "h": EMBER[VERM]}[ch]) + if ch == "h": + g.rect(qx, yy + 8 + P - 8, P - 2, 6, VERM) + if len(pages) == 16: + for d in range(3): + g.rect(cx + (0 if lead else 16 * P + 10) + d * 12, yy + 16, 6, 6, FAINT) + # the kernel's half, below everything + ky = y + 16 + len(maps) * 42 + 10 + g.rect(x + 2, ky, w - 4, h - (ky - y) - 2, KERNEL) + km = ky + (h - (ky - y)) / 2 + g.t(gx, km + 0.36 * SM, "ffff 8000 0000", SM, PAGE, "mono") + g.t(nx, km + 0.36 * 28, "kernel", 28, PAGE, "sansm") + g.t(nx + 130, km + 0.36 * 24, "the upper half of every address space", 24, KERNEL_DIM, "sans") + + # one page, magnified + zx, zy, zw, zh = panel(g, colx(8), STAGE_Y, span(4), PH, "one page of the stack", right="4096 bytes") + sgx = zx + 20 + scx = sgx + hexw(8, SM) + 28 + rows = [(0x7ffd3a2c1e38, [None] * 8, "plain"), + (0x7ffd3a2c1e40, "48 65 6c 6c 6f 2c 20 77".split(), "plain"), (0x7ffd3a2c1e48, "6f 72 6c 64 21 0a 00 00".split(), "plain"), + (0x7ffd3a2c1e50, "00 3f 9a c1 77 d2 8e 5b".split(), "plain"), (0x7ffd3a2c1e58, "40 1e 2c 3a fd 7f 00 00".split(), "write")] + elide(g, scx, zy + 18, "3640 bytes above") + for i, (addr, bs, st) in enumerate(rows): + yy = zy + 58 + i * ROW + address(g, sgx, yy, addr, digits=8) + for j, v in enumerate(bs): + byte(g, scx + j * CELL, yy, v, st) + elide(g, scx, zy + 58 + 5 * ROW + 2, "416 below") + wy = ry["stack6"] + 8 + wx = cx + 44 + 14 * P + g.frame(wx - 5, wy - 5, P + 8, P + 8, BRIGHT, 3) + wedge(g, wx + P + 3, wy - 5, wy + P + 3, zx, zy - TAG_H, zy + zh) + + # system calls: the boundary seen from far away + sy0 = STAGE_Y + PH + VGAP + sx, sy, sw_, sh = panel(g, colx(0), sy0, span(12), STAGE_H - PH - VGAP, "system calls", right="time runs right · width is time spent in the kernel") + bl = sy + 78 + g.line(sx + 2, bl, sx + sw_ - 2, bl, VELLUM, 3) + g.t(sx + 24, bl - 14, "user", 22, DIM, "sansm") + g.t(sx + 24, bl + 30, "kernel", 22, DIM, "sansm") + calls = [("execve", 150, 1), ("brk", 18, 0), ("mmap", 26, 0), ("openat", 64, 1), ("read", 40, 0), ("mmap", 30, 0), ("mmap", 22, 0), + ("close", 16, 0), ("mprotect", 70, 1), ("mmap", 22, 0), ("arch_prctl", 16, 0), ("munmap", 44, 0), ("write", 110, 2), ("exit_group", 120, 3)] + gaps = [40, 26, 22, 30, 24, 20, 22, 26, 34, 22, 28, 140, 150, 60] + xx = sx + 130 + now = main_x = None + for (name, wd, kind), gap in zip(calls, gaps): + xx += gap + if name == "write": + main_x = xx - 120 + if kind == 3: # not yet run + g.frame(xx, bl + 2, wd, 44, DIM, 2) + g.t(xx + wd / 2, bl + 80, name, SM, FAINT, "mono", "middle") + else: + g.rect(xx, bl + 2, wd, 44, KERNEL) + if kind == 2: + now = xx + wd * 0.55 + pw = mw(name, SM) + 24 + g.rect(xx + wd / 2 - pw / 2, bl + 58, pw, 40, GOLD) + g.t(xx + wd / 2, base(bl + 58, 40, SM), name, SM, INK, "monob", "middle") + elif kind == 1: + g.t(xx + wd / 2, bl + 80, name, SM, DIM, "mono", "middle") + xx += wd + for label, xa, xb in (("the dynamic loader", sx + 320, main_x - 20), ("main", main_x, sx + sw_ - 60)): + g.path(f"M{xa},{bl - 28} v-10 H{xb} v10", FAINT, 3, join="miter") + if " " in label: + g.t((xa + xb) / 2, bl - 50, label, 24, DIM, "sans", "middle") + else: + g.t((xa + xb) / 2, bl - 50, label, SM, DIM, "mono", "middle") + g.line(now, sy + 8, now, bl + 54, GOLD, 4) + + caption(g, [[("Before ",), ("main", "mono"), (" runs a single line, the loader has already",)], + [("asked the kernel for memory a dozen times.",)]]) + g.save("08-far-view") + + +if __name__ == "__main__": + import sys + frames = {k: v for k, v in globals().items() if k.startswith("frame") and callable(v)} + for k in sys.argv[1:] or sorted(frames): + frames[k if k.startswith("frame") else "frame" + k]() |
