fix: Project restructuring
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Itanium.cpp
|
||||
* Definitions for the Itanium C++ ABI
|
||||
* Copyright (c) Daniel Hammer, Limine Contributors (via Limine C++ example)
|
||||
*/
|
||||
|
||||
#include <Platform/Util.hpp>
|
||||
|
||||
// The following stubs are required by the Itanium C++ ABI (the one we use,
|
||||
// regardless of the "Itanium" nomenclature).
|
||||
// Like the memory functions above, these stubs can be moved to a different .cpp file,
|
||||
// but should not be removed, unless you know what you are doing.
|
||||
extern "C" {
|
||||
int __cxa_atexit(void (*)(void *), void *, void *) { return 0; }
|
||||
void __cxa_pure_virtual() { hcf(); }
|
||||
void *__dso_handle;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Limine.hpp
|
||||
* Limine platform definitions and support
|
||||
* Copyright (c) Limine Contributors (via Limine C++ example)
|
||||
*/
|
||||
|
||||
#include "../limine.h"
|
||||
|
||||
// Set the base revision to 3, this is recommended as this is the latest
|
||||
// base revision described by the Limine boot protocol specification.
|
||||
// See specification for further info.
|
||||
|
||||
namespace {
|
||||
|
||||
__attribute__((used, section(".limine_requests")))
|
||||
volatile LIMINE_BASE_REVISION(3);
|
||||
|
||||
}
|
||||
|
||||
// The Limine requests can be placed anywhere, but it is important that
|
||||
// the compiler does not optimise them away, so, usually, they should
|
||||
// be made volatile or equivalent, _and_ they should be accessed at least
|
||||
// once or marked as used with the "used" attribute as done here.
|
||||
|
||||
namespace {
|
||||
|
||||
__attribute__((used, section(".limine_requests")))
|
||||
volatile limine_framebuffer_request framebuffer_request = {
|
||||
.id = LIMINE_FRAMEBUFFER_REQUEST,
|
||||
.revision = 0,
|
||||
.response = nullptr
|
||||
};
|
||||
|
||||
__attribute__((used, section(".limine_requests")))
|
||||
volatile limine_efi_system_table_request system_table_request = {
|
||||
.id = LIMINE_EFI_SYSTEM_TABLE_REQUEST,
|
||||
.revision = 0,
|
||||
.response = nullptr
|
||||
};
|
||||
|
||||
__attribute__((used, section(".limine_requests")))
|
||||
volatile limine_hhdm_request hhdm_request = {
|
||||
.id = LIMINE_HHDM_REQUEST,
|
||||
.revision = 0,
|
||||
.response = nullptr
|
||||
};
|
||||
|
||||
__attribute__((used, section(".limine_requests")))
|
||||
volatile limine_memmap_request memmap_request = {
|
||||
.id = LIMINE_MEMMAP_REQUEST,
|
||||
.revision = 0,
|
||||
.response = nullptr
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// Finally, define the start and end markers for the Limine requests.
|
||||
// These can also be moved anywhere, to any .cpp file, as seen fit.
|
||||
|
||||
namespace {
|
||||
|
||||
__attribute__((used, section(".limine_requests_start")))
|
||||
volatile LIMINE_REQUESTS_START_MARKER;
|
||||
|
||||
__attribute__((used, section(".limine_requests_end")))
|
||||
volatile LIMINE_REQUESTS_END_MARKER;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Util.cpp
|
||||
* Platform utility routines
|
||||
* Copyright (c) Daniel Hammer, Limine Contributors (via Limine C++ example)
|
||||
*/
|
||||
|
||||
// Halt and catch fire function.
|
||||
void hcf()
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
#if defined(__x86_64__)
|
||||
asm("hlt");
|
||||
#elif defined(__aarch64__) || defined(__riscv)
|
||||
asm("wfi");
|
||||
#elif defined(__loongarch64)
|
||||
asm("idle 0");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Util.hpp
|
||||
* Declarations of platform utility routines
|
||||
* Copyright (c) Daniel Hammer, Limine Contributors (via Limine C++ example)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// Halt and catch fire function.
|
||||
void hcf();
|
||||
Reference in New Issue
Block a user