Compare commits

...

23 Commits

Author SHA1 Message Date
Philipp Oppermann
e9e75e759e Run cargo fmt for post-07 2025-03-27 16:13:37 +01:00
Philipp Oppermann
c6c0e1a7f0 Merge branch 'post-06' into post-07 2025-03-27 16:13:24 +01:00
Philipp Oppermann
c407c26224 Run cargo fmt 2025-03-27 16:13:18 +01:00
Philipp Oppermann
3e814722d0 Merge branch 'post-06' into post-07 2025-03-27 15:51:19 +01:00
Philipp Oppermann
5b088bffeb Update stack_overflow test to use unsafe no_mangle attribute
Required since Rust 2024 edition
2025-03-27 15:51:13 +01:00
Philipp Oppermann
e9ca6b83c4 Merge branch 'post-05' into post-06 2025-03-27 15:50:40 +01:00
Philipp Oppermann
62b2c8a0b5 Merge branch 'post-04' into post-05 2025-03-27 15:50:18 +01:00
Philipp Oppermann
1d0aa17531 Update tests to make no_mangle attribute unsafe
Required since Rust 2024 edition
2025-03-27 15:50:07 +01:00
Philipp Oppermann
08831b4ba1 Merge branch 'post-06' into post-07 2025-03-27 15:13:48 +01:00
Philipp Oppermann
3d94346f43 Merge branch 'post-05' into post-06 2025-03-27 15:13:48 +01:00
Philipp Oppermann
f19372d58a Merge branch 'post-04' into post-05 2025-03-27 15:13:48 +01:00
Philipp Oppermann
e4b3ed6d42 Fix: no_mangle is an unsafe attribute since Rust 2024 2025-03-27 15:13:34 +01:00
Philipp Oppermann
b1aec7eb66 Merge branch 'post-03' into post-04 2025-03-27 15:13:25 +01:00
Philipp Oppermann
e2a3e76a32 Merge branch 'post-02' into post-03 2025-03-27 15:07:41 +01:00
Philipp Oppermann
16bbb8f972 Merge branch 'post-01' into post-02 2025-03-27 15:07:24 +01:00
Philipp Oppermann
430e2143f8 Fix: no_mangle is an unsafe attribute since Rust 2024 2025-03-27 15:06:17 +01:00
Philipp Oppermann
86ffa24e8e Update to Rust 2024 edition 2025-03-27 15:05:58 +01:00
Philipp Oppermann
d83ab74e53 Merge branch 'post-06' into post-07 2025-03-24 11:09:24 +01:00
Philipp Oppermann
caa829db01 Merge branch 'post-05' into post-06 2025-03-24 11:09:24 +01:00
Philipp Oppermann
168dc5c2be Merge branch 'post-04' into post-05 2025-03-24 11:09:24 +01:00
Philipp Oppermann
a6141e8d2e Merge branch 'post-03' into post-04 2025-03-24 11:09:24 +01:00
Philipp Oppermann
df0c0b5783 Merge branch 'post-02' into post-03 2025-03-24 11:09:21 +01:00
Philipp Oppermann
c27eb1da9c Run cargo update for bootloader crate 2025-03-24 11:08:41 +01:00
9 changed files with 13 additions and 13 deletions

4
Cargo.lock generated
View File

