Files
jsix_import/src/boot/bootconfig.h
Justin C. Miller 9f54927a82 [util] Remove enum_bitfields
The enum_bitfields system never worked quite right, and always had edge cases where name
resolution for the SFINAE would fail. Move everything over to use util::bitset, which can
be constexpr and boils down to inline integer bitops in release mode.

Improved util::bitset itself, moving the array-backed base implementation into a new
util::sized_bitset, and making the single-inttype backed implementation the base case.
Also added a distinction between | or |= (which work with real bit values) and + or +=
(which work with bit indexes).
2024-02-25 23:40:14 -08:00

48 lines
1.2 KiB
C++

/// \file bootconfig.h
/// Definitions for reading the jsix bootconfig file
#pragma once
#include <bootproto/bootconfig.h>
#include <util/bitset.h>
#include <util/counted.h>
namespace uefi {
struct boot_services;
}
namespace boot {
using desc_flags = bootproto::desc_flags;
struct descriptor {
util::bitset16 flags;
wchar_t const *path;
};
/// A bootconfig is a manifest of potential files.
class bootconfig
{
public:
using descriptors = util::counted<descriptor>;
/// Constructor. Loads bootconfig from the given buffer.
bootconfig(util::buffer data, uefi::boot_services *bs);
inline util::bitset16 flags() const { return m_flags; }
inline const descriptor & kernel() const { return m_kernel; }
inline const descriptor & init() const { return m_init; }
inline const wchar_t * initrd() const { return m_initrd; }
inline const wchar_t * symbols() const { return m_symbols; }
inline const descriptors & panics() { return m_panics; }
private:
util::bitset16 m_flags;
descriptor m_kernel;
descriptor m_init;
descriptors m_panics;
wchar_t const *m_initrd;
wchar_t const *m_symbols;
};
} // namespace boot