Update kernel args to be module-based

- The old kernel_args structure is now mostly represented as a series of
  'modules' or memory ranges, tagged with a type. An arbitrary number
  can be passed to the kernel
- Update bootloader to allocate space for the args header and 10 module
  descriptors
This commit is contained in:
Justin C. Miller
2020-02-23 00:07:50 -08:00
parent ec563ea8e4
commit 6f5a2a3d3f
3 changed files with 115 additions and 68 deletions

View File

@@ -4,44 +4,59 @@
#include <stddef.h>
#include <stdint.h>
#define DATA_HEADER_MAGIC 0x600dda7a
#define DATA_HEADER_VERSION 1
namespace kernel {
namespace args {
#define JSIX_FLAG_DEBUG 0x00000001
constexpr uint32_t magic = 0x600dda7a;
constexpr uint16_t version = 1;
enum class flags : uint32_t
{
debug = 0x00000001
};
enum class type : uint32_t {
unknown,
kernel,
initrd,
memory_map,
framebuffer,
max
};
enum class mode : uint8_t {
normal,
debug
};
#pragma pack(push, 1)
struct kernel_args {
struct module {
void *location;
size_t size;
type type;
flags flags;
};
struct header {
uint32_t magic;
uint16_t version;
uint16_t length;
uint16_t _reserved0;
uint16_t scratch_pages;
uint32_t flags;
mode mode;
void *initrd;
size_t initrd_length;
uint8_t _reserved0;
void *data;
size_t data_length;
void *memory_map;
size_t memory_map_length;
size_t memory_map_desc_size;
void *runtime;
void *acpi_table;
void *frame_buffer;
size_t frame_buffer_length;
uint32_t hres;
uint32_t vres;
uint32_t rmask;
uint32_t gmask;
uint32_t bmask;
uint32_t _reserved1;
uint32_t num_modules;
module *modules;
void *runtime_services;
void *acpi_table;
}
__attribute__((aligned(alignof(max_align_t))));
#pragma pack(pop)
} // namespace args
} // namespace kernel