Skip to content

Commit 4ffb04f

Browse files
committed
workspace: init multiboot2-common member
1 parent b6dda27 commit 4ffb04f

File tree

6 files changed

+347
-0
lines changed

6 files changed

+347
-0
lines changed

Cargo.lock

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
resolver = "2"
33
members = [
44
"multiboot2",
5+
"multiboot2-common",
56
"multiboot2-header",
67
]
78
exclude = [

multiboot2-common/Cargo.toml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[package]
2+
name = "multiboot2-common"
3+
description = """
4+
5+
"""
6+
version = "0.1.0"
7+
authors = [
8+
"Philipp Schuster <[email protected]>"
9+
]
10+
license = "MIT/Apache-2.0"
11+
edition = "2021"
12+
categories = [
13+
"no-std",
14+
"parsing",
15+
]
16+
keywords = [
17+
"Multiboot2",
18+
"kernel",
19+
"boot",
20+
"bootloader",
21+
]
22+
readme = "README.md"
23+
homepage = "https://github.com/rust-osdev/multiboot2"
24+
repository = "https://github.com/rust-osdev/multiboot2"
25+
documentation = "https://docs.rs/multiboot2-common"
26+
#rust-version = "1.70"
27+
28+
[features]
29+
30+
31+
[dependencies]
32+
33+
[package.metadata.docs.rs]
34+
all-features = true

multiboot2-common/Changelog.md

Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,275 @@
1+
# CHANGELOG for crate `multiboot2`
2+
3+
## Unreleased
4+
5+
-
6+
7+
## 0.21.0 (2024-08-17)
8+
9+
This release contains a massive refactoring of various internals. Now, **all
10+
unit tests pass Miri**, thus we removed lots of undefined behaviour and
11+
increased the memory safety! 🎉 Only a small part of these internal refactorings
12+
leak to the public interface. If you don't provide external custom tags, you
13+
should be fine.
14+
15+
Please note that **all previous releases** must be considered unsafe, as they
16+
contain UB. However, it is never clear how UB results in immediate incorrect
17+
behaviour and it _might_ work. **Nevertheless, please migrate to the latest
18+
release and you'll be fine!**
19+
20+
All previous releases on crates.io have been yanked.
21+
22+
- **Breaking:** All functions that returns something useful are
23+
now `#[must_use]`
24+
- **Breaking:** More public fields in tags were replaced by public getters, such
25+
as `SmbiosTag::major()`
26+
- **Breaking:** Methods of `InformationBuilder` to add tags now consume
27+
references instead of owned values
28+
- **Breaking:** The `BoxedDst` has been removed in favor of a normal Rust `Box`.
29+
This only affects you if you use the `builder` feature.
30+
- **Breaking:** MSRV is 1.75
31+
- **Breaking:** Introduced new `TagHeader` type as replacement for the `Tag`
32+
type that will be changed in the next step. `Tag` has been renamed to an
33+
internal-only `GenericTag` type.
34+
- Added missing `InformationBuilder::vbe_info_tag`
35+
- documentation enhancements
36+
- updated dependencies
37+
38+
## 0.20.2 (2024-05-26)
39+
40+
- fix Debug implementation of `EfiMemoryMapTag`
41+
42+
## 0.20.1 (2024-05-26)
43+
44+
- fixed the handling of `EFIMemoryMapTag` and `EFIMemoryAreaIter`
45+
- **BREAKING** Fixed wrong creation of `EFIMemoryMapTag`.
46+
`EFIMemoryMapTag::new` was replaced by `EFIMemoryMapTag::new_from_descs` and
47+
`EFIMemoryMapTag::new_from_map`.
48+
- `ModuleTag::new`'s `end` parameter now must be bigger than `start`.
49+
50+
## 0.20.0 (2024-05-01)
51+
52+
- added `InformationBuilder::default()`
53+
- MSRV is 1.70
54+
55+
## 0.19.0 (2023-09-21)
56+
57+
- **BREAKING** MSRV is 1.69.0
58+
- **BREAKING** `Tag::get_dst_str_slice` renamed to
59+
`Tag::parse_slice_as_string` and now returns `Result<&str, StringError>`
60+
- **BREAKING** `BootLoaderNameTag::name` now returns `Result<&str, StringError>`
61+
- **BREAKING** `CommandLineTag::cmdline` now returns `Result<&str, StringError>`
62+
- **BREAKING** `ModuleTag::cmdline` now returns `Result<&str, StringError>`
63+
- Introduced new enum type `StringError`
64+
- Additionally, a bug was fixed in `parse_slice_as_string` which now parses
65+
multiboot2 strings as expected: as null-terminated UTF-8 strings.
66+
- `InformationBuilder` now also allows to add custom tags. The new public method
67+
`add_tag` was introduced for that.
68+
69+
## 0.18.1 (2023-07-13)
70+
71+
- Documentation improvements
72+
73+
## 0.18.0 (2023-07-13)
74+
75+
- **BREAKING** The `TagTrait` was enhanced and now has an associated `ID`
76+
constant. This is only breaking to users that used `BootInformation::get_tag`
77+
or that implement custom tags. `BootInformation::get_tag` doesn't need the
78+
`typ` parameter anymore, as it can be deduced from the provided type.
79+
- **BREAKING** `BoxedDst::new` doesn't have the `typ` parameter anymore. This
80+
only effects you when you wrote a custom DST tag.
81+
- **BREAKING** Removed deprecated functions `load` and `load_with_offset`. Use
82+
`BootInformation::load` instead.
83+
- **BREAKING** Renamed `BootInformation::efi_32_ih_tag` to
84+
`BootInformation::efi_ih32_tag` for consistency.
85+
- **BREAKING** Renamed `BootInformation::efi_64_ih_tag` to
86+
`BootInformation::efi_ih64_tag` for consistency.
87+
- **BREAKING** Renamed `BootInformation::efi_std_32_tag` to
88+
`BootInformation::efi_std32_tag` for consistency.
89+
- **BREAKING** Renamed `BootInformation::efi_std_64_tag` to
90+
`BootInformation::efi_std64_tag` for consistency.
91+
- Better debug output of `BootInformation` and `MemoryArea`
92+
- Internal code cleanup.
93+
94+
## 0.17.0 (2023-07-12)
95+
96+
- **BREAKING** Make functions of `InformationBuilder` chainable. They now
97+
consume the builder.
98+
- **BREAKING** Allow non-standard memory area types by using new pair of
99+
corresponding types: `MemoryAreaTypeId` and `MemoryAreaType`.
100+
101+
## 0.16.0 (2023-06-23)
102+
103+
- **BREAKING** renamed `MULTIBOOT2_BOOTLOADER_MAGIC` to `MAGIC`
104+
- **BREAKING** `EFIMemoryDesc` was removed and is now an alias of
105+
`uefi_raw::table::boot::MemoryDescriptor`
106+
- **BREAKING** `EFIMemoryAreaType` was removed and is now an alias of
107+
`uefi_raw::table::boot::MemoryType`
108+
- **BREAKING** MSRV is 1.68.0
109+
- **BREAKING** Removed `MemoryAreaIter`
110+
and `MemoryMapTag::available_memory_areas`
111+
- **BREAKING** Renamed `BootInformation::load_base_addr`
112+
to `BootInformation::load_base_addr_tag`
113+
- **BREAKING** Renamed `BootInformation::efi_32_ih`
114+
to `BootInformation::efi_32_ih_tag`
115+
- **BREAKING** Renamed `BootInformation::efi_32_ih`
116+
to `BootInformation::efi_32_ih_tag`
117+
- **BREAKING** Renamed `ImageLoadPhysAddr` to `ImageLoadPhysAddrTag`
118+
- **BREAKING** Renamed `EFIImageHandle32` to `EFIImageHandle32Tag`
119+
- **BREAKING** Renamed `EFIImageHandle64` to `EFIImageHandle64Tag`
120+
- **BREAKING** Renamed `EFISdt32` to `EFISdt32Tag`
121+
- **BREAKING** Renamed `EFISdt64` to `EFISdt64Tag`
122+
- **BREAKING** Renamed `EFIBootServicesNotExited`
123+
to `EFIBootServicesNotExitedTag`
124+
- **BREAKING** Renamed `CommandLineTag::command_line` renamed
125+
to `CommandLineTag::cmdline`
126+
- **\[Might be\] BREAKING** Added `TagTrait` trait which enables to use DSTs as
127+
multiboot2 tags. This is
128+
mostly relevant for the command line tag, the modules tag, and the bootloader
129+
name tag. However, this might also be relevant for users of custom multiboot2
130+
tags that use DSTs as types. See the example provided in the doc of the
131+
`get_tag` method.
132+
- added a `builder` feature and a `builder` module with a
133+
`builder::InformationBuilder` struct
134+
- added `BootInformation::efi_bs_not_exited_tag`
135+
- deprecated `load` and `load_with_offset`
136+
- added `BootInformation::load` as new default constructor
137+
- added `MemoryMapTag::entry_size` and `MemoryMapTag::entry_version`
138+
139+
## 0.15.1 (2023-03-18)
140+
141+
- **BREAKING** `MemoryMapTag::all_memory_areas()` was renamed to `memory_areas`
142+
and now returns `MemoryAreaIter` instead of
143+
`impl Iterator<Item = &MemoryArea>`. Experience showed that its better to
144+
return the specific iterator whenever possible.
145+
- **BREAKING** `MemoryMapTag::memory_areas()` was renamed to
146+
`available_memory_areas`
147+
(_Sorry for the breaking changes in a minor release, but I just stumbled upon
148+
this und since the last breaking release was just yesterday, users have to
149+
deal with changes anyway._)
150+
- **BREAKING** `ElfSection::name()` now returns a Result instead of just the
151+
value. This prevents possible panics.
152+
- fix: prevent a possible panic in `ElfSection::section_type()`
153+
154+
## 0.15.0 (2023-03-17)
155+
156+
- **BREAKING** MSRV is 1.56.1
157+
- **BREAKING** fixed lifetime issues: `VBEInfoTag` is no longer `&static`
158+
- **BREAKING:** `TagType` is now split into `TagTypeId` and `TagType`
159+
- `TagTypeId` is a binary-compatible form of a Multiboot2 tag id
160+
- `TagType` is a higher-level abstraction for either specified or custom
161+
tags
162+
but not ABI compatible.
163+
- There exists a seamless integration between `u32`, `TagType`, and
164+
`TagTypeId` via `From` and `PartialEq`-implementations.
165+
- fixed another internal lifetime issue
166+
- `BootInformation::framebuffer_tag()` now returns
167+
`Option<Result<FramebufferTag, UnknownFramebufferType>>` instead of
168+
`Option<FramebufferTag>` which prevents a possible panic. If the `--unstable`
169+
feature is used, `UnknownFramebufferType` implements `core::error::Error`.
170+
- Fixed misleading documentation of the `BootInformation::efi_memory_map_tag`
171+
- `BootInformation` now publicly exports the `get_tag` function allowing you to
172+
work with custom tags. An example is given in the function documentation.
173+
(check docs.rs). There is also a small unit test that you can use to learn
174+
from.
175+
176+
## 0.14.2 (2023-03-17)
177+
178+
- documentation fixes
179+
- `MbiLoadError` now implements `Display`
180+
- Added the `unstable` feature, which enables nightly-only functionality.
181+
With this feature, `MbiLoadError` now implements `core::error::Error` and can
182+
be used with `anyhow::Result` for example.
183+
184+
## 0.14.1 (2023-03-09)
185+
186+
- fixed the calculation of the last area of the memory map
187+
tag ([#119](https://github.com/rust-osdev/multiboot2/pull/119))
188+
(Previously, iterating the EFI Memory map resulted in a superfluous entry as
189+
it ran over the next tag)
190+
191+
## 0.14.0 (2022-06-30)
192+
193+
- **BREAKING CHANGES** \
194+
This version includes a few small breaking changes that brings more safety
195+
when parsing strings from the
196+
multiboot information structure.
197+
- `BootLoaderNameTag::name` now returns a Result instead of just the value
198+
- `CommandLineTag::command_line` now returns a Result instead of just the
199+
value
200+
- `ModuleTag::cmdline` now returns a Result instead of just the value
201+
- `RsdpV1Tag::signature` now returns a Result instead of an Option
202+
- `RsdpV1Tag::oem_id` now returns a Result instead of an Option
203+
- `RsdpV2Tag::signature` now returns a Result instead of an Option
204+
- `RsdpV2Tag::oem_id` now returns a Result instead of an Option
205+
- internal code improvements
206+
207+
## 0.13.3 (2022-06-03)
208+
209+
- impl `Send` for `BootInformation`
210+
211+
## 0.13.2 (2022-05-02)
212+
213+
- `TagType` now implements `Ord` so that it can be used in `BTreeSet`
214+
- small internal improvements and restructuring of the code (no breaking changes
215+
to public API)
216+
217+
## 0.13.1 (2022-01-09)
218+
219+
- minor fix
220+
221+
## 0.13.0 (**yanked**)
222+
223+
- added missing getters for tag `ImageLoadPhysAddr`
224+
- added missing getters for tags `EFIImageHandle32` and `EFIImageHandle64`
225+
226+
## 0.12.2 (2021-10-02)
227+
228+
- `TagType` now implements `Eq` and `Hash`
229+
- internal improvements
230+
- `std` can be used in tests; the crate is still `no_std`
231+
- this implies that `cargo test` doesn't work on "non-standard" targets
232+
- CI (Ubuntu) still works.
233+
- code formatting/style
234+
- sensible style checks as optional CI job
235+
- `.editorconfig` file
236+
- prepared co-existence of crates `multiboot2` and `multiboot2-header`
237+
in a Cargo workspace inside the same repository
238+
239+
## 0.12.1 (2021-08-11)
240+
241+
- `TagType`-enum introduced in `v0.11` is now actually public
242+
- internal code improvements
243+
244+
## 0.12.0 (2021-08-06)
245+
246+
- **breaking:** `load()` and `load_with_offset` now returns a result
247+
- added public constant `MULTIBOOT2_BOOTLOADER_MAGIC`
248+
- Rust edition 2018 (instead of 2015)
249+
- internal code improvements
250+
251+
## 0.11.0 (2021-07-07)
252+
253+
- **breaking:** iterator functions (e.g. `ElfSectionsTag::sections()`)
254+
return `impl Iterator` instead of a concrete type
255+
- lib now contains `TagType`-enum that contains
256+
all possible mbi tags that are specified (taken from spec)
257+
- much improved debug-formatting of `BootInformation`
258+
- internal code improvements / formatting
259+
260+
## 0.10.0 (2020-11-03)
261+
262+
- allow access to all memory regions (MemoryMap-Tag)
263+
- internal code improvements
264+
265+
## 0.9.0 (2020-07-06)
266+
267+
- Add a `checksum_is_valid` method to the RSDP
268+
tags ([#64](https://github.com/rust-osdev/multiboot2/pull/64))
269+
270+
## 0.8.2 (2022-03-02)
271+
272+
- Add some basic
273+
documentation ([#62](https://github.com/rust-osdev/multiboot2/pull/62))
274+
- Add MemoryAreaType, to allow users to access memory area types in a type-safe
275+
way ([#61](https://github.com/rust-osdev/multiboot2/pull/61))

multiboot2-common/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# multiboot2-common

multiboot2-common/src/lib.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//! Common helpers for the `multiboot2` and `multiboot2-header` crates.
2+
//!
3+
//! The main objective here is to encapsulate the memory-sensible part of
4+
//! parsing and iterating Multiboot2 structures. This crate empowers
5+
//! `multiboot2` and `multiboot2-header` to use rusty types for the
6+
//! corresponding structures, such as non-trait DSTs (structs with a
7+
//! terminating `[u8]` field). The abstractions can be used for:
8+
//! - multiboot2:
9+
//! - boot information structure (whole)
10+
//! - boot information tags
11+
//! - multiboot2-header:
12+
//! - header structure (whole)
13+
//! - header tags
14+
//!
15+
//! Not meant as stable public API for others.
16+
17+
#![no_std]
18+
// --- BEGIN STYLE CHECKS ---
19+
#![deny(
20+
clippy::all,
21+
clippy::cargo,
22+
clippy::nursery,
23+
clippy::must_use_candidate,
24+
// clippy::restriction,
25+
// clippy::pedantic
26+
)]
27+
// now allow a few rules which are denied by the above statement
28+
// --> They are either ridiculous, not necessary, or we can't fix them.
29+
#![deny(missing_docs)]
30+
#![deny(missing_debug_implementations)]
31+
#![deny(rustdoc::all)]
32+
// --- END STYLE CHECKS ---

0 commit comments

Comments
 (0)