mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
Exiting boot services can't actually be done from inside `bootloader_uefi_main`, because there are objects in that scope that run code requiring boot services in their destructors. Also added `support.cpp` with `memcpy` because clang will emit references to `memcpy` even in freestanding mode. Added a `debug_break` function to allow for faking breakpoints when connecting to the bootloader with GDB. Tags: debug
28 lines
695 B
C++
28 lines
695 B
C++
#include <stdint.h>
|
|
|
|
#include "error.h"
|
|
|
|
extern "C" {
|
|
|
|
/// Basic memcpy() implementation for clang. Clang requires freestanding code
|
|
/// implement memcpy(), as it may emit references to it. This basic memcpy is
|
|
/// not the most efficient, but will get linked if no other memcpy exists.
|
|
__attribute__ ((__weak__))
|
|
void *memcpy(void *dest, const void *src, size_t n)
|
|
{
|
|
uint8_t *cdest = reinterpret_cast<uint8_t*>(dest);
|
|
const uint8_t *csrc = reinterpret_cast<const uint8_t*>(src);
|
|
for (size_t i = 0; i < n; ++i)
|
|
cdest[i] = csrc[i];
|
|
return dest;
|
|
}
|
|
|
|
int _purecall()
|
|
{
|
|
::boot::error::raise(uefi::status::unsupported, L"Pure virtual call");
|
|
}
|
|
|
|
} // extern "C"
|
|
|
|
void operator delete (void *) {}
|