Format: Display memory values in hex
This commit is contained in:
parent
74ac9835c3
commit
d1ea875699
@ -53,7 +53,7 @@ You do not need to clean any files after making changes. The `lib`, `kernel`, an
|
||||
### Configuration
|
||||
|
||||
- Variable `LIMINEDIR`: Location of binary files for limine. Default is `/usr/share/limine`.
|
||||
- Variable `TARGET`: rustc target triple to compile for. Default is `x86_64-unknown-none`. Options are listed [here](#targets).
|
||||
- Variable `TARGET`: rustc target triple to compile for. Default is `x86_64-unknown-none`. Options are listed [in the targets section](#targets).
|
||||
- Argument `-p`: Rust build profile to use. Default is `dev`. Options are `dev` and `release`.
|
||||
|
||||
> [!NOTE]
|
||||
@ -70,7 +70,7 @@ Gila has four optional features, which I made optional in anticipation of a pote
|
||||
|
||||
### Targets
|
||||
|
||||
Gila currently supports four different CPU architectures:
|
||||
Gila currently supports four different CPU architectures:
|
||||
|
||||
- `x86_64`
|
||||
- `aarch64`
|
||||
|
@ -1,8 +1,15 @@
|
||||
// Copyright (c) 2025 shibedrill
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#[cfg(not(any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "riscv64", target_arch = "loongarch64")))]
|
||||
compile_error!("Gila does not support compiling for this architecture! Supported architectures are: x86_64, aarch64, riscv64, loongarch64");
|
||||
#[cfg(not(any(
|
||||
target_arch = "x86_64",
|
||||
target_arch = "aarch64",
|
||||
target_arch = "riscv64",
|
||||
target_arch = "loongarch64"
|
||||
)))]
|
||||
compile_error!(
|
||||
"Gila does not support compiling for this architecture! Supported architectures are: x86_64, aarch64, riscv64, loongarch64"
|
||||
);
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub mod x86_64;
|
||||
|
@ -13,30 +13,22 @@ lazy_static! {
|
||||
};
|
||||
}
|
||||
|
||||
// For all these handlers, they will be called from a purely naked ASM
|
||||
// For all these handlers, they will be called from a purely naked ASM
|
||||
// function. That function will first push all registers to the stack.
|
||||
// It is the responsibility of these functions to recover this info.
|
||||
|
||||
// Recoverable exception: Occurs on division failure.
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn x86_divide_error() {
|
||||
|
||||
}
|
||||
pub extern "C" fn x86_divide_error() {}
|
||||
|
||||
// Recoverable exception: Occurs on failure in BOUND instruction.
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn x86_bound_range() {
|
||||
|
||||
}
|
||||
pub extern "C" fn x86_bound_range() {}
|
||||
|
||||
// Recoverable exception: Invalid opcode.
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn x86_invalid_opcode() {
|
||||
|
||||
}
|
||||
pub extern "C" fn x86_invalid_opcode() {}
|
||||
|
||||
// Recoverable exception: FPU not available or enabled.
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn x86_device_unavailable() {
|
||||
|
||||
}
|
||||
pub extern "C" fn x86_device_unavailable() {}
|
||||
|
@ -5,7 +5,7 @@ use core::str;
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
extern "C" fn double_fault(info: *const u8, info_len: usize) -> ! {
|
||||
let info_slice = unsafe {&str::from_raw_parts(info, info_len)};
|
||||
let info_slice = unsafe { &str::from_raw_parts(info, info_len) };
|
||||
panic!("Double fault: {}", info_slice);
|
||||
}
|
||||
|
||||
@ -13,4 +13,4 @@ extern "C" fn double_fault(info: *const u8, info_len: usize) -> ! {
|
||||
pub extern "C" fn page_fault(addr: usize, info: *const u8, info_len: usize) -> ! {
|
||||
let info_slice = unsafe { &str::from_raw_parts(info, info_len) };
|
||||
panic!("Page fault at 0x{:X}: {}", addr, info_slice);
|
||||
}
|
||||
}
|
||||
|
@ -180,9 +180,14 @@ unsafe extern "C" fn main() -> ! {
|
||||
log_trace!("{log_msg}");
|
||||
let total = usable + reclaimable + hardware + unusable;
|
||||
log_info!(
|
||||
"Boot: Memory report:\n\t\tFree: {usable}\n\t\tAvailable: {reclaimable}\n\t\tUsable: {}\n\t\tHardware: {hardware}\n\t\tUnusable: {unusable}\n\t\tTotal: {}",
|
||||
"Boot: Memory report:
|
||||
\tFree: 0x{usable:X}
|
||||
\tAvailable: 0x{reclaimable:X}
|
||||
\tUsable: 0x{:X}
|
||||
\tHardware: 0x{hardware:X}
|
||||
\tUnusable: 0x{unusable:X}
|
||||
\tTotal: 0x{total:X}",
|
||||
usable + reclaimable,
|
||||
total
|
||||
);
|
||||
} else {
|
||||
panic!("Memory map contains no entries");
|
||||
|
Loading…
Reference in New Issue
Block a user