[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 1/7] emu: support grub_memalign
From: |
Daniel Axtens |
Subject: |
[RFC PATCH 1/7] emu: support grub_memalign |
Date: |
Tue, 24 Aug 2021 23:32:37 +1000 |
This is trivial to do and simplifies Rust support enormously.
Signed-off-by: Daniel Axtens <dja@axtens.net>
---
grub-core/kern/emu/mm.c | 6 ++++++
include/grub/mm.h | 2 --
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/grub-core/kern/emu/mm.c b/grub-core/kern/emu/mm.c
index 4d1046a219eb..71dc8d422f3e 100644
--- a/grub-core/kern/emu/mm.c
+++ b/grub-core/kern/emu/mm.c
@@ -73,3 +73,9 @@ grub_realloc (void *ptr, grub_size_t size)
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
return ret;
}
+
+void *
+grub_memalign (grub_size_t align, grub_size_t size)
+{
+ return aligned_alloc (align, size);
+}
diff --git a/include/grub/mm.h b/include/grub/mm.h
index 9c38dd3ca5d2..4407179a838d 100644
--- a/include/grub/mm.h
+++ b/include/grub/mm.h
@@ -34,9 +34,7 @@ void *EXPORT_FUNC(grub_malloc) (grub_size_t size);
void *EXPORT_FUNC(grub_zalloc) (grub_size_t size);
void EXPORT_FUNC(grub_free) (void *ptr);
void *EXPORT_FUNC(grub_realloc) (void *ptr, grub_size_t size);
-#ifndef GRUB_MACHINE_EMU
void *EXPORT_FUNC(grub_memalign) (grub_size_t align, grub_size_t size);
-#endif
void grub_mm_check_real (const char *file, int line);
#define grub_mm_check() grub_mm_check_real (GRUB_FILE, __LINE__);
--
2.30.2
- [RFC PATCH 0/7] Support writing grub modules in Rust, Daniel Axtens, 2021/08/24
- [RFC PATCH 1/7] emu: support grub_memalign,
Daniel Axtens <=
- [RFC PATCH 2/7] Rust: module build infrastructure, Daniel Axtens, 2021/08/24
- [RFC PATCH 3/7] Rust: add a slightly more idiomatic wrapper around command handling, Daniel Axtens, 2021/08/24
- [RFC PATCH 4/7] Rust: add the rust_hello module, Daniel Axtens, 2021/08/24
- [RFC PATCH 5/7] powerpc: Support Rust, Daniel Axtens, 2021/08/24
- [RFC PATCH 6/7] x86_64-efi: Support Rust, Daniel Axtens, 2021/08/24
- [RFC PATCH 7/7] arm64-efi: Support Rust, Daniel Axtens, 2021/08/24
- Re: [RFC PATCH 0/7] Support writing grub modules in Rust, Heinrich Schuchardt, 2021/08/25