mirror of
https://github.com/XunilGroup/XunilOS.git
synced 2026-04-25 19:59:02 +02:00
Add ET_EXEC ELF loading and validation, and a non-working ET_REL
implementation, running support, also basic syscalls to test if it works. add a syscall ABI and a new libxunil ABI for calling back to the kernel with syscalls, add user mode protection when running ELF, add TSS Privilege Stack table to fix GPF issues, add invalid opcode handler, fix rust panics using rectangle_filled instead of fb clear. Also add a hello world example binary that runs in usermode at startup.
This commit is contained in:
@@ -46,3 +46,24 @@ pub fn test_performance<F: FnOnce()>(function: F) {
|
||||
pub fn get_bit(value: u8, position: u8) -> u8 {
|
||||
(value >> position) & 1
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn align_down(addr: u64, align: u64) -> u64 {
|
||||
assert!(align.is_power_of_two(), "`align` must be a power of two");
|
||||
addr & !(align - 1)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub const fn align_up(addr: u64, align: u64) -> u64 {
|
||||
assert!(align.is_power_of_two(), "`align` must be a power of two");
|
||||
let align_mask = align - 1;
|
||||
if addr & align_mask == 0 {
|
||||
addr
|
||||
} else {
|
||||
if let Some(aligned) = (addr | align_mask).checked_add(1) {
|
||||
aligned
|
||||
} else {
|
||||
panic!("attempt to add with overflow")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user