From 2676d69c31db75d8f1444862c13c608b4c3fa542 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Sun, 9 Jul 2023 11:28:31 +0200 Subject: [PATCH] Remove striped output example Doesn't really add much value. --- .../edition-3/posts/02-booting/index.md | 24 ------------------ .../posts/02-booting/qemu-wrapping-add.png | Bin 5083 -> 0 bytes .../edition-3/posts/03-screen-output/index.md | 6 ++--- 3 files changed, 2 insertions(+), 28 deletions(-) delete mode 100644 blog/content/edition-3/posts/02-booting/qemu-wrapping-add.png diff --git a/blog/content/edition-3/posts/02-booting/index.md b/blog/content/edition-3/posts/02-booting/index.md index c59574ac..ab52bd01 100644 --- a/blog/content/edition-3/posts/02-booting/index.md +++ b/blog/content/edition-3/posts/02-booting/index.md @@ -1104,30 +1104,6 @@ We see that our guess that the whole screen would turn gray was right: We finally see some output from our little kernel! -You can try experimenting with the pixel bytes if you like, for example by increasing the pixel value on each loop iteration: - -```rust ,hl_lines=5-9 -// in src/kernel/main.rs - -fn kernel_main(boot_info: &'static mut BootInfo) -> ! { - if let Some(framebuffer) = boot_info.framebuffer.as_mut() { - let mut value = 0x90; - for byte in framebuffer.buffer_mut() { - *byte = value; - value = value.wrapping_add(7); - } - } - loop {} -} -``` - -We use the [`wrapping_add`] method here because Rust panics on implicit integer overflow (at least in debug mode). -The result looks as follows: - -[`wrapping_add`]: https://doc.rust-lang.org/std/primitive.u8.html#method.wrapping_add - -![QEMU showing repeating gradient columns](qemu-wrapping-add.png) - ### Booting on Real Hardware To boot on real hardware, write either the `uefi.img` or the `bios.img` disk image to an USB thumb drive. diff --git a/blog/content/edition-3/posts/02-booting/qemu-wrapping-add.png b/blog/content/edition-3/posts/02-booting/qemu-wrapping-add.png deleted file mode 100644 index fed729be2ccf93fbf6d8ec7b5d7298587fe12c90..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5083 zcmeAS@N?(olHy`uVBq!ia0y~yU{+*cU@GHaVqjo6ULY0Ez`(#8$!(IMR@XLd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zq7KR{8xHm!e+9}sljr@}3Q|~h=E7r8!L(tynmyPe+44hRoj0beyzDh^p3TyoOPB5h zgRLOO(zh2c-MVw@(ydFEZhgzh&CSfs&DD*Hj_zLcm0!;F<41mm2Kz!)*OSNXw^eTW z8yplA6m;vGhHh?kR2T$?g+&ELMO|CAWy_W=Z~ik#{wkh(>Cm}y1_lNOPgg&ebxsLQ E0MKJIZvX%Q diff --git a/blog/content/edition-3/posts/03-screen-output/index.md b/blog/content/edition-3/posts/03-screen-output/index.md index 6f961418..e4862a7e 100644 --- a/blog/content/edition-3/posts/03-screen-output/index.md +++ b/blog/content/edition-3/posts/03-screen-output/index.md @@ -38,7 +38,7 @@ The complete source code for this post can be found in the [`post-3.3`][post bra In the [previous post], we learned how to make our minimal kernel bootable. Using the [`BootInfo`] provided by the bootloader, we were able to access a special memory region called the _[framebuffer]_, which controls the screen output. -We wrote some example code to display a gray stripe pattern: +We wrote some example code to display a gray background: [previous post]: @/edition-3/posts/02-booting/index.md [`BootInfo`]: https://docs.rs/bootloader_api/latest/bootloader_api/info/struct.BootInfo.html @@ -48,10 +48,8 @@ We wrote some example code to display a gray stripe pattern: fn kernel_main(boot_info: &'static mut BootInfo) -> ! { if let Some(framebuffer) = boot_info.framebuffer.as_mut() { - let mut value = 0x90; for byte in framebuffer.buffer_mut() { - *byte = value; - value = value.wrapping_add(7); + *byte = 0x90; } } loop {}