Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F135906719
D44541.id136291.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D44541.id136291.diff
View Options
diff --git a/stand/efi/include/efichar.h b/stand/efi/include/efichar.h
--- a/stand/efi/include/efichar.h
+++ b/stand/efi/include/efichar.h
@@ -37,4 +37,12 @@
int utf8_to_ucs2(const char *, efi_char **, size_t *);
int ucs2len(const efi_char *);
+#ifdef _KERNEL
+#define EFICHAR_MALLOC(sz) malloc((sz), M_TEMP, M_WAITOK | M_ZERO)
+#define EFICHAR_FREE(sz) free((sz), M_TEMP)
+#else
+#define EFICHAR_MALLOC(sz) malloc(sz)
+#define EFICHAR_FREE(sz) free(sz)
+#endif
+
#endif /* _BOOT_EFI_EFICHAR_H_ */
diff --git a/stand/efi/libefi/efichar.c b/stand/efi/libefi/efichar.c
--- a/stand/efi/libefi/efichar.c
+++ b/stand/efi/libefi/efichar.c
@@ -25,14 +25,21 @@
*/
#include <sys/types.h>
+#ifndef _KERNEL
#include <errno.h>
+#endif
#ifdef _STANDALONE
#include <stand.h>
#else
+#ifdef _KERNEL
+#include <sys/malloc.h>
+#include <sys/systm.h>
+#else
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#endif
#include <sys/efi.h>
#include <machine/efi.h>
#endif
@@ -87,7 +94,7 @@
if (*name != NULL)
cp = *name;
else
- cp = *name = malloc(sz);
+ cp = *name = EFICHAR_MALLOC(sz);
if (*name == NULL)
return (ENOMEM);
@@ -114,7 +121,7 @@
if (len >= sz) {
/* Absent bugs, we'll never return EOVERFLOW */
if (freeit) {
- free(*name);
+ EFICHAR_FREE(*name);
*name = NULL;
}
return (EOVERFLOW);
@@ -135,7 +142,7 @@
sz = strlen(name) * 2 + 2;
if (*nmp == NULL)
- *nmp = malloc(sz);
+ *nmp = EFICHAR_MALLOC(sz);
if (*nmp == NULL)
return (ENOMEM);
nm = *nmp;
@@ -183,7 +190,7 @@
}
if (sz < 2) {
if (freeit) {
- free(nm);
+ EFICHAR_FREE(nm);
*nmp = NULL;
}
return (EDOOFUS);
@@ -194,7 +201,7 @@
return (0);
ilseq:
if (freeit) {
- free(nm);
+ EFICHAR_FREE(nm);
*nmp = NULL;
}
return (EILSEQ);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 15, 1:11 AM (10 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25294767
Default Alt Text
D44541.id136291.diff (1 KB)
Attached To
Mode
D44541: stand/efi: Changes to efichar to allow it to be used in the kernel
Attached
Detach File
Event Timeline
Log In to Comment