diff --git a/Cargo.lock b/Cargo.lock index 736aff1..1812e83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,7 +4,7 @@ version = 4 [[package]] name = "libsys" -version = "0.2.0" +version = "0.2.1" dependencies = [ "num_enum", "spin", diff --git a/Cargo.toml b/Cargo.toml index 1186936..59b5781 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libsys" -version = "0.2.0" +version = "0.2.1" edition = "2024" [dependencies] diff --git a/src/syscall/klog.rs b/src/syscall/klog.rs index 3f0da6f..f825957 100644 --- a/src/syscall/klog.rs +++ b/src/syscall/klog.rs @@ -1,10 +1,21 @@ +use core::str::Utf8Error; + use crate::syscall::{Vector, syscall_2}; #[repr(usize)] #[derive(Debug, Error, IntoPrimitive, TryFromPrimitive)] pub enum Error { - #[error("provided log string was not mapped into memory")] + #[error("log string was not mapped into memory")] NotMapped = 1, + + #[error("log string was invalid UTF-8")] + InvalidUtf8 = 2, +} + +impl From for Error { + fn from(_: Utf8Error) -> Self { + Self::InvalidUtf8 + } } /// Logs a trace-level message to the kernel journal.