mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[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.
This commit is contained in:
@@ -13,27 +13,32 @@ public:
|
||||
using type = bootproto::module_type;
|
||||
using module = bootproto::module;
|
||||
|
||||
module_iterator(const module *m, type t = type::none) :
|
||||
m_mod {m}, m_type {t} {}
|
||||
module_iterator(const bootproto::modules_page *p, unsigned i, type t = type::none) :
|
||||
m_page {p}, m_idx {i}, m_type {t} {
|
||||
if ( t != type::none && p && deref()->type != t ) operator++();
|
||||
}
|
||||
|
||||
const module * operator++();
|
||||
const module * operator++(int);
|
||||
|
||||
bool operator==(const module* m) const { return m == m_mod; }
|
||||
bool operator!=(const module* m) const { return m != m_mod; }
|
||||
bool operator==(const module_iterator &i) const { return i.m_mod == m_mod; }
|
||||
bool operator!=(const module_iterator &i) const { return i.m_mod != m_mod; }
|
||||
bool operator==(const module* m) const { return m == deref(); }
|
||||
bool operator!=(const module* m) const { return m != deref(); }
|
||||
bool operator==(const module_iterator &i) const { return i.deref() == deref(); }
|
||||
bool operator!=(const module_iterator &i) const { return i.deref() != deref(); }
|
||||
|
||||
const module & operator*() const { return *m_mod; }
|
||||
operator const module & () const { return *m_mod; }
|
||||
const module * operator->() const { return m_mod; }
|
||||
const module & operator*() const { return *deref(); }
|
||||
operator const module & () const { return *deref(); }
|
||||
const module * operator->() const { return deref(); }
|
||||
|
||||
// Allow iterators to be used in for(:) statments
|
||||
module_iterator & begin() { return *this; }
|
||||
module_iterator end() const { return nullptr; }
|
||||
module_iterator end() const { return {nullptr, 0}; }
|
||||
|
||||
private:
|
||||
module const * m_mod;
|
||||
inline const module * deref() const { return m_page ? &m_page->modules[m_idx] : nullptr; }
|
||||
|
||||
unsigned m_idx;
|
||||
bootproto::modules_page const *m_page;
|
||||
type m_type;
|
||||
};
|
||||
|
||||
@@ -48,15 +53,15 @@ public:
|
||||
j6_handle_t system,
|
||||
j6_handle_t self);
|
||||
|
||||
iterator of_type(type t) const { return iterator {m_root, t}; }
|
||||
iterator of_type(type t) const { return iterator {m_root, 0, t}; }
|
||||
|
||||
iterator begin() const { return iterator {m_root}; }
|
||||
iterator end() const { return nullptr; }
|
||||
iterator begin() const { return iterator {m_root, 0}; }
|
||||
iterator end() const { return {nullptr, 0}; }
|
||||
|
||||
private:
|
||||
using module = bootproto::module;
|
||||
|
||||
modules(const module* root) : m_root {root} {}
|
||||
modules(const bootproto::modules_page* root) : m_root {root} {}
|
||||
|
||||
const module *m_root;
|
||||
const bootproto::modules_page *m_root;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user