mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
[init] Go back to boot modules having inline data
In order to pass along arguments like the framebuffer, it's far simpler to have that data stored along with the modules than mapping new pages for every structure. Also now optionally pass a module's data to a driver as init starts it.
This commit is contained in:
@@ -3,10 +3,13 @@
|
||||
/// Data structures describing bootloader-passed framebuffer
|
||||
|
||||
#include <util/counted.h>
|
||||
#include <util/hash.h>
|
||||
|
||||
namespace bootproto {
|
||||
namespace devices {
|
||||
|
||||
inline constexpr uint64_t type_id_uefi_fb = "uefi.fb"_id;
|
||||
|
||||
enum class fb_layout : uint8_t { rgb8, bgr8, unknown = 0xff };
|
||||
|
||||
struct video_mode
|
||||
|
||||
@@ -11,29 +11,21 @@
|
||||
namespace bootproto {
|
||||
|
||||
enum class module_type : uint8_t { none, initrd, device, };
|
||||
enum class initrd_format : uint8_t { none, zstd, };
|
||||
enum class device_type : uint16_t { none, uefi_fb, };
|
||||
|
||||
struct module
|
||||
{
|
||||
module_type type;
|
||||
// 1 byte padding
|
||||
uint16_t subtype;
|
||||
// 4 bytes padding
|
||||
util::buffer data;
|
||||
uint16_t bytes; //< Size of this module in bytes, including this header
|
||||
module_type type; //< Type of module
|
||||
// 5 bytes padding
|
||||
uint64_t type_id; //< Optional subtype or id
|
||||
|
||||
template <typename T> T * data() { return reinterpret_cast<T*>(this+1); }
|
||||
template <typename T> const T * data() const { return reinterpret_cast<const T*>(this+1); }
|
||||
};
|
||||
|
||||
struct module_page_header
|
||||
struct modules_page
|
||||
{
|
||||
uint8_t count;
|
||||
uintptr_t next;
|
||||
};
|
||||
|
||||
struct modules_page :
|
||||
public module_page_header
|
||||
{
|
||||
static constexpr unsigned per_page = (0x1000 - sizeof(module_page_header)) / sizeof(module);
|
||||
module modules[per_page];
|
||||
modules_page *next;
|
||||
};
|
||||
|
||||
} // namespace bootproto
|
||||
|
||||
Reference in New Issue
Block a user