Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f47e1c5 authored by Boris Ostrovsky's avatar Boris Ostrovsky Committed by Juergen Gross
Browse files

xen/PVH: Make GDT selectors PVH-specific



We don't need to share PVH GDT layout with other GDTs, especially
since we now have a PVH-speciific entry (for stack canary segment).

Define PVH's own selectors.

(As a side effect of this change we are also fixing improper
reference to __KERNEL_CS)

Signed-off-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
parent 98014068
Loading
Loading
Loading
Loading
+13 −10
Original line number Diff line number Diff line
@@ -54,7 +54,11 @@
 * charge of setting up it's own stack, GDT and IDT.
 */

#define PVH_GDT_ENTRY_CANARY	4
#define PVH_GDT_ENTRY_CS	1
#define PVH_GDT_ENTRY_DS	2
#define PVH_GDT_ENTRY_CANARY	3
#define PVH_CS_SEL		(PVH_GDT_ENTRY_CS * 8)
#define PVH_DS_SEL		(PVH_GDT_ENTRY_DS * 8)
#define PVH_CANARY_SEL		(PVH_GDT_ENTRY_CANARY * 8)

ENTRY(pvh_start_xen)
@@ -62,7 +66,7 @@ ENTRY(pvh_start_xen)

	lgdt (_pa(gdt))

	mov $(__BOOT_DS),%eax
	mov $PVH_DS_SEL,%eax
	mov %eax,%ds
	mov %eax,%es
	mov %eax,%ss
@@ -96,7 +100,7 @@ ENTRY(pvh_start_xen)
	mov %eax, %cr0

	/* Jump to 64-bit mode. */
	ljmp $__KERNEL_CS, $_pa(1f)
	ljmp $PVH_CS_SEL, $_pa(1f)

	/* 64-bit entry point. */
	.code64
@@ -136,13 +140,13 @@ ENTRY(pvh_start_xen)
	or $(X86_CR0_PG | X86_CR0_PE), %eax
	mov %eax, %cr0

	ljmp $__BOOT_CS, $1f
	ljmp $PVH_CS_SEL, $1f
1:
	call xen_prepare_pvh
	mov $_pa(pvh_bootparams), %esi

	/* startup_32 doesn't expect paging and PAE to be on. */
	ljmp $__BOOT_CS, $_pa(2f)
	ljmp $PVH_CS_SEL, $_pa(2f)
2:
	mov %cr0, %eax
	and $~X86_CR0_PG, %eax
@@ -151,7 +155,7 @@ ENTRY(pvh_start_xen)
	and $~X86_CR4_PAE, %eax
	mov %eax, %cr4

	ljmp $__BOOT_CS, $_pa(startup_32)
	ljmp $PVH_CS_SEL, $_pa(startup_32)
#endif
END(pvh_start_xen)

@@ -163,13 +167,12 @@ gdt:
	.word 0
gdt_start:
	.quad 0x0000000000000000            /* NULL descriptor */
	.quad 0x0000000000000000            /* reserved */
#ifdef CONFIG_X86_64
	.quad GDT_ENTRY(0xa09a, 0, 0xfffff) /* __KERNEL_CS */
	.quad GDT_ENTRY(0xa09a, 0, 0xfffff) /* PVH_CS_SEL */
#else
	.quad GDT_ENTRY(0xc09a, 0, 0xfffff) /* __KERNEL_CS */
	.quad GDT_ENTRY(0xc09a, 0, 0xfffff) /* PVH_CS_SEL */
#endif
	.quad GDT_ENTRY(0xc092, 0, 0xfffff) /* __KERNEL_DS */
	.quad GDT_ENTRY(0xc092, 0, 0xfffff) /* PVH_DS_SEL */
	.quad GDT_ENTRY(0x4090, 0, 0x18)    /* PVH_CANARY_SEL */
gdt_end: