x86/boot: Further minor GDT corrections

gdt_boot_descr and gdt_48 disagree on how long trampoline_gdt is.

Introduce an end label for each GDT and have the linker calculate their size,
rather than hard coding it.

Also, just as with c/s af292b41e9, there is no point forcing the CPU to set
Access bits.  Fix all affected GDTs.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Andrew Cooper committed 2019-08-28 19:41:29 +01:00
1 parent bb70bcb65b
commit ec92fcd1d0
3 files changed
+13 -11

No files matched your search

+1 -1
View File
@@ -129,7 +129,7 @@ multiboot2_header:
.word 0
gdt_boot_descr:
.word 7*8-1
.word .Ltrampoline_gdt_end - trampoline_gdt - 1
gdt_boot_base:
.long sym_offs(trampoline_gdt)
.long 0 /* Needed for 64-bit lgdt */
+8 -7
View File
@@ -63,22 +63,23 @@ trampoline_gdt:
/* 0x0000: unused */
.quad 0x0000000000000000
/* 0x0008: ring 0 code, 32-bit mode */
.quad 0x00cf9a000000ffff
.quad 0x00cf9b000000ffff
/* 0x0010: ring 0 code, 64-bit mode */
.quad 0x00af9a000000ffff
.quad 0x00af9b000000ffff
/* 0x0018: ring 0 data */
.quad 0x00cf92000000ffff
.quad 0x00cf93000000ffff
/* 0x0020: real-mode code @ BOOT_TRAMPOLINE */
.long 0x0000ffff
.long 0x00009a00
.long 0x00009b00
/* 0x0028: real-mode data @ BOOT_TRAMPOLINE */
.long 0x0000ffff
.long 0x00009200
.long 0x00009300
/*
* 0x0030: ring 0 Xen data, 16 MiB size, base
* address is computed at runtime.
*/
.quad 0x00c0920000000fff
.quad 0x00c0930000000fff
.Ltrampoline_gdt_end:
.pushsection .trampoline_rel, "a"
.long trampoline_gdt + BOOT_PSEUDORM_CS + 2 - .
@@ -182,7 +183,7 @@ start64:
.word 0
idt_48: .word 0, 0, 0 # base = limit = 0
.word 0
gdt_48: .word 6*8-1
gdt_48: .word .Ltrampoline_gdt_end - trampoline_gdt - 1
.long bootsym_rel(trampoline_gdt,4)
/* The first page of trampoline is permanent, the rest boot-time only. */
+4 -3
View File
@@ -176,14 +176,15 @@ compatibility_mode_far:
.word 0x0010
compat_mode_gdt_desc:
.word (3*8)-1
.word .Lcompat_mode_gdt_end - compat_mode_gdt -1
.quad 0x0000000000000000 /* set in call_32_bit above */
.align 8
compat_mode_gdt:
.quad 0x0000000000000000 /* null */
.quad 0x00cf92000000ffff /* 0x0008 ring 0 data */
.quad 0x00cf9a000000ffff /* 0x0010 ring 0 code, compatibility */
.quad 0x00cf93000000ffff /* 0x0008 ring 0 data */
.quad 0x00cf9b000000ffff /* 0x0010 ring 0 code, compatibility */
.Lcompat_mode_gdt_end:
compat_mode_idt:
.word 0 /* limit */
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.