|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] xen/pvh: Fix segment selector ABI
The written ABI states that %es will be set up, but libxc doesn't do so. In
practice, it breaks `rep movs` inside guests before they reload %es.
The written ABI doesn't mention %ss, but libxc does set it up. Having %ds
different to %ss is obnoxous to work with, as different registers have
different implicit segments.
Modify the spec to state that %ss is set up as a flat read/write segment.
This a) matches the Multiboot 1 spec, b) matches what is set up in practice,
and c) is the more sane behaviour for guests to use.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Ian Jackson <Ian.Jackson@xxxxxxxxxx>
This wants backporting.
---
docs/misc/pvh.pandoc | 2 +-
tools/libxc/xc_dom_x86.c | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/docs/misc/pvh.pandoc b/docs/misc/pvh.pandoc
index f892e6e641..ccf1c8fe69 100644
--- a/docs/misc/pvh.pandoc
+++ b/docs/misc/pvh.pandoc
@@ -23,7 +23,7 @@ following machine state:
* `cs`: must be a 32-bit read/execute code segment with a base of ‘0’
and a limit of ‘0xFFFFFFFF’. The selector value is unspecified.
- * `ds`, `es`: must be a 32-bit read/write data segment with a base of
+ * `ds`, `es`, `ss`: must be a 32-bit read/write data segment with a base of
‘0’ and a limit of ‘0xFFFFFFFF’. The selector values are all unspecified.
* `tr`: must be a 32-bit TSS (active) with a base of '0' and a limit of
'0x67'.
diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
index 155ef69037..9439805eaa 100644
--- a/tools/libxc/xc_dom_x86.c
+++ b/tools/libxc/xc_dom_x86.c
@@ -1053,14 +1053,17 @@ static int vcpu_hvm(struct xc_dom_image *dom)
/* Set the cached part of the relevant segment registers. */
bsp_ctx.cpu.cs_base = 0;
bsp_ctx.cpu.ds_base = 0;
+ bsp_ctx.cpu.es_base = 0;
bsp_ctx.cpu.ss_base = 0;
bsp_ctx.cpu.tr_base = 0;
bsp_ctx.cpu.cs_limit = ~0u;
bsp_ctx.cpu.ds_limit = ~0u;
+ bsp_ctx.cpu.es_limit = ~0u;
bsp_ctx.cpu.ss_limit = ~0u;
bsp_ctx.cpu.tr_limit = 0x67;
bsp_ctx.cpu.cs_arbytes = 0xc9b;
bsp_ctx.cpu.ds_arbytes = 0xc93;
+ bsp_ctx.cpu.es_arbytes = 0xc93;
bsp_ctx.cpu.ss_arbytes = 0xc93;
bsp_ctx.cpu.tr_arbytes = 0x8b;
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |