Program Listing for File charon.hpp¶
↰ Return to documentation for file (lib/charon.hpp
)
/* SPDX-License-Identifier: BSD-2-Clause */
#pragma once
#include <stddef.h>
#include <stdint.h>
namespace Gaia {
constexpr auto CHARON_MODULE_MAX = 16;
constexpr auto CHARON_MMAP_SIZE_MAX =
64;
enum CharonMmapEntryType : uint8_t {
FREE,
RESERVED,
MODULE,
RECLAIMABLE,
FRAMEBUFFER
};
struct CharonMmapEntry {
CharonMmapEntryType type;
uintptr_t base;
size_t size;
};
struct CharonMemoryMap {
size_t count = 0;
CharonMmapEntry *begin() { return entries; }
CharonMmapEntry *end() { return entries + count; }
CharonMmapEntry entries[CHARON_MMAP_SIZE_MAX];
};
struct CharonFramebuffer {
bool present;
uintptr_t address;
uint32_t width, height, pitch, bpp;
uint8_t red_mask_size;
uint8_t red_mask_shift;
uint8_t green_mask_size;
uint8_t green_mask_shift;
uint8_t blue_mask_size;
uint8_t blue_mask_shift;
};
struct CharonModule {
size_t size = 0;
uintptr_t address = 0;
const char *name;
};
struct CharonModules {
uint16_t count = 0;
CharonModule modules[CHARON_MODULE_MAX];
};
struct Charon {
uintptr_t rsdp;
CharonFramebuffer framebuffer;
CharonModules modules;
CharonMemoryMap memory_map;
int64_t boot_time;
};
} // namespace Gaia