Skip to content

Commit

Permalink
Merge pull request #208 from rust-osdev/dev
Browse files Browse the repository at this point in the history
misc: various improvements
  • Loading branch information
phip1611 authored Apr 2, 2024
2 parents aefff50 + 7a7ac8d commit e8b2e2e
Show file tree
Hide file tree
Showing 18 changed files with 134 additions and 70 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions integration-test/bins/multiboot2_chainloader/src/multiboot.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//! Parsing the Multiboot information. Glue code for the [`multiboot`] code.
use anyhow::anyhow;
use core::ptr::addr_of_mut;
use core::slice;
pub use multiboot::information::ModuleIter;
pub use multiboot::information::Multiboot as Mbi;
use multiboot::information::{MemoryManagement, Multiboot, PAddr, SIGNATURE_EAX};

static mut MEMORY_MANAGEMENT: Mem = Mem;
Expand All @@ -14,7 +13,8 @@ pub fn get_mbi<'a>(magic: u32, ptr: u32) -> anyhow::Result<Multiboot<'a, 'static
if magic != SIGNATURE_EAX {
return Err(anyhow!("Unknown Multiboot signature {magic:x}"));
}
unsafe { Multiboot::from_ptr(ptr as u64, &mut MEMORY_MANAGEMENT) }.ok_or(anyhow!(
let mmgmt: &mut dyn MemoryManagement = unsafe { &mut *addr_of_mut!(MEMORY_MANAGEMENT) };
unsafe { Multiboot::from_ptr(ptr as u64, mmgmt) }.ok_or(anyhow!(
"Can't read Multiboot boot information from pointer"
))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn basic_sanity_checks(mbi: &BootInformation) -> anyhow::Result<()> {
.map_err(anyhow::Error::msg)?
.cmdline()
.map_err(anyhow::Error::msg)?;
assert_eq!(bootloader_name, "GRUB 2.06");
assert!(bootloader_name.starts_with("GRUB 2."));
assert_eq!(cmdline, "some commandline arguments");

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion integration-test/bins/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2023-06-22"
channel = "nightly-2024-03-31" # rustc 1.79-nightly
profile = "default"
components = [
"rust-src",
Expand Down
2 changes: 1 addition & 1 deletion integration-test/bins/x86-unknown-none.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"llvm-target": "i686-unknown-none",
"data-layout": "e-m:e-i32:32-f80:128-n8:16:32-S128-p:32:32",
"data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128",
"arch": "x86",
"target-endian": "little",
"target-pointer-width": "32",
Expand Down
8 changes: 4 additions & 4 deletions integration-test/nix/sources.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"nixpkgs": {
"branch": "nixos-23.05",
"branch": "nixos-23.11",
"description": "Nix Packages collection",
"homepage": null,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ad157fe26e74211e7dde0456cb3fd9ab78b6e552",
"sha256": "0l5gimzlbzq1svw48p4h3wf24ry21icl9198jk5x4xqvs6k2gffx",
"rev": "219951b495fc2eac67b1456824cc1ec1fd2ee659",
"sha256": "065jy7qivlbdqmbvd7r9h97b23f21axmc4r7sqmq2h0j82rmymxv",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/ad157fe26e74211e7dde0456cb3fd9ab78b6e552.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/219951b495fc2eac67b1456824cc1ec1fd2ee659.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}
3 changes: 2 additions & 1 deletion integration-test/tests/multiboot2/build_img.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ cp grub.cfg .vol/boot/grub
cp "$MULTIBOOT2_PAYLOAD_PATH" .vol

# Create a GRUB image with the files in ".vol" being embedded.
grub-mkrescue -o "grub_boot.img" ".vol" 2>/dev/null
echo "Creating bootable image..."
grub-mkrescue -o "grub_boot.img" ".vol"
2 changes: 1 addition & 1 deletion multiboot2-header/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ readme = "README.md"
homepage = "https://github.com/rust-osdev/multiboot2-header"
repository = "https://github.com/rust-osdev/multiboot2"
documentation = "https://docs.rs/multiboot2-header"
rust-version = "1.68"
rust-version = "1.69"

[[example]]
name = "minimal"
Expand Down
20 changes: 14 additions & 6 deletions multiboot2-header/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG for crate `multiboot2-header`

## Unreleased

- added `EndHeaderTag::default()`
- MSRV is 1.69

## 0.3.2 (2023-11-30)

- **BREAKING** bumped `multiboot2` dependency to `v0.19.0`
Expand All @@ -13,7 +18,7 @@

## 0.3.0 (2023-06-23)

- **BREAKING** MSRV is 1.68.0
- **BREAKING** MSRV is 1.68.0 (UPDATE: This is actually 1.69.)
- **BREAKING** renamed the `std` feature to `alloc`
- **BREAKING** bumped `multiboot2` dependency to `v0.16.0`
- **BREAKING** renamed `MULTIBOOT2_HEADER_MAGIC` to `MAGIC`
Expand All @@ -22,20 +27,23 @@
- **BREAKING** `HeaderBuilder::build` now returns a value of type `HeaderBytes`
The old builder could produce misaligned structures.
- added the optional `unstable` feature (requires nightly)
- implement `core::error::Error` for `LoadError`
- implement `core::error::Error` for `LoadError`

## 0.2.0 (2022-05-03)

- **BREAKING** renamed `EntryHeaderTag` to `EntryAddressHeaderTag`
- **BREAKING** some paths changed from `multiboot2_header::header` to `multiboot2_header::builder`
-> thus, import paths are much more logically now
- **BREAKING** some paths changed from `multiboot2_header::header`
to `multiboot2_header::builder`
-> thus, import paths are much more logically now
- internal code improvements

## 0.1.1 (2022-05-02)

- fixed a bug that prevented the usage of the crate in `no_std` environments
- added a new default `builder`-feature to Cargo which requires the `alloc`-crate
(this feature can be disabled which will also remove the dependency to the `alloc` crate)
- added a new default `builder`-feature to Cargo which requires the `alloc`
-crate
(this feature can be disabled which will also remove the dependency to
the `alloc` crate)

## 0.1.0 (2021-10-08)

Expand Down
6 changes: 6 additions & 0 deletions multiboot2-header/src/end.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ pub struct EndHeaderTag {
size: u32,
}

impl Default for EndHeaderTag {
fn default() -> Self {
Self::new()
}
}

impl EndHeaderTag {
pub const fn new() -> Self {
EndHeaderTag {
Expand Down
1 change: 0 additions & 1 deletion multiboot2-header/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::{
HeaderTag, HeaderTagISA, HeaderTagType, InformationRequestHeaderTag, ModuleAlignHeaderTag,
RelocatableHeaderTag,
};
use core::convert::TryInto;
use core::fmt::{Debug, Formatter};
use core::mem::size_of;

Expand Down
8 changes: 6 additions & 2 deletions multiboot2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ readme = "README.md"
homepage = "https://github.com/rust-osdev/multiboot2"
repository = "https://github.com/rust-osdev/multiboot2"
documentation = "https://docs.rs/multiboot2"
rust-version = "1.68"
rust-version = "1.69"

[features]
default = ["builder"]
Expand All @@ -45,7 +45,11 @@ bitflags.workspace = true
derive_more.workspace = true
log.workspace = true

uefi-raw = { version = "0.3", default-features = false }
# We only use a very basic type definition from this crate. To prevent MSRV
# bumps from uefi-raw, I restrict this here. Upstream users are likely to have
# two versions of this library in it, which is no problem, as we only use the
# type definition.
uefi-raw = { version = "=0.3", default-features = false }
ptr_meta = { version = "0.2", default-features = false }

[package.metadata.docs.rs]
Expand Down
Loading

0 comments on commit e8b2e2e

Please sign in to comment.