From 091521c382ee3341df5053bd6802699883116014 Mon Sep 17 00:00:00 2001 From: Joshua Potter Date: Fri, 22 Mar 2024 08:10:08 -0600 Subject: [PATCH] Start adding x86-64 notes. --- .../plugins/obsidian-to-anki-plugin/data.json | 26 +- notes/_journal/2024-03-22.md | 14 + notes/_journal/{ => 2024-03}/2024-03-20.md | 15 +- notes/_journal/2024-03/2024-03-21.md | 15 ++ notes/algebra/radices.md | 2 +- notes/algorithms/order-growth.md | 2 +- notes/algorithms/sorting/merge-sort.md | 24 +- notes/assembly/index.md | 7 - notes/c17/strings.md | 14 +- notes/encoding/floating-point.md | 40 +-- notes/encoding/integer.md | 2 +- notes/set/graphs.md | 2 +- notes/x86-64/declarations.md | 242 ++++++++++++++++++ notes/{assembly/x86.md => x86-64/index.md} | 46 +++- notes/x86-64/instructions.md | 65 +++++ 15 files changed, 452 insertions(+), 64 deletions(-) create mode 100644 notes/_journal/2024-03-22.md rename notes/_journal/{ => 2024-03}/2024-03-20.md (63%) create mode 100644 notes/_journal/2024-03/2024-03-21.md delete mode 100644 notes/assembly/index.md create mode 100644 notes/x86-64/declarations.md rename notes/{assembly/x86.md => x86-64/index.md} (85%) create mode 100644 notes/x86-64/instructions.md diff --git a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json index 280669d..1401216 100644 --- a/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json +++ b/notes/.obsidian/plugins/obsidian-to-anki-plugin/data.json @@ -146,7 +146,7 @@ "algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2", "algorithms/loop-invariant.md": "e39f4aa253f0baf908067bea81f6bced", "algorithms/running-time.md": "5efc0791097d2c996f931c9046c95f65", - "algorithms/order-growth.md": "53d41d9abbd1d8118793bad3996d249a", + "algorithms/order-growth.md": "513ea484fcdc184170205a425be77742", "_journal/2024-02-08.md": "19092bdfe378f31e2774f20d6afbfbac", "algorithms/sorting/selection-sort.md": "5ba56adddaf07653290af88f998f6c4a", "algorithms/index 1.md": "6fada1f3d5d3af64687719eb465a5b97", @@ -209,16 +209,16 @@ "combinatorics/inclusion-exclusion.md": "202a60120d451676d44df4d0be30a45a", "_journal/2024-02-21.md": "b9d944ecebe625da5dd72aeea6a916a2", "_journal/2024-02/2024-02-20.md": "af2ef10727726200c4defe2eafc7d841", - "algebra/radices.md": "03b8452798a6fd4ec5af526371309c4f", + "algebra/radices.md": "0a7c37531c6ae4406e1c9e894166ffbe", "_journal/2024-02-22.md": "e01f1d4bd2f7ac2a667cdfd500885a2a", "_journal/2024-02/2024-02-21.md": "f423137ae550eb958378750d1f5e98c7", "_journal/2024-02-23.md": "219ce9ad15a8733edd476c97628b71fd", "_journal/2024-02/2024-02-22.md": "312e55d57868026f6e80f7989a889c2b", - "c17/strings.md": "b9d2efd54b9a06f50042fb2714dedbf4", + "c17/strings.md": "3cedaa7a28f779e24c2665c7afdcf19a", "c17/index.md": "78576ee41d0185df82c59999142f4edb", "c17/escape-sequences.md": "a8b99070336878b4e8c11e9e4525a500", "c17/declarations.md": "cec6866dff8ad160467df62cfceb6872", - "algorithms/sorting/merge-sort.md": "e0e9108566d2de0ff9fd211a573fca8d", + "algorithms/sorting/merge-sort.md": "a04394c72bd35bd84fe796bbc8ed1a0a", "_journal/2024-02-24.md": "9bb319d5014caf962a9ce3141076cff4", "_journal/2024-02/2024-02-23.md": "0aad297148e8cc4058b48b7e45787ca7", "_journal/2024-02-25.md": "fb1a48208c11d12262facc647749ca6f", @@ -233,7 +233,7 @@ "filesystems/cas.md": "34906013a2a60fe5ee0e31809b4838aa", "git/objects.md": "e9b98576291ca04496c2f0863f526cfa", "git/index.md": "83d2d95fc549d9e8436946c7bd058d15", - "encoding/integer.md": "6b9e0589706f57089a1c2ede93dc43b8", + "encoding/integer.md": "d4866b6e236c3a67631d03582996eca2", "_journal/2024-02-29.md": "f610f3caed659c1de3eed5f226cab508", "_journal/2024-02/2024-02-28.md": "7489377c014a2ff3c535d581961b5b82", "_journal/2024-03-01.md": "a532486279190b0c12954966cbf8c3fe", @@ -278,24 +278,30 @@ "_journal/2024-03/2024-03-15.md": "e54b2513beac5f46313b4c37622adf39", "_journal/2024-03-17.md": "72e99c7630085aee2c7f340a06b5ada7", "_journal/2024-03/2024-03-16.md": "ab7629c24ebe70838072cf6acec47cb0", - "encoding/floating-point.md": "376c963b043e4f4f603b2eaa3cfdb8ae", + "encoding/floating-point.md": "83c663e3ecc51498968010d1931bd794", "_journal/2024-03-18.md": "8479f07f63136a4e16c9cd07dbf2f27f", "_journal/2024-03/2024-03-17.md": "23f9672f5c93a6de52099b1b86834e8b", "set/directed-graph.md": "b4b8ad1be634a0a808af125fe8577a53", "set/index.md": "b82a215fbee3c576186fc1af93c82fcb", - "set/graphs.md": "dda79b615896d19a3041fbc0ee16b1da", + "set/graphs.md": "82c4938f9f6479c75d946c8e1263a5a1", "_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb", "_journal/2024-03/2024-03-18.md": "63c3c843fc6cfc2cd289ac8b7b108391", "awk/variables.md": "e40a20545358228319f789243d8b9f77", "awk/regexp.md": "4ce38103575a5321a1503b28e1d714dd", "awk/index.md": "257738d2d864933fb4bd21e8609c525d", - "_journal/2024-03-20.md": "9f6ff3e38774f6a90e0dc606b201303d", + "_journal/2024-03-20.md": "2403b0aebe301123192cfa1085f0d874", "_journal/2024-03/2024-03-19.md": "a24995a82bcebcc2b2aa5815a19a8af7", "posix/awk/variables.md": "cc7e912c7fbda552d27e2064d84d15a5", "posix/awk/regexp.md": "46ceac3d5225ea3f3a375d74c2e2e0e9", "posix/awk/index.md": "cac4a1db94f9fc39c5e63ff6994b76aa", - "assembly/x86.md": "ff0f19c990e16008caa34dd51b2693b7", - "assembly/index.md": "0cd9daf2c60c7181b6aec9aaf62a13ba" + "x86-64/assembly.md": "6c4905468f3936ae260b281e2acd7ffc", + "x86-64/index.md": "4769ab45ca374c4225c9c4099220be82", + "_journal/2024-03-21.md": "a2572d2d5be0ee7c7f066d846e2f3e77", + "_journal/2024-03/2024-03-20.md": "0a73ce399d275fe6ee3134a812f3f4f9", + "_journal/2024-03-22.md": "6c14bacf3e8834359f8512b7d7055acc", + "_journal/2024-03/2024-03-21.md": "cd465f71800b080afa5c6bdc75bf9cd3", + "x86-64/declarations.md": "60f5b240ea5565b33dc3585169fc41b1", + "x86-64/instructions.md": "c4b116179d2bd1f9510437e000f9c63d" }, "fields_dict": { "Basic": [ diff --git a/notes/_journal/2024-03-22.md b/notes/_journal/2024-03-22.md new file mode 100644 index 0000000..7043e46 --- /dev/null +++ b/notes/_journal/2024-03-22.md @@ -0,0 +1,14 @@ +--- +title: "2024-03-22" +--- + +- [x] Anki Flashcards +- [x] KoL +- [ ] Sheet Music (10 min.) +- [ ] Go (1 Life & Death Problem) +- [ ] Korean (Read 1 Story) +- [ ] Interview Prep (1 Practice Problem) +- [ ] Log Work Hours (Max 3 hours) + +* Reach section 3.3 of "Computer Systems: A Programmer's Perspective". + * Basic [[x86-64/declarations|Intel data types]] and historical context around their naming. \ No newline at end of file diff --git a/notes/_journal/2024-03-20.md b/notes/_journal/2024-03/2024-03-20.md similarity index 63% rename from notes/_journal/2024-03-20.md rename to notes/_journal/2024-03/2024-03-20.md index d37e152..962fd05 100644 --- a/notes/_journal/2024-03-20.md +++ b/notes/_journal/2024-03/2024-03-20.md @@ -7,14 +7,21 @@ title: "2024-03-20" - [ ] Sheet Music (10 min.) - [ ] Go (1 Life & Death Problem) - [ ] Korean (Read 1 Story) -- [ ] Interview Prep (1 Practice Problem) -- [ ] Log Work Hours (Max 3 hours) +- [x] Interview Prep (1 Practice Problem) +- [x] Log Work Hours (Max 3 hours) * Purged some Anki flashcards with tags: `lua`, `cncf`. In general, want to avoid on this next pass including any sort of flashcards around languages outside of C and: + * Bash * Lean * Nix - * Assembly + * SQL + * x86-64 Assembly + * I also want to avoid learning general syntax (specific gotchas are reasonable) over general concepts where it makes sense. * Made distinctions in flashcards between POSIX `awk` features and GNU `awk` features. Only a few exceptions that may have been misleading so far (GNU's implementation allowing `FS` to be null and `RS` to be a regexp). * Actually, going further, just removing this altogether. I'll continue reading about `awk` but I'm not interested in translating into flashcards unless it turns out I really start using it heavily. * Read Chapter 5 "Printing" in "GAWK: Effective AWK Programming". -* Notes on [[x86]] history. \ No newline at end of file +* Notes on [[instructions]] history. +* Leetcode Problems + * [Pow(x, n)](https://leetcode.com/problems/powx-n/) + * [Group Anagrams](https://leetcode.com/problems/group-anagrams/) +* Basic pass for a type-safe spreadsheet program. \ No newline at end of file diff --git a/notes/_journal/2024-03/2024-03-21.md b/notes/_journal/2024-03/2024-03-21.md new file mode 100644 index 0000000..f42bf93 --- /dev/null +++ b/notes/_journal/2024-03/2024-03-21.md @@ -0,0 +1,15 @@ +--- +title: "2024-03-21" +--- + +- [x] Anki Flashcards +- [x] KoL +- [ ] Sheet Music (10 min.) +- [ ] Go (1 Life & Death Problem) +- [ ] Korean (Read 1 Story) +- [ ] Interview Prep (1 Practice Problem) +- [x] Log Work Hours (Max 3 hours) + +* Talked with Mike about chapter 3 and 4 of "Designing Data-Intensive Applications" +* Finished Level 4 Update for D&D campaign. +* Created the "Hierarchy of Goals" worksheet for the soft-skills course. \ No newline at end of file diff --git a/notes/algebra/radices.md b/notes/algebra/radices.md index e1f3c29..01ecbcc 100644 --- a/notes/algebra/radices.md +++ b/notes/algebra/radices.md @@ -13,7 +13,7 @@ The **radix** is the number of unique digits used to represent numbers in a posi %%ANKI Basic What is the process of subtracting a larger digit from a smaller one in radix $r$? -Back: Decrement the next non-zero and add $r$ to the smaller digit in question. +Back: Decrement the next nonzero and add $r$ to the smaller digit in question. Reference: “Radix,” in *Wikipedia*, August 6, 2023, [https://en.wikipedia.org/w/index.php?title=Radix&oldid=1169046173](https://en.wikipedia.org/w/index.php?title=Radix&oldid=1169046173). END%% diff --git a/notes/algorithms/order-growth.md b/notes/algorithms/order-growth.md index 7b96fd0..01caa82 100644 --- a/notes/algorithms/order-growth.md +++ b/notes/algorithms/order-growth.md @@ -995,7 +995,7 @@ END%% %%ANKI Basic What theorem relates $\Theta(g(n))$, $O(g(n))$, and $\Omega(g(n))$? -Back: $f(n) = \Theta(g(n))$ if and only if $f(n) \in O(g(n))$ and $f(n) \in \Omega(g(n))$. +Back: $f(n) = \Theta(g(n))$ if and only if $f(n) = O(g(n))$ and $f(n) = \Omega(g(n))$. Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). END%% diff --git a/notes/algorithms/sorting/merge-sort.md b/notes/algorithms/sorting/merge-sort.md index 11a4e2b..f220d32 100644 --- a/notes/algorithms/sorting/merge-sort.md +++ b/notes/algorithms/sorting/merge-sort.md @@ -9,14 +9,14 @@ tags: ## Overview -Property | Value ------------ | -------- -Best Case | $\Omega(n\lg{n})$ -Worst Case | $O(n\lg{n})$ -Avg. Case | $O(n\lg{n})$ -Aux. Memory | - -Stable | - -Adaptive | - +| Property | Value | +| ----------- | ----------------- | +| Best Case | $\Omega(n\lg{n})$ | +| Worst Case | $O(n\lg{n})$ | +| Avg. Case | $O(n\lg{n})$ | +| Aux. Memory | $O(n)$ | +| Stable | - | +| Adaptive | - | ![[merge-sort.gif]] @@ -52,6 +52,14 @@ Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition ( END%% +%%ANKI +Basic +How much auxiliary space does `MERGE_SORT` use? +Back: $O(n)$ +Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). + +END%% + %%ANKI Basic What is the "divide" step of `MERGE_SORT`? diff --git a/notes/assembly/index.md b/notes/assembly/index.md deleted file mode 100644 index 09248e4..0000000 --- a/notes/assembly/index.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Assembly -TARGET DECK: Obsidian::STEM -FILE TAGS: asm -tags: - - asm ---- diff --git a/notes/c17/strings.md b/notes/c17/strings.md index ea538ad..8c555ae 100644 --- a/notes/c17/strings.md +++ b/notes/c17/strings.md @@ -80,13 +80,13 @@ Tags: printf END%% -Flag | Description ----- | ----------- -`-` | Left-aligns the output -`+` | Prepends a plus for positive signed-numeric types -`␣` | Prepends a space for positive signed-numeric types -`0` | Prepends zeros for numeric types -`#` | For `g` and `G`, trailing zeros are not removed. For `f`, `F`, `e`, `E`, `g`, and `G`, output always has a decimal point. For `o`, `x`, and `X`, the text `0`, `0x`, and `0X` is prepended to non-zero numbers respectively. +| Flag | Description | +| ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `-` | Left-aligns the output | +| `+` | Prepends a plus for positive signed-numeric types | +| `␣` | Prepends a space for positive signed-numeric types | +| `0` | Prepends zeros for numeric types | +| `#` | For `g` and `G`, trailing zeros are not removed. For `f`, `F`, `e`, `E`, `g`, and `G`, output always has a decimal point. For `o`, `x`, and `X`, the text `0`, `0x`, and `0X` is prepended to nonzero numbers respectively. | %%ANKI Cloze diff --git a/notes/encoding/floating-point.md b/notes/encoding/floating-point.md index 8bddc87..47dc30a 100644 --- a/notes/encoding/floating-point.md +++ b/notes/encoding/floating-point.md @@ -34,7 +34,7 @@ Declaration | Sign Bit | Exponent Field | Fractional Field %%ANKI Basic -In base-10 scientific notation, what form do non-zero numbers take on? +In base-10 scientific notation, what form do nonzero numbers take on? Back: $m \times 10^n$ Reference: “Scientific Notation.” In _Wikipedia_, March 6, 2024. [https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750](https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750). @@ -51,7 +51,7 @@ END%% %%ANKI Basic In base-10 scientific notation, what numbers does $m$ take on in form $m \times 10^n$? -Back: A non-zero real number. +Back: A nonzero real number. Reference: “Scientific Notation.” In _Wikipedia_, March 6, 2024. [https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750](https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750). END%% @@ -90,7 +90,7 @@ END%% %%ANKI Basic -In base-2 scientific notation, what form do non-zero numbers take on? +In base-2 scientific notation, what form do nonzero numbers take on? Back: $m \times 2^n$ Reference: “Scientific Notation.” In _Wikipedia_, March 6, 2024. [https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750](https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750). @@ -107,7 +107,7 @@ END%% %%ANKI Basic In base-2 scientific notation, what numbers does $m$ take on in form $m \times 2^n$? -Back: A non-zero real number. +Back: A nonzero real number. Reference: “Scientific Notation.” In _Wikipedia_, March 6, 2024. [https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750](https://en.wikipedia.org/w/index.php?title=Scientific_notation&oldid=1212169750). END%% @@ -697,7 +697,7 @@ END%% %%ANKI Basic What is the actual bit encoding of floating-point number $NaN$? -Back: An exponent field of all `1`s and a non-zero fractional field. +Back: An exponent field of all `1`s and a nonzero fractional field. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. END%% @@ -1062,7 +1062,7 @@ END%% %%ANKI Basic -How is floating-point `1.40` rounded in round-to-even mode? +How is floating-point `1.40` rounded to an integer in round-to-even mode? Back: `1` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. @@ -1070,7 +1070,7 @@ END%% %%ANKI Basic -How is floating-point `1.50` rounded in round-to-even mode? +How is floating-point `1.50` rounded to an integer in round-to-even mode? Back: `2` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. @@ -1078,7 +1078,7 @@ END%% %%ANKI Basic -How is floating-point `1.60` rounded in round-to-even mode? +How is floating-point `1.60` rounded to an integer in round-to-even mode? Back: `2` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. @@ -1086,7 +1086,7 @@ END%% %%ANKI Basic -How is floating-point `-1.50` rounded in round-to-even mode? +How is floating-point `-1.50` rounded to an integer in round-to-even mode? Back: `-2` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. @@ -1094,7 +1094,7 @@ END%% %%ANKI Basic -How is floating-point `1.40` rounded in round-to-zero mode? +How is floating-point `1.40` rounded to an integer in round-to-zero mode? Back: `1` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. @@ -1102,7 +1102,7 @@ END%% %%ANKI Basic -How is floating-point `1.50` rounded in round-to-zero mode? +How is floating-point `1.50` rounded to an integer in round-to-zero mode? Back: `1` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. @@ -1110,7 +1110,7 @@ END%% %%ANKI Basic -How is floating-point `-1.50` rounded in round-to-zero mode? +How is floating-point `-1.50` rounded to an integer in round-to-zero mode? Back: `-1` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. @@ -1118,7 +1118,7 @@ END%% %%ANKI Basic -How is floating-point `1.40` rounded in round-down mode? +How is floating-point `1.40` rounded to an integer in round-down mode? Back: `1` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. @@ -1126,7 +1126,7 @@ END%% %%ANKI Basic -How is floating-point `1.50` rounded in round-down mode? +How is floating-point `1.50` rounded to an integer in round-down mode? Back: `1` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. @@ -1134,7 +1134,7 @@ END%% %%ANKI Basic -How is floating-point `-1.50` rounded in round-down mode? +How is floating-point `-1.50` rounded to an integer in round-down mode? Back: `-2` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. @@ -1142,7 +1142,7 @@ END%% %%ANKI Basic -How is floating-point `1.40` rounded in round-up mode? +How is floating-point `1.40` rounded to an integer in round-up mode? Back: `2` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. @@ -1150,7 +1150,7 @@ END%% %%ANKI Basic -How is floating-point `1.50` rounded in round-up mode? +How is floating-point `1.50` rounded to an integer in round-up mode? Back: `2` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. @@ -1158,7 +1158,7 @@ END%% %%ANKI Basic -How is floating-point `-1.50` rounded in round-up mode? +How is floating-point `-1.50` rounded to an integer in round-up mode? Back: `-1` Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. @@ -1207,7 +1207,7 @@ END%% %%ANKI Basic How does the IEEE floating-point standard define $1/+0$? -Back: $\infty$ +Back: $+\infty$ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. END%% @@ -1312,7 +1312,7 @@ END%% %%ANKI Basic -What is the result of $x *^f* y$? +What is the result of $x *^f y$? Back: $Round(x * y)$ where $Round$ refers to the current rounding-mode. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. diff --git a/notes/encoding/integer.md b/notes/encoding/integer.md index b727686..9b279f3 100644 --- a/notes/encoding/integer.md +++ b/notes/encoding/integer.md @@ -533,7 +533,7 @@ END%% %%ANKI Basic -Why is two's-complement named the way it is? +Why is it "two's-complement" instead of "twos'-complement"? Back: Because there is only one $2$ in $2^w - x$. Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. diff --git a/notes/set/graphs.md b/notes/set/graphs.md index 01c9d54..284391d 100644 --- a/notes/set/graphs.md +++ b/notes/set/graphs.md @@ -107,7 +107,7 @@ END%% %%ANKI Basic -Let $G = \langle V, E \rangle$ be a undirected graph. What conditions must $E$ satisfy? +Let $G = \langle V, E \rangle$ be an undirected graph. What conditions must $E$ satisfy? Back: It is a set of unordered pairs of vertices. Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022). diff --git a/notes/x86-64/declarations.md b/notes/x86-64/declarations.md new file mode 100644 index 0000000..bb554cb --- /dev/null +++ b/notes/x86-64/declarations.md @@ -0,0 +1,242 @@ +--- +title: Declarations +TARGET DECK: Obsidian::STEM +FILE TAGS: x86-64 +tags: + - x86-64 +--- + +## Overview + +| C Declaration | Intel Data Type | Suffix | Size (bytes) | +| ------------- | ---------------- | ------ | ------------ | +| `char` | Byte | `b` | 1 | +| `short` | Word | `w` | 2 | +| `int` | Double word | `l` | 4 | +| `long` | Quad word | `q` | 8 | +| `char *` | Quad word | `q` | 8 | +| `float` | Single-precision | `s` | 4 | +| `double` | Double-precision | `l` | 8 | + +%%ANKI +Basic +What is the width of a word? +Back: 16 bits. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What historical reason explains why a word is 16 bits? +Back: Because the 8086 that introduced x86 was 16 bits. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What is the width of an Intel "byte"? +Back: $8$ bits +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Which Intel data types are 1 bytes wide? +Back: Just the "byte". +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +The "{byte}" Intel data type has assembly-code suffix {`b`}. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What is the width of an Intel "word"? +Back: $16$ bits +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Which Intel data types are 2 bytes wide? +Back: Just the "word". +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +The "{word}" Intel data type has assembly-code suffix {`w`}. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What is the width of an Intel "double word"? +Back: $32$ bits +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Which Intel data types are 4 bytes wide? +Back: The double word and single-precision. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +The "{double word/double-precision}" Intel data type has assembly-code suffix {`l`}. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +*Why* do double words have assembly-code suffix `l`? +Back: The suffix stands for "long", relative to a 16-bit word. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What is the width of an Intel "quad word"? +Back: $64$ bits +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Which Intel data types are 8 bytes wide? +Back: The quad word and double-precision. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +The "{quad word}" Intel data type has assembly-code suffix {`q`}. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +C integral declaration {`char`} corresponds to Intel data type "{byte}". +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c17 + +END%% + +%%ANKI +Cloze +C integral declaration {`short`} corresponds to Intel data type "{word}". +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c17 + +END%% + +%%ANKI +Cloze +C integral declaration {`int`} corresponds to Intel data type "{double word}". +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c17 + +END%% + +%%ANKI +Cloze +C integral declaration {`long`} corresponds to Intel data type "{quad word}". +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c17 + +END%% + +%%ANKI +Cloze +C declaration `char *` corresponds to Intel data type "{quad word}". +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c17 + +END%% + +%%ANKI +Cloze +C floating-point declaration {`float`} corresponds to Intel data type "{single-precision}". +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c17 + +END%% + +%%ANKI +Cloze +The "{single-precision}" Intel data type has assembly-code suffix {`s`}. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +C floating-point declaration {`double`} corresponds to Intel data type "{double-precision}". +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. +Tags: c17 + +END%% + +%%ANKI +Basic +What is the width of an Intel "singe precision"? +Back: $32$ bits +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What two Intel data types do floating-point numbers come in? +Back: Single-precision and double-precision. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Assembly-code suffix `l` is used for what two Intel data types? +Back: Double words and double-precisions. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What is the width of an Intel "double-precision"? +Back: $64$ bits +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Why is it safe for double words and double-precisions to both use assembly-code suffix `l`? +Back: Floating-point code uses a different set of instructions and registers. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +## References + +* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. diff --git a/notes/assembly/x86.md b/notes/x86-64/index.md similarity index 85% rename from notes/assembly/x86.md rename to notes/x86-64/index.md index ea4edaa..451ecca 100644 --- a/notes/assembly/x86.md +++ b/notes/x86-64/index.md @@ -1,16 +1,54 @@ --- -title: x86 +title: Assembly TARGET DECK: Obsidian::STEM -FILE TAGS: asm::x86 +FILE TAGS: x86-64 tags: - - asm - - x86 + - x86-64 --- ## Overview x86 refers to the architecture first introduced by Intel with their 8086 processor (1978). Intel's i386 (1985), originally named the 80386, expanded the architecture to 32-bits. AMD's Opteron (2003) expanded it again to 64-bits. +%%ANKI +Basic +What *is* an ISA? +Back: A specification describing how a processor behaves. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What is ISA an acronym for? +Back: **I**nstruction **s**et **a**rchitecture. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What is a microarchitecture? +Back: The way an ISA is implemented in a particular processor. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +How is the term "microarchitecture" often abbreviated? +Back: uarch +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Cloze +A {microarchitecture} is an implementation of an {ISA}. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + %%ANKI Basic Which company invented x86? diff --git a/notes/x86-64/instructions.md b/notes/x86-64/instructions.md new file mode 100644 index 0000000..86b6c51 --- /dev/null +++ b/notes/x86-64/instructions.md @@ -0,0 +1,65 @@ +--- +title: Instructions +TARGET DECK: Obsidian::STEM +FILE TAGS: x86-64 +tags: + - x86-64 +--- + +## Overview + +x86-64 instructions are designed so that commonly used instructions and those with fewer operands are encoded in a smaller number of bytes. Instructions range in length from 1 to 15 bytes. + +x86-64 assembly comes in two flavors: ATT and Intel. ATT is most common in Linux systems so I focus on that. The most important distinction between the two is operand ordering: Intel syntax lists multiple operands in reverse order compared to ATT. + +%%ANKI +Basic +x86-64 assembly comes in what two formats? +Back: ATT and Intel. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Which x86-64 assembly format does Linux use? +Back: ATT. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Which x86-64 assembly format does Microsoft use? +Back: Intel. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What is the "most confusing" difference between ATT and Intel assembly? +Back: Multiple operands in one are listed in reverse order relative to the other. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +What term describes assembly lines with a leading `.`? +Back: Directives. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +%%ANKI +Basic +Assembly directives are important for what two programs? +Back: The assembler and the linker. +Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. + +END%% + +## References + +* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016. \ No newline at end of file