diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2017-06-06 07:31:24 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-06-13 02:56:53 -0400 |
commit | 919a02d1280a3845bac70e6b7891ca070f21a60a (patch) | |
tree | edb7923df7d630ffa17d2c726012e255911f4848 | |
parent | 4c94117c7fa1bea36a15157022dbe5efee474340 (diff) |
x86/boot/efi: Define __KERNEL32_CS GDT on 64-bit configurations
We would need to switch temporarily to compatibility mode during booting
with 5-level paging enabled. It would require 32-bit code segment
descriptor.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-arch@vger.kernel.org
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/20170606113133.22974-6-kirill.shutemov@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/boot/compressed/eboot.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c index b75c20f779ea..c3e869eaef0c 100644 --- a/arch/x86/boot/compressed/eboot.c +++ b/arch/x86/boot/compressed/eboot.c | |||
@@ -1046,8 +1046,29 @@ struct boot_params *efi_main(struct efi_config *c, | |||
1046 | memset((char *)gdt->address, 0x0, gdt->size); | 1046 | memset((char *)gdt->address, 0x0, gdt->size); |
1047 | desc = (struct desc_struct *)gdt->address; | 1047 | desc = (struct desc_struct *)gdt->address; |
1048 | 1048 | ||
1049 | /* The first GDT is a dummy and the second is unused. */ | 1049 | /* The first GDT is a dummy. */ |
1050 | desc += 2; | 1050 | desc++; |
1051 | |||
1052 | if (IS_ENABLED(CONFIG_X86_64)) { | ||
1053 | /* __KERNEL32_CS */ | ||
1054 | desc->limit0 = 0xffff; | ||
1055 | desc->base0 = 0x0000; | ||
1056 | desc->base1 = 0x0000; | ||
1057 | desc->type = SEG_TYPE_CODE | SEG_TYPE_EXEC_READ; | ||
1058 | desc->s = DESC_TYPE_CODE_DATA; | ||
1059 | desc->dpl = 0; | ||
1060 | desc->p = 1; | ||
1061 | desc->limit = 0xf; | ||
1062 | desc->avl = 0; | ||
1063 | desc->l = 0; | ||
1064 | desc->d = SEG_OP_SIZE_32BIT; | ||
1065 | desc->g = SEG_GRANULARITY_4KB; | ||
1066 | desc->base2 = 0x00; | ||
1067 | desc++; | ||
1068 | } else { | ||
1069 | /* Second entry is unused on 32-bit */ | ||
1070 | desc++; | ||
1071 | } | ||
1051 | 1072 | ||
1052 | /* __KERNEL_CS */ | 1073 | /* __KERNEL_CS */ |
1053 | desc->limit0 = 0xffff; | 1074 | desc->limit0 = 0xffff; |