mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
Simple ELF program loader
Now any initrd file is treated like a program image and passed to the loader to load as a process. Very rudimentary elf loading just allocates pages, copies sections, and sets the ELF's entrypoint as the RIP to iretq to.
This commit is contained in:
@@ -34,6 +34,14 @@ public:
|
||||
|
||||
page_manager();
|
||||
|
||||
/// Helper to 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
|
||||
static inline size_t page_count(size_t bytes)
|
||||
{
|
||||
return (bytes - 1) / page_size + 1;
|
||||
}
|
||||
|
||||
/// Helper to read the PML4 table from CR3.
|
||||
/// \returns A pointer to the current PML4 table.
|
||||
static inline page_table * get_pml4()
|
||||
|
||||
Reference in New Issue
Block a user