Skip to content

Commit 513ee94

Browse files
authored
Merge pull request #526 from spencer3035/update-to-2024-edition
Code changes to update to 2024 edition
2 parents 707db11 + 4e9b53d commit 513ee94

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+148
-149
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ license.workspace = true
55
version.workspace = true
66
repository.workspace = true
77
authors = ["Philipp Oppermann <dev@phil-opp.com>"]
8-
edition = "2021"
8+
edition = "2024"
99

1010
[workspace]
1111
members = [

api/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "bootloader_api"
33
license.workspace = true
44
version.workspace = true
55
repository.workspace = true
6-
edition = "2021"
6+
edition = "2024"
77
description = "Makes a kernel compatible with the bootloader crate"
88

99
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

api/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ macro_rules! entry_point {
114114
};
115115
($path:path, config = $config:expr) => {
116116
const _: () = {
117-
#[link_section = ".bootloader-config"]
117+
#[unsafe(link_section = ".bootloader-config")]
118118
pub static __BOOTLOADER_CONFIG: [u8; $crate::BootloaderConfig::SERIALIZED_LEN] = {
119119
// validate the type
120120
let config: &$crate::BootloaderConfig = $config;
@@ -125,7 +125,7 @@ macro_rules! entry_point {
125125
static __BOOTLOADER_CONFIG_REF: &[u8; $crate::BootloaderConfig::SERIALIZED_LEN] =
126126
&__BOOTLOADER_CONFIG;
127127

128-
#[export_name = "_start"]
128+
#[unsafe(export_name = "_start")]
129129
pub extern "C" fn __impl_start(boot_info: &'static mut $crate::BootInfo) -> ! {
130130
// validate the signature of the program entry point
131131
let f: fn(&'static mut $crate::BootInfo) -> ! = $path;

bios/boot_sector/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "bootloader-x86_64-bios-boot-sector"
33
version.workspace = true
44
authors = ["Philipp Oppermann <dev@phil-opp.com>"]
5-
edition = "2021"
5+
edition = "2024"
66
license.workspace = true
77
repository.workspace = true
88
description = "BIOS boot sector for the `bootloader` crate"

bios/boot_sector/src/fail.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl<T, E> UnwrapOrFail for Result<T, E> {
2828
}
2929
}
3030

31-
#[no_mangle]
31+
#[unsafe(no_mangle)]
3232
pub extern "C" fn print_char(c: u8) {
3333
let ax = u16::from(c) | 0x0e00;
3434
unsafe {
@@ -38,7 +38,7 @@ pub extern "C" fn print_char(c: u8) {
3838

3939
#[cold]
4040
#[inline(never)]
41-
#[no_mangle]
41+
#[unsafe(no_mangle)]
4242
pub extern "C" fn fail(code: u8) -> ! {
4343
print_char(b'!');
4444
print_char(code);

bios/boot_sector/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mod dap;
1111
mod fail;
1212
mod mbr;
1313

14-
extern "C" {
14+
unsafe extern "C" {
1515
static _partition_table: u8;
1616
static _second_stage_start: u8;
1717
}
@@ -25,7 +25,7 @@ fn second_stage_start() -> *const () {
2525
ptr as *const ()
2626
}
2727

28-
#[no_mangle]
28+
#[unsafe(no_mangle)]
2929
pub extern "C" fn first_stage(disk_number: u16) {
3030
// read partition table and look for second stage partition
3131
let partition_table = unsafe { slice::from_raw_parts(partition_table_raw(), 16 * 4) };

bios/common/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "bootloader-x86_64-bios-common"
33
version.workspace = true
4-
edition = "2021"
4+
edition = "2024"
55
license.workspace = true
66
repository.workspace = true
77
description = "Common code for BIOS stages of the `bootloader` crate"

bios/stage-2/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "bootloader-x86_64-bios-stage-2"
33
version.workspace = true
44
authors = ["Philipp Oppermann <dev@phil-opp.com>"]
5-
edition = "2021"
5+
edition = "2024"
66
license.workspace = true
77
repository.workspace = true
88
description = "Second BIOS stage of the `bootloader` crate"

bios/stage-2/src/dap.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,22 @@ impl DiskAddressPacket {
3737

3838
pub unsafe fn perform_load(&self, disk_number: u16) {
3939
let self_addr = self as *const Self as u16;
40-
asm!(
41-
"push 'z'", // error code `z`, passed to `fail` on error
42-
"mov {1:x}, si",
43-
"mov si, {0:x}",
44-
"int 0x13",
45-
"jnc 2f", // carry is set on fail
46-
"call fail",
47-
"2:",
48-
"pop si", // remove error code again
49-
"mov si, {1:x}",
50-
in(reg) self_addr,
51-
out(reg) _,
52-
in("ax") 0x4200u16,
53-
in("dx") disk_number,
54-
);
40+
unsafe {
41+
asm!(
42+
"push 'z'", // error code `z`, passed to `fail` on error
43+
"mov {1:x}, si",
44+
"mov si, {0:x}",
45+
"int 0x13",
46+
"jnc 2f", // carry is set on fail
47+
"call fail",
48+
"2:",
49+
"pop si", // remove error code again
50+
"mov si, {1:x}",
51+
in(reg) self_addr,
52+
out(reg) _,
53+
in("ax") 0x4200u16,
54+
in("dx") disk_number,
55+
);
56+
}
5557
}
5658
}

bios/stage-2/src/disk.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ impl Read for DiskAccess {
1515
static mut TMP_BUF: AlignedArrayBuffer<1024> = AlignedArrayBuffer {
1616
buffer: [0; 512 * 2],
1717
};
18+
#[allow(static_mut_refs)]
1819
let buf = unsafe { &mut TMP_BUF };
1920
assert!(current_sector_offset + len <= buf.buffer.len());
2021

0 commit comments

Comments
 (0)