mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
[boot] Provide memset implementation
Clang needs memset, memcpy, etc to exist even in freestanding situations because it will emit calls to those functions. This commit adds a simple weak-linked memset implementation.
This commit is contained in:
@@ -17,6 +17,18 @@ void *memcpy(void *dest, const void *src, size_t n)
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Basic memset() implementation for clang. Clang requires freestanding code
|
||||||
|
/// implement memset(), as it may emit references to it. This basic memset is
|
||||||
|
/// not the most efficient, but will get linked if no other memcpy exists.
|
||||||
|
__attribute__ ((__weak__))
|
||||||
|
void *memset(void *dest, int c, size_t n)
|
||||||
|
{
|
||||||
|
uint8_t *cdest = reinterpret_cast<uint8_t*>(dest);
|
||||||
|
for (size_t i = 0; i < n; ++i)
|
||||||
|
cdest[i] = static_cast<uint8_t>(c);
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
int _purecall()
|
int _purecall()
|
||||||
{
|
{
|
||||||
::boot::error::raise(uefi::status::unsupported, L"Pure virtual call");
|
::boot::error::raise(uefi::status::unsupported, L"Pure virtual call");
|
||||||
|
|||||||
Reference in New Issue
Block a user