aboutsummaryrefslogtreecommitdiffstats
path: root/src/x86.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2015-03-17 11:37:25 -0400
committerKevin O'Connor <kevin@koconnor.net>2015-03-18 01:46:56 -0400
commit251e26388b83f4bfd8a5ae28263db295e5b683b5 (patch)
tree0d4c0430771f91336580d1ed83510a8524d65597 /src/x86.h
parent184496863a40ac1eff5612ba0da11399535bfa40 (diff)
downloadseabios-251e26388b83f4bfd8a5ae28263db295e5b683b5.tar.gz
vgabios: Don't use extra stack if it appears a modern OS is in use
If the last mode set (while not in vm86 mode) was done from a VBE mode set call then disable the extra stack. This works under the premise that only a modern OS would invoke the VBE mode changing facilities and a modern OS would always call the vgabios with sufficient stack space. This is an ugly hack to work around a problem Windows Vista (and possibly later Windows releases) has with the VGA BIOS using a stack in the e-segment. Reported-by: Richard Laager <rlaager@wiktel.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/x86.h')
-rw-r--r--src/x86.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/x86.h b/src/x86.h
index 7798b1c1..14ebb7de 100644
--- a/src/x86.h
+++ b/src/x86.h
@@ -83,6 +83,11 @@ static inline u32 getcr0(void) {
static inline void setcr0(u32 cr0) {
asm("movl %0, %%cr0" : : "r"(cr0));
}
+static inline u16 getcr0_vm86(void) {
+ u16 cr0;
+ asm("smsww %0" : "=r"(cr0));
+ return cr0;
+}
static inline u64 rdmsr(u32 index)
{