summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-07-31 15:31:35 (GMT)
committerSimon Glass <sjg@chromium.org>2015-08-05 14:42:41 (GMT)
commit8f3b9694b217b7083fcbc44d7a28c16185c0c579 (patch)
tree817292fe32e6188f1402b829d7e9e62861dca108 /arch/x86/include/asm
parent53292ad956329eb18de0604f369cd99dd2a2579f (diff)
downloadu-boot-fsl-qoriq-8f3b9694b217b7083fcbc44d7a28c16185c0c579.tar.xz
x86: Allow use of global_data with EFI
On x86 the global_data pointer is provided through a somewhat-bizarre and x86-specific mechanism: the F segment register is set to a pointer to the start of global_data, so that accesses can use this build-in register. When running as an EFI application we don't want to mess with the Global Descriptor Table (GDT) and there is little advantage (in terms of code size) to doing so. Allow global_data to be a simple variable in this case. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'arch/x86/include/asm')
-rw-r--r--arch/x86/include/asm/global_data.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index 3db9a4c..80ebe3e 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -76,6 +76,12 @@ struct arch_global_data {
#include <asm-generic/global_data.h>
#ifndef __ASSEMBLY__
+# ifdef CONFIG_EFI_APP
+
+#define gd global_data_ptr
+
+#define DECLARE_GLOBAL_DATA_PTR extern struct global_data *global_data_ptr
+# else
static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
{
gd_t *gd_ptr;
@@ -88,6 +94,7 @@ static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
#define gd get_fs_gd_ptr()
#define DECLARE_GLOBAL_DATA_PTR
+# endif
#endif