@@ -30,9 +30,9 @@ dependencies = [
[[package]] [[package]]
name = "bootloader" name = "bootloader"
version = "0.9.30" version = "0.9.31"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9c8b93781debeb5bc44a12adc4be812aa9feb659d60eeafcd7e9bedb549561" checksum = "974e79cf1b0b737839f01330fb5393095daf1124d52693696494e32523ae9ef5"
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"

View File

@@ -2,7 +2,7 @@
name = "blog_os" name = "blog_os"
version = "0.1.0" version = "0.1.0"
authors = ["Philipp Oppermann <dev@phil-opp.com>"] authors = ["Philipp Oppermann <dev@phil-opp.com>"]
edition = "2018" edition = "2024"
[[test]] [[test]]
name = "should_panic" name = "should_panic"

View File

@@ -1,7 +1,7 @@
use lazy_static::lazy_static; use lazy_static::lazy_static;
use x86_64::VirtAddr;
use x86_64::structures::gdt::{Descriptor, GlobalDescriptorTable, SegmentSelector}; use x86_64::structures::gdt::{Descriptor, GlobalDescriptorTable, SegmentSelector};
use x86_64::structures::tss::TaskStateSegment; use x86_64::structures::tss::TaskStateSegment;
use x86_64::VirtAddr;
pub const DOUBLE_FAULT_IST_INDEX: u16 = 0; pub const DOUBLE_FAULT_IST_INDEX: u16 = 0;
@@ -41,7 +41,7 @@ struct Selectors {
} }
pub fn init() { pub fn init() {
use x86_64::instructions::segmentation::{Segment, CS}; use x86_64::instructions::segmentation::{CS, Segment};
use x86_64::instructions::tables::load_tss; use x86_64::instructions::tables::load_tss;
GDT.0.load(); GDT.0.load();

View File

@@ -66,7 +66,7 @@ extern "x86-interrupt" fn timer_interrupt_handler(_stack_frame: InterruptStackFr
} }
extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStackFrame) { extern "x86-interrupt" fn keyboard_interrupt_handler(_stack_frame: InterruptStackFrame) {
use pc_keyboard::{layouts, DecodedKey, HandleControl, Keyboard, ScancodeSet1}; use pc_keyboard::{DecodedKey, HandleControl, Keyboard, ScancodeSet1, layouts};
use spin::Mutex; use spin::Mutex;
use x86_64::instructions::port::Port; use x86_64::instructions::port::Port;

View File

@@ -72,7 +72,7 @@ pub fn hlt_loop() -> ! {
/// Entry point for `cargo xtest` /// Entry point for `cargo xtest`
#[cfg(test)] #[cfg(test)]
#[no_mangle] #[unsafe(no_mangle)]
pub extern "C" fn _start() -> ! { pub extern "C" fn _start() -> ! {
init(); init();
test_main(); test_main();

View File

@@ -7,7 +7,7 @@
use blog_os::println; use blog_os::println;
use core::panic::PanicInfo; use core::panic::PanicInfo;
#[no_mangle] #[unsafe(no_mangle)]
pub extern "C" fn _start() -> ! { pub extern "C" fn _start() -> ! {
println!("Hello World{}", "!"); println!("Hello World{}", "!");

View File

@@ -7,7 +7,7 @@
use blog_os::println; use blog_os::println;
use core::panic::PanicInfo; use core::panic::PanicInfo;
#[no_mangle] // don't mangle the name of this function #[unsafe(no_mangle)] // don't mangle the name of this function
pub extern "C" fn _start() -> ! { pub extern "C" fn _start() -> ! {
test_main(); test_main();

View File

@@ -1,10 +1,10 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use blog_os::{exit_qemu, serial_print, serial_println, QemuExitCode}; use blog_os::{QemuExitCode, exit_qemu, serial_print, serial_println};
use core::panic::PanicInfo; use core::panic::PanicInfo;
#[no_mangle] #[unsafe(no_mangle)]
pub extern "C" fn _start() -> ! { pub extern "C" fn _start() -> ! {
should_fail(); should_fail();
serial_println!("[test did not panic]"); serial_println!("[test did not panic]");

View File

@@ -2,12 +2,12 @@
#![no_main] #![no_main]
#![feature(abi_x86_interrupt)] #![feature(abi_x86_interrupt)]
use blog_os::{exit_qemu, serial_print, serial_println, QemuExitCode}; use blog_os::{QemuExitCode, exit_qemu, serial_print, serial_println};
use core::panic::PanicInfo; use core::panic::PanicInfo;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame}; use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
#[no_mangle] #[unsafe(no_mangle)]
pub extern "C" fn _start() -> ! { pub extern "C" fn _start() -> ! {
serial_print!("stack_overflow::stack_overflow...\t"); serial_print!("stack_overflow::stack_overflow...\t");