From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Wei Liu" <wl@xen.org>, "Jan Beulich" <JBeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH] x86/boot: Further minor GDT corrections
Date: Mon, 19 Aug 2019 14:42:11 +0100 [thread overview]
Message-ID: <20190819134213.1628-2-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20190819134213.1628-1-andrew.cooper3@citrix.com>
gdt_boot_descr and gdt_48 disagree on how long trampoline_gdt is.
Introduce an end label and have the linker calculate the 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 remaining GDTs in Xen.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
The trampoline GDT access bits were actually noticed when trying to clean up
our boot time pagetables and map the trampoline read-only.
---
xen/arch/x86/boot/head.S | 2 +-
xen/arch/x86/boot/trampoline.S | 15 ++++++++-------
xen/arch/x86/x86_64/kexec_reloc.S | 4 ++--
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 26b680521d..9fdb9b3954 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -129,7 +129,7 @@ multiboot2_header:
.word 0
gdt_boot_descr:
- .word 7*8-1
+ .word .Ltramopline_gdt_end - trampoline_gdt - 1
gdt_boot_base:
.long sym_offs(trampoline_gdt)
.long 0 /* Needed for 64-bit lgdt */
diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S
index 7c6a2328d2..1761fc1213 100644
--- a/xen/arch/x86/boot/trampoline.S
+++ b/xen/arch/x86/boot/trampoline.S
@@ -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
+.Ltramopline_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 .Ltramopline_gdt_end - trampoline_gdt - 1
.long bootsym_rel(trampoline_gdt,4)
/* The first page of trampoline is permanent, the rest boot-time only. */
diff --git a/xen/arch/x86/x86_64/kexec_reloc.S b/xen/arch/x86/x86_64/kexec_reloc.S
index 5bf61d5c2d..9e5b7a6ba1 100644
--- a/xen/arch/x86/x86_64/kexec_reloc.S
+++ b/xen/arch/x86/x86_64/kexec_reloc.S
@@ -182,8 +182,8 @@ compat_mode_gdt_desc:
.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 */
compat_mode_idt:
.word 0 /* limit */
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-08-19 13:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-19 13:42 [Xen-devel] [PATCH] x86/boot: Various bits of trampoline cleanup Andrew Cooper
2019-08-19 13:42 ` Andrew Cooper [this message]
2019-08-27 14:49 ` [Xen-devel] [PATCH] x86/boot: Further minor GDT corrections Jan Beulich
2019-08-19 13:42 ` [Xen-devel] [PATCH] x86/boot: Reposition trampoline data Andrew Cooper
2019-08-19 16:02 ` David Woodhouse
2019-08-27 14:50 ` Jan Beulich
2019-08-19 13:42 ` [Xen-devel] [PATCH] x86/boot: Drop all use of lmsw Andrew Cooper
2019-08-27 14:52 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190819134213.1628-2-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).