]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
x86: Allow use of global_data with EFI
authorSimon Glass <sjg@chromium.org>
Fri, 31 Jul 2015 15:31:35 +0000 (09:31 -0600)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 10 Sep 2015 06:00:53 +0000 (08:00 +0200)
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>
arch/x86/include/asm/global_data.h

index 3db9a4cf0b6bc79a5420b25b6470a8c4769550ad..80ebe3eb7bc26849924aa4305825f0fcb5f4d557 100644 (file)
@@ -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