aboutsummaryrefslogtreecommitdiffstats
path: root/src/arch/i386/prefix
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2014-05-02 13:18:55 +0100
committerMichael Brown <mcb30@ipxe.org>2014-05-02 15:23:21 +0100
commitc64747db5040d860c9c77f2673c4cce287249bbd (patch)
tree1c9ddbd0516a5240916bcd79eae9ca4652c13ffa /src/arch/i386/prefix
parent5a08b63cb7fe3e0c03245c55d955e45226e08bc3 (diff)
downloadipxe-c64747db5040d860c9c77f2673c4cce287249bbd.tar.gz
[librm] Speed up real-to-protected mode transition under KVM
Ensure that all segment registers have zero in the low two bits before transitioning to protected mode. This allows the CPU state to immediately be deemed to be "valid", and eliminates the need for any further emulated instructions. Load the protected-mode interrupt descriptor table after switching to protected mode, since this avoids triggering an EXCEPTION_NMI and corresponding VM exit. This reduces the time taken by real_to_prot under KVM by around 50%. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/i386/prefix')
-rw-r--r--src/arch/i386/prefix/libprefix.S5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/arch/i386/prefix/libprefix.S b/src/arch/i386/prefix/libprefix.S
index 197a86bc..3aee415f 100644
--- a/src/arch/i386/prefix/libprefix.S
+++ b/src/arch/i386/prefix/libprefix.S
@@ -522,8 +522,11 @@ alloc_basemem:
subw $_data16_memsz_pgh, %ax
pushw %ax
- /* Calculate .text16 segment address */
+ /* Calculate .text16 segment address. Round down to ensure
+ * low bits are zero, to speed up mode transitions under KVM.
+ */
subw $_text16_memsz_pgh, %ax
+ andb $~0x03, %al
pushw %ax
/* Update FBMS */