Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 May 2019 07:32:43 +0000 (UTC)
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r348353 - head/stand/efi/boot1
Message-ID:  <201905290732.x4T7WhWe018649@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905290732.x4T7WhWe018649>