Notes on caller- and callee-saved registers.
parent
faaf57cb96
commit
bb6343317d
|
@ -263,7 +263,7 @@
|
||||||
"algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2",
|
"algorithms/loop-invariants.md": "cbefc346842c21a6cce5c5edce451eb2",
|
||||||
"algorithms/loop-invariant.md": "3b390e720f3b2a98e611b49a0bb1f5a9",
|
"algorithms/loop-invariant.md": "3b390e720f3b2a98e611b49a0bb1f5a9",
|
||||||
"algorithms/running-time.md": "5efc0791097d2c996f931c9046c95f65",
|
"algorithms/running-time.md": "5efc0791097d2c996f931c9046c95f65",
|
||||||
"algorithms/order-growth.md": "1e5cbdfd9dea80ba284db3589f55e65f",
|
"algorithms/order-growth.md": "434073572a080e423c1bf464806c6d65",
|
||||||
"_journal/2024-02-08.md": "19092bdfe378f31e2774f20d6afbfbac",
|
"_journal/2024-02-08.md": "19092bdfe378f31e2774f20d6afbfbac",
|
||||||
"algorithms/sorting/selection-sort.md": "73415c44d6f4429f43c366078fd4bf98",
|
"algorithms/sorting/selection-sort.md": "73415c44d6f4429f43c366078fd4bf98",
|
||||||
"algorithms/index 1.md": "6fada1f3d5d3af64687719eb465a5b97",
|
"algorithms/index 1.md": "6fada1f3d5d3af64687719eb465a5b97",
|
||||||
|
@ -395,12 +395,12 @@
|
||||||
"_journal/2024-03/2024-03-15.md": "e54b2513beac5f46313b4c37622adf39",
|
"_journal/2024-03/2024-03-15.md": "e54b2513beac5f46313b4c37622adf39",
|
||||||
"_journal/2024-03-17.md": "72e99c7630085aee2c7f340a06b5ada7",
|
"_journal/2024-03-17.md": "72e99c7630085aee2c7f340a06b5ada7",
|
||||||
"_journal/2024-03/2024-03-16.md": "ab7629c24ebe70838072cf6acec47cb0",
|
"_journal/2024-03/2024-03-16.md": "ab7629c24ebe70838072cf6acec47cb0",
|
||||||
"encoding/floating-point.md": "3331bce1aaf94e0cf5d21d62af386d04",
|
"encoding/floating-point.md": "4e7a91995a82b6ce796b291de6a0c2bc",
|
||||||
"_journal/2024-03-18.md": "8479f07f63136a4e16c9cd07dbf2f27f",
|
"_journal/2024-03-18.md": "8479f07f63136a4e16c9cd07dbf2f27f",
|
||||||
"_journal/2024-03/2024-03-17.md": "23f9672f5c93a6de52099b1b86834e8b",
|
"_journal/2024-03/2024-03-17.md": "23f9672f5c93a6de52099b1b86834e8b",
|
||||||
"set/directed-graph.md": "b4b8ad1be634a0a808af125fe8577a53",
|
"set/directed-graph.md": "b4b8ad1be634a0a808af125fe8577a53",
|
||||||
"set/index.md": "29f5f295765101fe11d821faa908b027",
|
"set/index.md": "29f5f295765101fe11d821faa908b027",
|
||||||
"set/graphs.md": "de5817ecac06f006c7f985cc1b45f67a",
|
"set/graphs.md": "cf09e6b0aaf61bc461f4fd3787dab682",
|
||||||
"_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb",
|
"_journal/2024-03-19.md": "a0807691819725bf44c0262405e97cbb",
|
||||||
"_journal/2024-03/2024-03-18.md": "2c711c50247a9880f7ed0d33b16e1101",
|
"_journal/2024-03/2024-03-18.md": "2c711c50247a9880f7ed0d33b16e1101",
|
||||||
"awk/variables.md": "e40a20545358228319f789243d8b9f77",
|
"awk/variables.md": "e40a20545358228319f789243d8b9f77",
|
||||||
|
@ -526,7 +526,7 @@
|
||||||
"set/axioms.md": "063955bf19c703e9ad23be2aee4f1ab7",
|
"set/axioms.md": "063955bf19c703e9ad23be2aee4f1ab7",
|
||||||
"_journal/2024-05-14.md": "f6ece1d6c178d57875786f87345343c5",
|
"_journal/2024-05-14.md": "f6ece1d6c178d57875786f87345343c5",
|
||||||
"_journal/2024-05/2024-05-13.md": "d549dd75fb42b4280d4914781edb0113",
|
"_journal/2024-05/2024-05-13.md": "d549dd75fb42b4280d4914781edb0113",
|
||||||
"x86-64/registers.md": "89a6a1f731c643b6b72ff6a93e895a10",
|
"x86-64/registers.md": "a1daead80c55434c0aed939c53103f9d",
|
||||||
"_journal/2024-05-15.md": "4e6a7e6df32e93f0d8a56bc76613d908",
|
"_journal/2024-05-15.md": "4e6a7e6df32e93f0d8a56bc76613d908",
|
||||||
"_journal/2024-05/2024-05-14.md": "f6ece1d6c178d57875786f87345343c5",
|
"_journal/2024-05/2024-05-14.md": "f6ece1d6c178d57875786f87345343c5",
|
||||||
"_journal/2024-05-16.md": "580c7ec61ec56be92fa8d6affcf0a5f6",
|
"_journal/2024-05-16.md": "580c7ec61ec56be92fa8d6affcf0a5f6",
|
||||||
|
@ -673,7 +673,7 @@
|
||||||
"_journal/2024-07-13.md": "13b5101306b5542b8a1381a6477378ca",
|
"_journal/2024-07-13.md": "13b5101306b5542b8a1381a6477378ca",
|
||||||
"_journal/2024-07/2024-07-12.md": "8073584fae2fe7bffcd4b69a7cd29058",
|
"_journal/2024-07/2024-07-12.md": "8073584fae2fe7bffcd4b69a7cd29058",
|
||||||
"hashing/static.md": "3ec6eaee73fb9b599700f5a56b300b83",
|
"hashing/static.md": "3ec6eaee73fb9b599700f5a56b300b83",
|
||||||
"hashing/addressing.md": "c068221b70d2e37b8978951e1b91acd9",
|
"hashing/addressing.md": "d00477899acfdb87c7f5d4e6493faa58",
|
||||||
"ontology/index.md": "0994403dcd84415f1459752129b55f65",
|
"ontology/index.md": "0994403dcd84415f1459752129b55f65",
|
||||||
"ontology/permissivism.md": "643e815a79bc5c050cde9f996aa44ef5",
|
"ontology/permissivism.md": "643e815a79bc5c050cde9f996aa44ef5",
|
||||||
"ontology/properties.md": "91ece501551c444afcd119d7197958ef",
|
"ontology/properties.md": "91ece501551c444afcd119d7197958ef",
|
||||||
|
@ -788,7 +788,7 @@
|
||||||
"_journal/2024-08/2024-08-21.md": "1637b8ec8475cf3eb4f41d1d86cbf5df",
|
"_journal/2024-08/2024-08-21.md": "1637b8ec8475cf3eb4f41d1d86cbf5df",
|
||||||
"_journal/2024-08/2024-08-20.md": "e8bec308d1b29e411c6799ace7ef6571",
|
"_journal/2024-08/2024-08-20.md": "e8bec308d1b29e411c6799ace7ef6571",
|
||||||
"_journal/2024-08-23.md": "3b2feab2cc927e267263cb1e9c173d50",
|
"_journal/2024-08-23.md": "3b2feab2cc927e267263cb1e9c173d50",
|
||||||
"set/natural-numbers.md": "6219f07da2d79fba29bb16bcd2f48ce2",
|
"set/natural-numbers.md": "3a49690199a943ca8038040278060585",
|
||||||
"_journal/2024-08-24.md": "563fad24740e44734a87d7c3ec46cec4",
|
"_journal/2024-08-24.md": "563fad24740e44734a87d7c3ec46cec4",
|
||||||
"_journal/2024-08/2024-08-23.md": "7b5a40e83d8f07ff54cd9708017d029c",
|
"_journal/2024-08/2024-08-23.md": "7b5a40e83d8f07ff54cd9708017d029c",
|
||||||
"_journal/2024-08/2024-08-22.md": "050235d5dc772b542773743b57ce3afe",
|
"_journal/2024-08/2024-08-22.md": "050235d5dc772b542773743b57ce3afe",
|
||||||
|
@ -798,7 +798,7 @@
|
||||||
"c17/basic-types.md": "7c6653bf6dc24c2f2aa72fc95c4f7875",
|
"c17/basic-types.md": "7c6653bf6dc24c2f2aa72fc95c4f7875",
|
||||||
"c17/types/simple.md": "44d56a2998f3bba578f14672c8b0ee3c",
|
"c17/types/simple.md": "44d56a2998f3bba578f14672c8b0ee3c",
|
||||||
"c17/types/enumerated.md": "e1f70a30677c776b7b44ac3e0ff4e76d",
|
"c17/types/enumerated.md": "e1f70a30677c776b7b44ac3e0ff4e76d",
|
||||||
"c17/types/derived.md": "ac1651775cc1a75247da176627fcf421",
|
"c17/types/derived.md": "7e5d0939f72ee02ae00a78a2af17a0fd",
|
||||||
"c17/types/basic.md": "5064e21e683c0218890058882e06b6f3",
|
"c17/types/basic.md": "5064e21e683c0218890058882e06b6f3",
|
||||||
"c17/types/index.md": "14b651bcfc8b2d62ffd200a74a9a2a6b",
|
"c17/types/index.md": "14b651bcfc8b2d62ffd200a74a9a2a6b",
|
||||||
"_journal/2024-08-25.md": "e73a8edbd027d0f1a39289540eb512f2",
|
"_journal/2024-08-25.md": "e73a8edbd027d0f1a39289540eb512f2",
|
||||||
|
@ -931,7 +931,16 @@
|
||||||
"geometry/cartesian.md": "b7003f70ab4822aa6eb4b84ba35f6e65",
|
"geometry/cartesian.md": "b7003f70ab4822aa6eb4b84ba35f6e65",
|
||||||
"geometry/index.md": "679dcd097f4bebe417828c695444c88c",
|
"geometry/index.md": "679dcd097f4bebe417828c695444c88c",
|
||||||
"_journal/2024-11-10.md": "5478337fd2017b99d0b359713a511e66",
|
"_journal/2024-11-10.md": "5478337fd2017b99d0b359713a511e66",
|
||||||
"_journal/2024-11/2024-11-09.md": "46f3a640223ef533f4523837b67b57c3"
|
"_journal/2024-11/2024-11-09.md": "46f3a640223ef533f4523837b67b57c3",
|
||||||
|
"_journal/2024-11-18.md": "5567592053951cee80450cf582df270a",
|
||||||
|
"_journal/2024-11/2024-11-17.md": "76f5c49cb9b8722bbdac76a5e87f688c",
|
||||||
|
"_journal/2024-11/2024-11-16.md": "db4f2e5db5bb1d2199fee88eb1a6c881",
|
||||||
|
"_journal/2024-11/2024-11-15.md": "db4f2e5db5bb1d2199fee88eb1a6c881",
|
||||||
|
"_journal/2024-11/2024-11-14.md": "db4f2e5db5bb1d2199fee88eb1a6c881",
|
||||||
|
"_journal/2024-11/2024-11-13.md": "db4f2e5db5bb1d2199fee88eb1a6c881",
|
||||||
|
"_journal/2024-11/2024-11-12.md": "24c858a93c0a5063820bd96207e6f8ab",
|
||||||
|
"_journal/2024-11/2024-11-11.md": "d3ad8ddc5ecdb2cc08773fdef2ce6869",
|
||||||
|
"_journal/2024-11/2024-11-10.md": "38ce405754e3823c8239df44546f3b35"
|
||||||
},
|
},
|
||||||
"fields_dict": {
|
"fields_dict": {
|
||||||
"Basic": [
|
"Basic": [
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
title: "2024-11-18"
|
||||||
|
---
|
||||||
|
|
||||||
|
- [ ] Anki Flashcards
|
||||||
|
- [x] KoL
|
||||||
|
- [ ] OGS
|
||||||
|
- [ ] Sheet Music (10 min.)
|
||||||
|
- [ ] Korean (Read 1 Story)
|
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
title: "2024-11-18"
|
||||||
|
---
|
||||||
|
|
||||||
|
- [x] Anki Flashcards
|
||||||
|
- [x] KoL
|
||||||
|
- [ ] OGS
|
||||||
|
- [ ] Sheet Music (10 min.)
|
||||||
|
- [ ] Korean (Read 1 Story)
|
|
@ -1195,7 +1195,7 @@ END%%
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
What is the reflexive property of $\omega$-notation?
|
What is the reflexive property of $\omega$-notation?
|
||||||
Back: N/A
|
Back: N/A.
|
||||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
<!--ID: 1709752223537-->
|
<!--ID: 1709752223537-->
|
||||||
END%%
|
END%%
|
||||||
|
|
|
@ -1026,6 +1026,62 @@ Tags: x86-64
|
||||||
<!--ID: 1730740461670-->
|
<!--ID: 1730740461670-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Suppose `char *p` has address `S`. What is the result of the following?
|
||||||
|
```c
|
||||||
|
(int *) p + 7
|
||||||
|
```
|
||||||
|
Back: `S + 28`
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1731942192201-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Suppose `char *p` has address `S`. What is the result of the following?
|
||||||
|
```c
|
||||||
|
(int *) (p + 7)
|
||||||
|
```
|
||||||
|
Back: `S + 7`
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1731942192210-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
How do we declare a function pointer `fp` to the following?
|
||||||
|
```c
|
||||||
|
int foo(int x, int *p);
|
||||||
|
```
|
||||||
|
Back:
|
||||||
|
```c
|
||||||
|
int (*fp)(int, int *);
|
||||||
|
```
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1731942192213-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What do the following two lines declare instances of?
|
||||||
|
```c
|
||||||
|
int (*fp)(int, int *);
|
||||||
|
int *fp(int, int *);
|
||||||
|
```
|
||||||
|
Back: The first is a function pointer. The second is a function.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1731942192218-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What is the value of a function pointer?
|
||||||
|
Back: The address of the first instruction in the function's machine-code representation.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1731942192229-->
|
||||||
|
END%%
|
||||||
|
|
||||||
## Bibliography
|
## Bibliography
|
||||||
|
|
||||||
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
* Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
|
|
@ -1325,8 +1325,8 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
What is the most important group quality $+^f$ is lacking?
|
What are the most important group qualities $+^f$ is lacking?
|
||||||
Back: Associativity.
|
Back: Associativity and commutativity.
|
||||||
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
<!--ID: 1710680824824-->
|
<!--ID: 1710680824824-->
|
||||||
END%%
|
END%%
|
||||||
|
|
|
@ -546,7 +546,7 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
When is the load factor of a open addressing hash table $1$?
|
When does the load factor of an open addressing hash table equal $1$?
|
||||||
Back: When there exist the same number of total entries as slots.
|
Back: When there exist the same number of total entries as slots.
|
||||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
<!--ID: 1718759188182-->
|
<!--ID: 1718759188182-->
|
||||||
|
|
|
@ -961,7 +961,7 @@ END%%
|
||||||
Basic
|
Basic
|
||||||
What are the paths from vertex $3$ to vertex $6$?
|
What are the paths from vertex $3$ to vertex $6$?
|
||||||
![[directed-graph-example.png]]
|
![[directed-graph-example.png]]
|
||||||
Back: N/A
|
Back: N/A.
|
||||||
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
Reference: Thomas H. Cormen et al., Introduction to Algorithms, Fourth edition (Cambridge, Massachusett: The MIT Press, 2022).
|
||||||
<!--ID: 1710807788332-->
|
<!--ID: 1710807788332-->
|
||||||
END%%
|
END%%
|
||||||
|
|
|
@ -291,7 +291,7 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
What can be said about a subset of $\omega$?
|
What can be said about subsets of $\omega$?
|
||||||
Back: N/A.
|
Back: N/A.
|
||||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
<!--ID: 1724606314394-->
|
<!--ID: 1724606314394-->
|
||||||
|
@ -299,8 +299,8 @@ END%%
|
||||||
|
|
||||||
%%ANKI
|
%%ANKI
|
||||||
Basic
|
Basic
|
||||||
What can be said about an inductive subset of $\omega$?
|
What can be said about inductive subsets of $\omega$?
|
||||||
Back: It must coincide with $\omega$.
|
Back: They must coincide with $\omega$.
|
||||||
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
Reference: Herbert B. Enderton, *Elements of Set Theory* (New York: Academic Press, 1977).
|
||||||
<!--ID: 1724606314396-->
|
<!--ID: 1724606314396-->
|
||||||
END%%
|
END%%
|
||||||
|
|
|
@ -307,6 +307,54 @@ Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Program
|
||||||
<!--ID: 1728558297568-->
|
<!--ID: 1728558297568-->
|
||||||
END%%
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Which number-suffixed register(s) are used for passing integral arguments to procedures?
|
||||||
|
Back: `%r8` and `%r9`.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1731938810848-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Which number-suffixed register(s) are conventionally designated "callee-saved"?
|
||||||
|
Back: `%r12`, `%13`, `%r14`, and `%r15`.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1731938810852-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
Which number-suffixed register(s) are conventionally designated "caller-saved"?
|
||||||
|
Back: `%r10` and `%r11`.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1731938810854-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What does it mean for a register to be callee-saved?
|
||||||
|
Back: The callee must ensure the register's value is unchanged by the time it returns.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1731938810857-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
What does it mean for a register to be caller-saved?
|
||||||
|
Back: Any procedure can modify the register's value.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1731938810860-->
|
||||||
|
END%%
|
||||||
|
|
||||||
|
%%ANKI
|
||||||
|
Basic
|
||||||
|
*Why* are caller-saved registers named the way they are?
|
||||||
|
Back: It's up to the caller to preserve their value before a procedure call.
|
||||||
|
Reference: Bryant, Randal E., and David O'Hallaron. *Computer Systems: A Programmer's Perspective*. Third edition, Global edition. Always Learning. Pearson, 2016.
|
||||||
|
<!--ID: 1731938810863-->
|
||||||
|
END%%
|
||||||
|
|
||||||
## Condition Codes
|
## Condition Codes
|
||||||
|
|
||||||
The CPU also maintains a set of single-bit **condition code** registers describing attributes of the most recent arithmetic or logical operation.
|
The CPU also maintains a set of single-bit **condition code** registers describing attributes of the most recent arithmetic or logical operation.
|
||||||
|
|
Loading…
Reference in New Issue