mirror of
https://github.com/justinian/jsix.git
synced 2025-12-11 08:54:31 -08:00
[boot][kernel] Split programs into sections
To enable setting sections as NX or read-only, the boot program loader now loads programs as lists of sections, and the kernel args are updated accordingly. The kernel's loader now just takes a program pointer to iterate the sections. Also enable NX in IA32_EFER in the bootloader.
This commit is contained in:
@@ -58,6 +58,11 @@ namespace memory {
|
||||
return reinterpret_cast<T*>(a|page_offset);
|
||||
}
|
||||
|
||||
/// Convert a physical address to a virtual one (in the offset-mapped area)
|
||||
template <typename T> T * to_virtual(T *p) {
|
||||
return to_virtual<T>(reinterpret_cast<uintptr_t>(p));
|
||||
}
|
||||
|
||||
/// Get the number of pages needed for a given number of bytes.
|
||||
/// \arg bytes The number of bytes desired
|
||||
/// \returns The number of pages needed to contain the desired bytes
|
||||
|
||||
Reference in New Issue
Block a user