Crate crate_metadata_serde
source ·Expand description
Standalone crate containing (de)serializable types for crate and section metadata.
The primary reason this exists is because LoadedCrate and LoadedSection
make copious usage of Arc and Weak reference-counted pointer types,
which cannot be properly (de)serialized by serde.
The types in this module remove those refcount types so that they can be
reconstructed individually at runtime after deserialization by the crate_metadata crate.
This is currently only used to parse and serialize the nano_core binary at compile time.
The nano_core’s SerializedCrate is then included as a boot module
so it can be deserialized into a LoadedCrate at runtime by mod_mgmt.
Some other types have been moved from crate_metadata into this crate because
they are required for (de)serialization, e.g., SectionType.
Goal: minimal dependencies
This crate’s dependencies should be kept to a bare minimum in order to
minimize the dependencies of the tools/serialize_nano_core executable,
allowing it to build and run quickly.
Thus, instead of using Theseus-specific types here in this crate,
we prefer using types from this crate in other Theseus kernel crates.
For example, instead of implementing the routines to convert a SerializedCrate
into a LoadedCrate here, we implement the routine to create a LoadedCrate
from a SerializedCrate in the mod_mgmt crate itself.
In other words, other larger/complex Theseus crates should depend on this crate
instead of this crate depending on other Theseus crates.
Structs
- A (de)serializable representation of a loaded crate that is
serde-compatible. - A (de)serializable representation of a loaded section that is
serde-compatible.
Enums
- The possible types of sections that can be loaded from a crate object file.
Constants
- The flag identifying CLS sections.
- The type identifying CLS symbols.
Type Aliases
- A Section Header iNDeX (SHNDX), as specified by the ELF format. Even though this is typically encoded as a
u16, its decoded form can exceed the max size ofu16.