[PATCH] x86: add RESERVE_BRK_ARRAY() helper

From: Jeremy Fitzhardinge
Date: Thu Sep 02 2010 - 22:35:29 EST




Useful when converting static arrays into boot-time brk allocated objects.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>

diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index 4093d1e..632cafd 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -126,6 +126,11 @@ void *extend_brk(size_t size, size_t align);
: : "i" (sz)); \
}

+/* Helper for reserving space for arrays of things */
+#define RESERVE_BRK_ARRAY(type, name, entries) \
+ type *name; \
+ RESERVE_BRK(name, sizeof(type) * entries)
+
#ifdef __i386__

void __init i386_start_kernel(void);


From 900d977e6ce004c59b986a494838daddecbe106a Mon Sep 17 00:00:00 2001
From: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
Date: Thu, 26 Aug 2010 15:31:36 -0700
Subject: [PATCH] x86: add RESERVE_BRK_ARRAY() helper

Useful when converting static arrays into boottime brk allocated objects.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>

diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index 4093d1e..632cafd 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -126,6 +126,11 @@ void *extend_brk(size_t size, size_t align);
: : "i" (sz)); \
}

+/* Helper for reserving space for arrays of things */
+#define RESERVE_BRK_ARRAY(type, name, entries) \
+ type *name; \
+ RESERVE_BRK(name, sizeof(type) * entries)
+
#ifdef __i386__

void __init i386_start_kernel(void);