summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-10-11 15:01:32 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-10-11 15:01:32 -0700
commitd67eb079d2db06570e7ef299634c9b91cf807b3e (patch)
treec2283def2941c4942c042b8bfb4f4e5f165276a0
parent51f53cd1b7d82bf5dc451b2a9d12fe873507699c (diff)
downloadsyslinux-d67eb079d2db06570e7ef299634c9b91cf807b3e.tar.gz
Mark TSS unbusy before protected mode entry
The LTR instruction marks the TSS descriptor busy, and any subsequent attempt to load it will #GP unless maked unbusy first. Sigh.
-rw-r--r--bcopy32.inc3
-rw-r--r--com32.inc2
2 files changed, 5 insertions, 0 deletions
diff --git a/bcopy32.inc b/bcopy32.inc
index 7e3ac0f9..330f2be6 100644
--- a/bcopy32.inc
+++ b/bcopy32.inc
@@ -54,6 +54,7 @@ bcopy_gdt: dw bcopy_gdt_size-1 ; Null descriptor - contains GDT
; TSS segment to keep Intel VT happy. Intel VT is
; unhappy about anything that doesn't smell like a
; full-blown 32-bit OS.
+.tss:
dw 104-1, DummyTSS ; 30h 32-bit task state segment
dd 00008900h ; present, dpl 0, 104 bytes @DummyTSS
bcopy_gdt_size: equ $-bcopy_gdt
@@ -87,6 +88,8 @@ bcopy: push eax
cli
call enable_a20
+ mov byte [bcopy_gdt.tss+5],89h ; Mark TSS unbusy
+
mov bx,ss ; Save the stack segment value!
o32 lgdt [cs:bcopy_gdt]
diff --git a/com32.inc b/com32.inc
index fb302aeb..8220c134 100644
--- a/com32.inc
+++ b/com32.inc
@@ -82,6 +82,8 @@ com32_enter_pm:
call enable_a20
.a20ok:
+ mov byte [bcopy_gdt.tss+5],89h ; Mark TSS unbusy
+
lgdt [bcopy_gdt] ; We can use the same GDT just fine
lidt [com32_pmidt] ; Set up the IDT
mov eax,cr0