summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-01-16 07:03:59 -0700
committerBin Meng <bmeng.cn@gmail.com>2017-02-06 11:38:46 +0800
commita160092a610f4345cea5b606a8daf27d1feba185 (patch)
treedf18c0c3a3987c65e1093401d030b478e6ad09dc /arch/x86/include/asm
parent93031595ede1c8a0ee1f7820ab9d719b0e9e51c7 (diff)
x86: Support global_data on x86_64
At present this is just an ordinary variable. We may consider making it a fixed register in the future. 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, 6 insertions, 1 deletions
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index 7434f779b6..34e19efd14 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -104,8 +104,9 @@ struct arch_global_data {
#include <asm-generic/global_data.h>
#ifndef __ASSEMBLY__
-# ifdef CONFIG_EFI_APP
+# if defined(CONFIG_EFI_APP) || CONFIG_IS_ENABLED(X86_64)
+/* TODO(sjg@chromium.org): Consider using a fixed register for gd on x86_64 */
#define gd global_data_ptr
#define DECLARE_GLOBAL_DATA_PTR extern struct global_data *global_data_ptr
@@ -114,7 +115,11 @@ static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
{
gd_t *gd_ptr;
+#if CONFIG_IS_ENABLED(X86_64)
+ asm volatile("fs mov 0, %0\n" : "=r" (gd_ptr));
+#else
asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr));
+#endif
return gd_ptr;
}