svn commit: r348353 - head/stand/efi/boot1
Toomas Soome
tsoome at FreeBSD.org
Wed May 29 07:32:44 UTC 2019
Author: tsoome
Date: Wed May 29 07:32:43 2019
New Revision: 348353
URL: https://svnweb.freebsd.org/changeset/base/348353
Log:
boot1.efi should also provide Calloc
boot1.efi does provide Malloc and Free, we also need Calloc.
Modified:
head/stand/efi/boot1/boot1.c
Modified: head/stand/efi/boot1/boot1.c
==============================================================================
--- head/stand/efi/boot1/boot1.c Wed May 29 07:24:10 2019 (r348352)
+++ head/stand/efi/boot1/boot1.c Wed May 29 07:32:43 2019 (r348353)
@@ -54,10 +54,11 @@ static EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCO
static EFI_GUID ConsoleControlGUID = EFI_CONSOLE_CONTROL_PROTOCOL_GUID;
/*
- * Provide Malloc / Free backed by EFIs AllocatePool / FreePool which ensures
+ * Provide Malloc / Free / Calloc backed by EFIs AllocatePool / FreePool which ensures
* memory is correctly aligned avoiding EFI_INVALID_PARAMETER returns from
* EFI methods.
*/
+
void *
Malloc(size_t len, const char *file __unused, int line __unused)
{
@@ -74,6 +75,19 @@ Free(void *buf, const char *file __unused, int line __
{
if (buf != NULL)
(void)BS->FreePool(buf);
+}
+
+void *
+Calloc(size_t n1, size_t n2, const char *file, int line)
+{
+ size_t bytes;
+ void *res;
+
+ bytes = n1 * n2;
+ if ((res = Malloc(bytes, file, line)) != NULL)
+ bzero(res, bytes);
+
+ return (res);
}
/*
More information about the svn-src-all
mailing list