[srv.init] Create init server and read init args
Create a new usermode program, srv.init, and have it read the initial module_page args sent to it by the bootloader. Doesn't yet do anything useful but sets up the way for loading the rest of the programs from srv.init. Other (mostly) related changes: - bootloader: The allocator now has a function for allocating init modules out of a modules_page slab. Also changed how the allocator is initialized and passes the allocation register and modules_page list to efi_main(). - bootloader: Expose the simple wstrlen() to the rest of the program - bootloader: Move check_cpu_supported() to hardware.cpp - bootloader: Moved program_desc to loader.h and made the loader functions take it as an argument instead of paths. - kernel: Rename the system_map_mmio syscall to system_map_phys, and stop having it default those VMAs to having the vm_flags::mmio flag. Added a new flag mask, vm_flags::driver_mask, so that drivers can be allowed to ask for the MMIO flag. - kernel: Rename load_simple_process() to load_init_server() and got rid of all the stack setup routines in memory_bootstrap.cpp and task.s - Fixed formatting in config/debug.toml, undefined __linux and other linux-specific defines, and got rid of _LIBCPP_HAS_THREAD_API_EXTERNAL because that's just not true.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
namespace kernel {
|
||||
namespace init {
|
||||
struct program;
|
||||
struct module;
|
||||
}}
|
||||
|
||||
namespace boot {
|
||||
@@ -17,25 +18,37 @@ namespace fs {
|
||||
|
||||
namespace loader {
|
||||
|
||||
struct program_desc
|
||||
{
|
||||
const wchar_t *name;
|
||||
const wchar_t *path;
|
||||
};
|
||||
|
||||
/// Load a file from disk into memory.
|
||||
/// \arg disk The opened UEFI filesystem to load from
|
||||
/// \arg name Name of the module (informational only)
|
||||
/// \arg path Path on `disk` of the file to load
|
||||
/// \arg desc The program descriptor identifying the file
|
||||
buffer
|
||||
load_file(
|
||||
fs::file &disk,
|
||||
const wchar_t *name,
|
||||
const wchar_t *path);
|
||||
const program_desc &desc);
|
||||
|
||||
/// Parse and load an ELF file in memory into a loaded image.
|
||||
/// \arg program The program structure to fill
|
||||
/// \arg name The name of the program being loaded
|
||||
/// \arg data Buffer of the ELF file in memory
|
||||
void
|
||||
/// \arg disk The opened UEFI filesystem to load from
|
||||
/// \arg desc The program descriptor identifying the program
|
||||
/// \arg add_module Also create a module for this loaded program
|
||||
kernel::init::program *
|
||||
load_program(
|
||||
kernel::init::program &program,
|
||||
const wchar_t *name,
|
||||
buffer data);
|
||||
fs::file &disk,
|
||||
const program_desc &desc,
|
||||
bool add_module = false);
|
||||
|
||||
/// Load a file from disk into memory, creating an init args module
|
||||
/// \arg disk The opened UEFI filesystem to load from
|
||||
/// \arg desc The program descriptor identifying the file
|
||||
void
|
||||
load_module(
|
||||
fs::file &disk,
|
||||
const program_desc &desc);
|
||||
|
||||
/// Verify that a loaded ELF has the j6 kernel header
|
||||
/// \arg program The program to check for a header
|
||||
|
||||
Reference in New Issue
Block a user