From 48974ec63eda963be27a005819741413bf43aa9b Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 18 Jul 2019 10:21:08 +0200 Subject: [PATCH] Update posts to bootloader 0.6.4 --- .../posts/02-minimal-rust-kernel/index.md | 2 +- .../posts/09-paging-implementation/index.md | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md b/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md index cb927d5f..ebeffcc8 100644 --- a/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md +++ b/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md @@ -361,7 +361,7 @@ Instead of writing our own bootloader, which is a project on its own, we use the # in Cargo.toml [dependencies] -bootloader = "0.6.0" +bootloader = "0.6.4" ``` Adding the bootloader as dependency is not enough to actually create a bootable disk image. The problem is that we need to link our kernel with the bootloader after compilation, but cargo has no support for [post-build scripts]. diff --git a/blog/content/second-edition/posts/09-paging-implementation/index.md b/blog/content/second-edition/posts/09-paging-implementation/index.md index 7dc03506..bb9055ed 100644 --- a/blog/content/second-edition/posts/09-paging-implementation/index.md +++ b/blog/content/second-edition/posts/09-paging-implementation/index.md @@ -47,11 +47,11 @@ To implement the approach, we will need support from the bootloader, so we'll co ### Dependency Updates -This post requires version 0.6.0 or later of the `bootloader` dependency and version 0.6.0 or later of the `x86_64` dependency. You can update the dependencies in your `Cargo.toml`: +This post requires version 0.6.4 or later of the `bootloader` dependency and version 0.6.0 or later of the `x86_64` dependency. You can update the dependencies in your `Cargo.toml`: ```toml [dependencies] -bootloader = "0.6.0" +bootloader = "0.6.4" x86_64 = "0.6.0" ``` @@ -305,7 +305,7 @@ We choose the first approach for our kernel since it is simple, platform-indepen ```toml [dependencies] -bootloader = { version = "0.6.0", features = ["map_physical_memory"]} +bootloader = { version = "0.6.4", features = ["map_physical_memory"]} ``` With this feature enabled, the bootloader maps the complete physical memory to some unused virtual address range. To communicate the virtual address range to our kernel, the bootloader passes a _boot information_ structure. @@ -341,7 +341,7 @@ Since our `_start` function is called externally from the bootloader, no checkin To make sure that the entry point function has always the correct signature that the bootloader expects, the `bootloader` crate provides an [`entry_point`] macro that provides a type-checked way to define a Rust function as the entry point. Let's rewrite our entry point function to use this macro: -[`entry_point`]: https://docs.rs/bootloader/0.6.0/bootloader/macro.entry_point.html +[`entry_point`]: https://docs.rs/bootloader/0.6.4/bootloader/macro.entry_point.html ```rust // in src/main.rs @@ -917,7 +917,7 @@ This function uses iterator combinator methods to transform the initial `MemoryM - The next step is the most complicated: We convert each range to an iterator through the `into_iter` method and then choose every 4096th address using [`step_by`]. Since 4096 bytes (= 4 KiB) is the page size, we get the start address of each frame. The bootloader page aligns all usable memory areas so that we don't need any alignment or rounding code here. By using [`flat_map`] instead of `map`, we get an `Iterator` instead of an `Iterator>`. - Finally, we convert the start addresses to `PhysFrame` types to construct the desired `Iterator`. We then use this iterator to create and return a new `BootInfoFrameAllocator`. -[`MemoryRegion`]: https://docs.rs/bootloader/0.6.0/bootloader/bootinfo/struct.MemoryRegion.html +[`MemoryRegion`]: https://docs.rs/bootloader/0.6.4/bootloader/bootinfo/struct.MemoryRegion.html [`filter`]: https://doc.rust-lang.org/core/iter/trait.Iterator.html#method.filter [`map`]: https://doc.rust-lang.org/core/iter/trait.Iterator.html#method.map [range syntax]: https://doc.rust-lang.org/core/ops/struct.Range.html