File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -1046,8 +1046,29 @@ struct boot_params *efi_main(struct efi_config *c,
1046
1046
memset ((char * )gdt -> address , 0x0 , gdt -> size );
1047
1047
desc = (struct desc_struct * )gdt -> address ;
1048
1048
1049
- /* The first GDT is a dummy and the second is unused. */
1050
- desc += 2 ;
1049
+ /* The first GDT is a dummy. */
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
1073
/* __KERNEL_CS */
1053
1074
desc -> limit0 = 0xffff ;
You can’t perform that action at this time.
0 commit comments