Files
jsix_import/src/boot/loader.h
Justin C. Miller 66abcc57a2 [boot] Build, load, and pass initrd from boot to init
The initrd image is now created by the build system, loaded by the
bootloader, and passed to srv.init, which loads it (but doesn't do
anything with it yet, so this is actually a functional regression).

This simplifies a lot of the modules code between boot and init as well:
Gone are the many subclasses of module and all the data being inline
with the module structs, except for any loaded files. Now the only
modules loaded and passed will be the initrd, and any devices only the
bootloader has knowledge of, like the UEFI framebuffer.
2023-01-28 21:13:52 -08:00

61 lines
1.5 KiB
C++

/// \file loader.h
/// Definitions for loading the kernel into memory
#pragma once
#include <bootproto/init.h>
#include <util/counted.h>
namespace bootproto {
struct program;
}
namespace boot {
class descriptor;
namespace fs {
class file;
}
namespace loader {
/// Load a file from disk into memory.
/// \arg disk The opened UEFI filesystem to load from
/// \arg path The path of the file to load
util::buffer
load_file(
fs::file &disk,
const wchar_t *path);
/// Parse and load an ELF file in memory into a loaded image.
/// \arg disk The opened UEFI filesystem to load from
/// \arg desc The descriptor identifying the program
/// \arg name The human-readable name of the program to load
bootproto::program *
load_program(
fs::file &disk,
const wchar_t *name,
const descriptor &desc);
/// Load a file from disk into memory, creating an init args module
/// \arg disk The opened UEFI filesystem to load from
/// \arg name The human-readable name of the module
/// \arg path The path of the file to load the module from
/// \arg type The major type to set on the module
/// \arg subtype The subtype to set on the module
void
load_module(
fs::file &disk,
const wchar_t *name,
const wchar_t *path,
bootproto::module_type type,
uint16_t subtype);
/// Verify that a loaded ELF has the j6 kernel header
/// \arg program The program to check for a header
void
verify_kernel_header(bootproto::program &program);
} // namespace loader
} // namespace boot