feat: Various improvements

This commit is contained in:
Daniel Hammer
2025-04-16 10:32:11 +02:00
parent 35cf3f7c80
commit fcd81be1c5
14 changed files with 135 additions and 98 deletions
+1 -1
View File
@@ -12,6 +12,6 @@
// 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 __cxa_pure_virtual() { Hal::Halt(); }
void *__dso_handle;
}
+13 -11
View File
@@ -5,16 +5,18 @@
*/
// Halt and catch fire function.
void hcf()
{
for (;;)
namespace Hal {
__attribute__((noreturn)) void Halt()
{
#if defined(__x86_64__)
asm("hlt");
#elif defined(__aarch64__) || defined(__riscv)
asm("wfi");
#elif defined(__loongarch64)
asm("idle 0");
#endif
for (;;)
{
#if defined(__x86_64__)
asm("hlt");
#elif defined(__aarch64__) || defined(__riscv)
asm("wfi");
#elif defined(__loongarch64)
asm("idle 0");
#endif
}
}
}
};
+3 -1
View File
@@ -7,4 +7,6 @@
#pragma once
// Halt and catch fire function.
void hcf();
namespace Hal {
__attribute__((noreturn)) void Halt();
};