2020-11-02 14:45:11 +01:00
|
|
|
//
|
|
|
|
// memory.cpp
|
|
|
|
//
|
|
|
|
// Created by Jief on 30/10/2020.
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
2021-02-06 18:16:46 +01:00
|
|
|
#include <Uefi/UefiBaseType.h>
|
2020-11-02 14:45:11 +01:00
|
|
|
#include <Library/BaseMemoryLib.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* memset and memcpy has to be provided for clang
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2020-11-09 14:19:33 +01:00
|
|
|
// Jief : I think __attribute__ ((used)) was needed for older version of GCC, can't remember.
|
|
|
|
// If you want to put it back, do it only for the compiler version that really needs it.
|
|
|
|
// Nov 2020 : With Gcc 10.2, defining it for memset is ok, but not needed. Defining it for memcpy generates an error in GenFW.
|
|
|
|
//#ifdef __GNUC__
|
|
|
|
// void* memset(void* dst, int ch, UINTN count) __attribute__ ((used));
|
|
|
|
// void* memcpy(void* dst, const void* src, UINTN count) __attribute__ ((used));
|
|
|
|
//#endif
|
2020-11-02 14:45:11 +01:00
|
|
|
|
|
|
|
void* memset(void* dst, int ch, UINTN count)
|
|
|
|
{
|
|
|
|
SetMem(dst, count, (UINT8)(ch));
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
void* memcpy(void* dst, const void* src, UINTN count)
|
|
|
|
{
|
|
|
|
CopyMem(dst, src, count);
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // extern "C"
|
|
|
|
|