diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2010-03-30 15:02:36 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2010-03-30 15:02:36 -0700 |
commit | ec127e4bce415e103da3ba02d0e7adee2bcc1344 (patch) | |
tree | 3da996e6ac07d071c2f357c9cd9823686c05d80e | |
parent | 99c5243867c4e00f516ba622bf4ba249aeb9f115 (diff) | |
download | syslinux-ec127e4bce415e103da3ba02d0e7adee2bcc1344.tar.gz |
core: Workaround for Xen HVM HLT-in-real-mode bug
Xen HVM when used with the "vmxassist" program crashes if HLT is
executed in real mode. Detect a version of Xen old enough to support
"vmxassist", and if it is found, then disable HLT.
See: https://bugzilla.redhat.com/show_bug.cgi?id=570496
Reported-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | core/cpuinit.inc | 48 | ||||
-rw-r--r-- | core/idle.inc | 6 |
2 files changed, 52 insertions, 2 deletions
diff --git a/core/cpuinit.inc b/core/cpuinit.inc index 4d8cc2e7..6af1bf81 100644 --- a/core/cpuinit.inc +++ b/core/cpuinit.inc @@ -1,6 +1,7 @@ ;; ----------------------------------------------------------------------- ;; ;; Copyright 1994-2008 H. Peter Anvin - All Rights Reserved +;; Copyright 2010 Intel Corporation; author: H. Peter Anvin ;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -39,6 +40,53 @@ dosram_k equ (real_mode_seg+0x1000) >> 6 ; Minimum DOS memory (K) enough_ram: skip_checks: +; +; Detect old versions Xen HVM and disable halt +; Xen HVM older than version 3.3 might be using vmxassist, which breaks +; if HLT is executed in real mode. +; +; Note: in Syslinux 4, we should probably just execute the HLT in +; protected mode instead. +; +check_xen: + pushfd + pushfd + pop eax + mov edx,eax + xor eax,(1 << 21) ; ID flag + push eax + popfd + pushfd + pop eax + popfd + xor eax,edx + jz .not_xen ; No CPUID + + xor ebx,ebx + xor ecx,ecx + xor edx,edx + mov eax,0x40000000 + cpuid + cmp ebx,"XenV" + jne .not_xen + cmp ecx,"MMXe" + jne .not_xen + cmp edx,"nVMM" + jne .not_xen + + ; We're on Xen... + mov eax,0x40000001 + cpuid + call writehex8 + call crlf + cmp eax,0x00030003 + jae .not_xen ; Xen >= 3.3, not affected + + ; We may be using vmxassist, so disable HLT + mov byte [ForceNoHalt],1 + +.not_xen: + section .data err_noram db 'It appears your computer has less than ' asciidec dosram_k diff --git a/core/idle.inc b/core/idle.inc index bd134ff6..dc8d2045 100644 --- a/core/idle.inc +++ b/core/idle.inc @@ -59,7 +59,7 @@ do_idle: cmp ax,TICKS_TO_IDLE jb .done call [IdleHook] - cmp word [NoHalt],0 + cmp dword [NoHalt],0 jne .done hlt .done: @@ -69,8 +69,10 @@ do_idle: .ret: ret section .data + alignb 4 +NoHalt dw 0 ; NoHalt set by user +ForceNoHalt dw 0 ; NoHalt forced by hardware config IdleHook dw do_idle.ret -NoHalt dw 0 hlt_err db 'ERROR: idle with IF=0', CR, LF, 0 |