Adds initializers and documentation about them.#60
Closed
Conversation
Member
Author
|
...whoops, turns out init.h snuck into trunk via #21 ( ab4bf40#diff-b9407181d3f79476016f05a3d1f404b8b30b2f22ec4b028e9c3ce7f255a582ec ) already... |
Member
Author
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Right now, just the cycle time and timestamp for boot. These are pretty attacker-guessable, but better than nothing. This will be used to generate XOR cookies to initialize the heap with. We usually get better entropy from U-Boot once we process the Devicetree, so the RNG will reseed at that point. Signed-off-by: Nathan Ringo <me@remexre.com>
This heap-allocates the Devicetree, so we don't need to keep the FDT structure reserved. It also includes the memory reservations block in the Devicetree proper, under the /reserved-memory node. This still needs to be fully integrated; e.g. by: - Adding RAM to the allocators. - Adding /chosen/rng-seed to the entropy pool. - Creating devices from nodes. This has been tested and works on the Milk-V Duo S. Signed-off-by: Nathan Ringo <me@remexre.com>
It gets removed from the Devicetree to reduce the chances that an attacker could discover it later. This is maybe kinda moot though, because of how resistant the entropy pool is to attacks based on that. Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Tested in QEMU and the Milk-V Duo S. Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
These are for use in a treap implementation; arguably there should be a "fast but lower-quality" RNG for this kind of usecase, but we really don't want people e.g. using it when it would introduce a DoS attack. Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
The page fault handler, among other things, will need it. Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
This currently only supports 4KiB pages with Sv39. Signed-off-by: Nathan Ringo <me@remexre.com>
This results in more readable output from the `info mem` command in QEMU, since allocations are more often contiguous. Signed-off-by: Nathan Ringo <me@remexre.com>
This is like Linux's, but uses static_assert to give a better compile error when the given field is not an array. Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
At this point, allocation works but freeing is a no-op. Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
bdab406 to
26f1d83
Compare
Member
Author
3e71307 to
f3dd58d
Compare
- page_collect shouldn't assume that the page has an empty free list, but neither should it do O(n) work when it does not. - After page_free, alloc_generic should not refer to the page anymore. Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
Signed-off-by: Nathan Ringo <me@remexre.com>
f3dd58d to
30c9a56
Compare
Member
Author
|
Actually, closing this; the device model PR should supersede it. The notion of device classes in this PR is not the right thing for now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On top of #50; merge that one first, then rebase this.
Initializers are a way for drivers to get code to run without needing to jam more code into
main.This is not yet finished; it needs an example of use, and is probably blocked on #50's overhaul of the Devicetree parser. I'm making a draft PR to get feedback, though.