diff options
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | rsdos/src/main.rs | 2 | ||||
| -rw-r--r-- | rsdosedit/Cargo.toml | 2 | ||||
| -rw-r--r-- | rsdosedit/src/lib.rs | 15 | ||||
| -rw-r--r-- | rsnix/src/fat.rs | 6 | ||||
| -rw-r--r-- | rsnix/src/fs.rs | 10 | ||||
| -rw-r--r-- | rsnix/src/interrupts.rs | 4 | ||||
| -rw-r--r-- | rsnix/src/memory.rs | 2 | ||||
| -rw-r--r-- | rsnix/src/paging.rs | 2 | ||||
| -rw-r--r-- | rsnix/src/pci.rs | 6 | ||||
| -rw-r--r-- | rsnix/src/power.rs | 2 | ||||
| -rw-r--r-- | rsnix/src/vt.rs | 8 |
12 files changed, 28 insertions, 33 deletions
| @@ -4,7 +4,7 @@ members = ["rsnix", "shell", "rsdos", "rsdosedit"] | |||
| 4 | 4 | ||
| 5 | [workspace.package] | 5 | [workspace.package] |
| 6 | version = "0.2.0" | 6 | version = "0.2.0" |
| 7 | edition = "2021" | 7 | edition = "2024" |
| 8 | 8 | ||
| 9 | # no_std UEFI kernel: no unwinder available, so panic must abort. | 9 | # no_std UEFI kernel: no unwinder available, so panic must abort. |
| 10 | # (Also makes bare `cargo check`/`cargo build` without --target work.) | 10 | # (Also makes bare `cargo check`/`cargo build` without --target work.) |
diff --git a/rsdos/src/main.rs b/rsdos/src/main.rs index 2ba5d32..a528810 100644 --- a/rsdos/src/main.rs +++ b/rsdos/src/main.rs | |||
| @@ -38,7 +38,7 @@ fn panic(info: &PanicInfo) -> ! { | |||
| 38 | /// The firmware hands us raw pointers (image handle, system table) that | 38 | /// The firmware hands us raw pointers (image handle, system table) that |
| 39 | /// must remain valid for the lifetime of the call — a contract guaranteed | 39 | /// must remain valid for the lifetime of the call — a contract guaranteed |
| 40 | /// by the UEFI loader. | 40 | /// by the UEFI loader. |
| 41 | #[no_mangle] | 41 | #[unsafe(no_mangle)] |
| 42 | pub unsafe extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut SystemTable) -> ! { | 42 | pub unsafe extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut SystemTable) -> ! { |
| 43 | let st = unsafe { &mut *system_table }; | 43 | let st = unsafe { &mut *system_table }; |
| 44 | let bs = unsafe { &mut *st.boot_services }; | 44 | let bs = unsafe { &mut *st.boot_services }; |
diff --git a/rsdosedit/Cargo.toml b/rsdosedit/Cargo.toml index b271eef..92a8123 100644 --- a/rsdosedit/Cargo.toml +++ b/rsdosedit/Cargo.toml | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | name = "rsdosedit" | 2 | name = "rsdosedit" |
| 3 | version = "0.1.0" | 3 | version = "0.1.0" |
| 4 | edition = "2021" | 4 | edition = "2024" |
| 5 | 5 | ||
| 6 | [lints] | 6 | [lints] |
| 7 | workspace = true | 7 | workspace = true |
diff --git a/rsdosedit/src/lib.rs b/rsdosedit/src/lib.rs index cfb3b0e..8f67514 100644 --- a/rsdosedit/src/lib.rs +++ b/rsdosedit/src/lib.rs | |||
| @@ -191,9 +191,15 @@ impl Editor { | |||
| 191 | 191 | ||
| 192 | let help_lines = [ | 192 | let help_lines = [ |
| 193 | ("", ""), | 193 | ("", ""), |
| 194 | (" \u{2550}", "\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}"), | 194 | ( |
| 195 | " \u{2550}", | ||
| 196 | "\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}", | ||
| 197 | ), | ||
| 195 | (" rsedit", " \u{2014} Keybindings"), | 198 | (" rsedit", " \u{2014} Keybindings"), |
| 196 | (" \u{2550}", "\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}"), | 199 | ( |
| 200 | " \u{2550}", | ||
| 201 | "\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}\u{2550}", | ||
| 202 | ), | ||
| 197 | ("", ""), | 203 | ("", ""), |
| 198 | (" Arrow keys", " Move cursor"), | 204 | (" Arrow keys", " Move cursor"), |
| 199 | (" ^\u{2190} / ^\u{2192}", " Word backward/forward"), | 205 | (" ^\u{2190} / ^\u{2192}", " Word backward/forward"), |
| @@ -208,7 +214,10 @@ impl Editor { | |||
| 208 | (" Tab", " Insert spaces (smart tab)"), | 214 | (" Tab", " Insert spaces (smart tab)"), |
| 209 | (" ^S", " Save file"), | 215 | (" ^S", " Save file"), |
| 210 | (" ^W", " Search forward"), | 216 | (" ^W", " Search forward"), |
| 211 | (" ^X", " Exit (twice to discard changes)"), | 217 | ( |
| 218 | " ^X", | ||
| 219 | " Exit (twice to discard changes)", | ||
| 220 | ), | ||
| 212 | (" ^Z", " Suspend editor (job control)"), | 221 | (" ^Z", " Suspend editor (job control)"), |
| 213 | (" ^_", " Undo"), | 222 | (" ^_", " Undo"), |
| 214 | (" ^G", " This help"), | 223 | (" ^G", " This help"), |
diff --git a/rsnix/src/fat.rs b/rsnix/src/fat.rs index 13d19df..335a160 100644 --- a/rsnix/src/fat.rs +++ b/rsnix/src/fat.rs | |||
| @@ -153,11 +153,7 @@ fn is_eoc(c: u32) -> bool { | |||
| 153 | 153 | ||
| 154 | fn next_cluster(c: u32) -> Result<u32, ()> { | 154 | fn next_cluster(c: u32) -> Result<u32, ()> { |
| 155 | let n = read_fat_entry(c); | 155 | let n = read_fat_entry(c); |
| 156 | if is_eoc(n) { | 156 | if is_eoc(n) { Err(()) } else { Ok(n) } |
| 157 | Err(()) | ||
| 158 | } else { | ||
| 159 | Ok(n) | ||
| 160 | } | ||
| 161 | } | 157 | } |
| 162 | 158 | ||
| 163 | /// Allocate a fresh cluster: mark it EOC in the FAT and zero its data. | 159 | /// Allocate a fresh cluster: mark it EOC in the FAT and zero its data. |
diff --git a/rsnix/src/fs.rs b/rsnix/src/fs.rs index 2a1a3e3..a71e51a 100644 --- a/rsnix/src/fs.rs +++ b/rsnix/src/fs.rs | |||
| @@ -92,10 +92,10 @@ fn add(name: &str, parent: Option<usize>, kind: FileType, data: NodeData) -> usi | |||
| 92 | data, | 92 | data, |
| 93 | removed: false, | 93 | removed: false, |
| 94 | }); | 94 | }); |
| 95 | if let Some(p) = parent { | 95 | if let Some(p) = parent |
| 96 | if let NodeData::Dir(v) = &mut nodes()[p].data { | 96 | && let NodeData::Dir(v) = &mut nodes()[p].data |
| 97 | v.push(h); | 97 | { |
| 98 | } | 98 | v.push(h); |
| 99 | } | 99 | } |
| 100 | h | 100 | h |
| 101 | } | 101 | } |
| @@ -224,7 +224,7 @@ pub fn resolve(path: &str) -> Option<usize> { | |||
| 224 | return None; | 224 | return None; |
| 225 | } | 225 | } |
| 226 | let mut cur = 0usize; // root | 226 | let mut cur = 0usize; // root |
| 227 | // (vol, cluster, parent, name) of directories descended into under /disk. | 227 | // (vol, cluster, parent, name) of directories descended into under /disk. |
| 228 | let mut dstack: Vec<(usize, u32, u32, String)> = Vec::new(); | 228 | let mut dstack: Vec<(usize, u32, u32, String)> = Vec::new(); |
| 229 | for seg in path.split('/') { | 229 | for seg in path.split('/') { |
| 230 | match seg { | 230 | match seg { |
diff --git a/rsnix/src/interrupts.rs b/rsnix/src/interrupts.rs index cbd234e..2b82a3d 100644 --- a/rsnix/src/interrupts.rs +++ b/rsnix/src/interrupts.rs | |||
| @@ -256,7 +256,7 @@ struct IntFrame { | |||
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | /// Called from the asm common handler — dispatches to the right Rust handler. | 258 | /// Called from the asm common handler — dispatches to the right Rust handler. |
| 259 | #[no_mangle] | 259 | #[unsafe(no_mangle)] |
| 260 | unsafe extern "C" fn isr_dispatch(frame: &IntFrame) { | 260 | unsafe extern "C" fn isr_dispatch(frame: &IntFrame) { |
| 261 | unsafe { | 261 | unsafe { |
| 262 | match frame.vector { | 262 | match frame.vector { |
| @@ -344,7 +344,7 @@ pub fn init() { | |||
| 344 | // --------------------------------------------------------------------------- | 344 | // --------------------------------------------------------------------------- |
| 345 | // Extern symbols from global_asm! | 345 | // Extern symbols from global_asm! |
| 346 | // --------------------------------------------------------------------------- | 346 | // --------------------------------------------------------------------------- |
| 347 | extern "C" { | 347 | unsafe extern "C" { |
| 348 | fn isr_stub_32(); | 348 | fn isr_stub_32(); |
| 349 | fn isr_stub_33(); | 349 | fn isr_stub_33(); |
| 350 | fn isr_stub_spurious(); | 350 | fn isr_stub_spurious(); |
diff --git a/rsnix/src/memory.rs b/rsnix/src/memory.rs index 54ff7be..7c3eda0 100644 --- a/rsnix/src/memory.rs +++ b/rsnix/src/memory.rs | |||
| @@ -89,7 +89,7 @@ fn align_up(x: usize, a: usize) -> usize { | |||
| 89 | unsafe fn free_list_insert(block: *mut Header) { | 89 | unsafe fn free_list_insert(block: *mut Header) { |
| 90 | let addr = block as usize; | 90 | let addr = block as usize; |
| 91 | let mut prev: *mut Header = ptr::null_mut(); | 91 | let mut prev: *mut Header = ptr::null_mut(); |
| 92 | let mut cur = FREE_LIST; | 92 | let mut cur = unsafe { FREE_LIST }; |
| 93 | while !cur.is_null() && (cur as usize) < addr { | 93 | while !cur.is_null() && (cur as usize) < addr { |
| 94 | prev = cur; | 94 | prev = cur; |
| 95 | cur = unsafe { (*(*cur).links()).next }; | 95 | cur = unsafe { (*(*cur).links()).next }; |
diff --git a/rsnix/src/paging.rs b/rsnix/src/paging.rs index 766bde3..d786dee 100644 --- a/rsnix/src/paging.rs +++ b/rsnix/src/paging.rs | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | // refcounting) — fine for a kernel that owns all memory. | 12 | // refcounting) — fine for a kernel that owns all memory. |
| 13 | // --------------------------------------------------------------------------- | 13 | // --------------------------------------------------------------------------- |
| 14 | 14 | ||
| 15 | use crate::memory::{alloc_pages, free_pages, PAGE_SIZE}; | 15 | use crate::memory::{PAGE_SIZE, alloc_pages, free_pages}; |
| 16 | 16 | ||
| 17 | pub const PAGE_PRESENT: u64 = 1 << 0; | 17 | pub const PAGE_PRESENT: u64 = 1 << 0; |
| 18 | pub const PAGE_WRITABLE: u64 = 1 << 1; | 18 | pub const PAGE_WRITABLE: u64 = 1 << 1; |
diff --git a/rsnix/src/pci.rs b/rsnix/src/pci.rs index efdbc01..21d7536 100644 --- a/rsnix/src/pci.rs +++ b/rsnix/src/pci.rs | |||
| @@ -83,11 +83,7 @@ pub fn bar64(bus: u8, device: u8, func: u8, bar_index: u8) -> Option<u64> { | |||
| 83 | 0 | 83 | 0 |
| 84 | }; | 84 | }; |
| 85 | let base = ((hi as u64) << 32) | (lo as u64 & 0xFFFF_FFF0); | 85 | let base = ((hi as u64) << 32) | (lo as u64 & 0xFFFF_FFF0); |
| 86 | if base == 0 { | 86 | if base == 0 { None } else { Some(base) } |
| 87 | None | ||
| 88 | } else { | ||
| 89 | Some(base) | ||
| 90 | } | ||
| 91 | } | 87 | } |
| 92 | 88 | ||
| 93 | /// Enumerate every device/function present on all buses. | 89 | /// Enumerate every device/function present on all buses. |
diff --git a/rsnix/src/power.rs b/rsnix/src/power.rs index cb5d296..3ca0f25 100644 --- a/rsnix/src/power.rs +++ b/rsnix/src/power.rs | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | // QEMU this makes the VM exit, on real hardware the power drops. | 9 | // QEMU this makes the VM exit, on real hardware the power drops. |
| 10 | // --------------------------------------------------------------------------- | 10 | // --------------------------------------------------------------------------- |
| 11 | 11 | ||
| 12 | use crate::uefi::{RuntimeServices, EFI_SUCCESS, RESET_SHUTDOWN}; | 12 | use crate::uefi::{EFI_SUCCESS, RESET_SHUTDOWN, RuntimeServices}; |
| 13 | 13 | ||
| 14 | static mut RUNTIME_SERVICES: *mut RuntimeServices = core::ptr::null_mut(); | 14 | static mut RUNTIME_SERVICES: *mut RuntimeServices = core::ptr::null_mut(); |
| 15 | 15 | ||
diff --git a/rsnix/src/vt.rs b/rsnix/src/vt.rs index 2cfb0f3..709ea71 100644 --- a/rsnix/src/vt.rs +++ b/rsnix/src/vt.rs | |||
| @@ -224,13 +224,7 @@ fn put_byte(b: u8) { | |||
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | fn param(i: usize, default: usize) -> usize { | 226 | fn param(i: usize, default: usize) -> usize { |
| 227 | unsafe { | 227 | unsafe { if i < NPARAMS { PARAMS[i] } else { default } } |
| 228 | if i < NPARAMS { | ||
| 229 | PARAMS[i] | ||
| 230 | } else { | ||
| 231 | default | ||
| 232 | } | ||
| 233 | } | ||
| 234 | } | 228 | } |
| 235 | 229 | ||
| 236 | /// Place a printable glyph at the cursor and advance (wrapping/scrolling). | 230 | /// Place a printable glyph at the cursor and advance (wrapping/scrolling). |
