summaryrefslogtreecommitdiff
path: root/DuetPkg/BiosVideoThunkDxe
diff options
context:
space:
mode:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2009-03-02 15:03:37 +0000
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2009-03-02 15:03:37 +0000
commit237bb9d0be75978a773a084fe739df261742b913 (patch)
tree4313c2beb8694510ed14e578eee304d7f25ab3b5 /DuetPkg/BiosVideoThunkDxe
parent71bd6db17842075c6089d954fc5c8b7fd21d534f (diff)
downloadedk2-platforms-237bb9d0be75978a773a084fe739df261742b913.tar.xz
Fix bug of wrong stack16 stack for thunk call. This may cause Duet failed to enter graphic mode under Qemu simulator or some platforms.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7771 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'DuetPkg/BiosVideoThunkDxe')
-rw-r--r--DuetPkg/BiosVideoThunkDxe/BiosVideo.c10
-rw-r--r--DuetPkg/BiosVideoThunkDxe/LegacyBiosThunk.c27
2 files changed, 21 insertions, 16 deletions
diff --git a/DuetPkg/BiosVideoThunkDxe/BiosVideo.c b/DuetPkg/BiosVideoThunkDxe/BiosVideo.c
index 6a8e55a034..7053a0002c 100644
--- a/DuetPkg/BiosVideoThunkDxe/BiosVideo.c
+++ b/DuetPkg/BiosVideoThunkDxe/BiosVideo.c
@@ -1043,6 +1043,7 @@ BiosVideoCheckForVbe (
VESA_BIOS_EXTENSIONS_VALID_EDID_TIMING ValidEdidTiming;
EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *GraphicsOutputMode;
+ DEBUG ((EFI_D_INFO, "Enter BiosVideoCheckForVbe()\n"));
//
// Allocate buffer under 1MB for VBE data structures
//
@@ -1095,26 +1096,33 @@ BiosVideoCheckForVbe (
Regs.X.ES = EFI_SEGMENT ((UINTN) BiosVideoPrivate->VbeInformationBlock);
Regs.X.DI = EFI_OFFSET ((UINTN) BiosVideoPrivate->VbeInformationBlock);
+ DEBUG ((EFI_D_INFO, "Before VESA!\n"));
LegacyBiosInt86 (BiosVideoPrivate, 0x10, &Regs);
-
+ DEBUG ((EFI_D_INFO, "Call VESA! Return Status=0x%X\n", Regs.X.AX));
+ DEBUG ((EFI_D_INFO, "Call VESA! VESA Signature =0x%X\n", BiosVideoPrivate->VbeInformationBlock->VESASignature));
+ DEBUG ((EFI_D_INFO, "Call VESA! VESA Version =0x%X\n", BiosVideoPrivate->VbeInformationBlock->VESAVersion));
+
Status = EFI_DEVICE_ERROR;
//
// See if the VESA call succeeded
//
if (Regs.X.AX != VESA_BIOS_EXTENSIONS_STATUS_SUCCESS) {
+ DEBUG ((EFI_D_INFO, "Fail to call VESA! Status=0x%X\n", Regs.X.AX));
return Status;
}
//
// Check for 'VESA' signature
//
if (BiosVideoPrivate->VbeInformationBlock->VESASignature != VESA_BIOS_EXTENSIONS_VESA_SIGNATURE) {
+ DEBUG ((EFI_D_INFO, "Fail to check VESA signature!\n"));
return Status;
}
//
// Check to see if this is VBE 2.0 or higher
//
if (BiosVideoPrivate->VbeInformationBlock->VESAVersion < VESA_BIOS_EXTENSIONS_VERSION_2_0) {
+ DEBUG ((EFI_D_INFO, "VBE version is little than 2.0!\n"));
return Status;
}
diff --git a/DuetPkg/BiosVideoThunkDxe/LegacyBiosThunk.c b/DuetPkg/BiosVideoThunkDxe/LegacyBiosThunk.c
index b8603426c6..08ed35c1f4 100644
--- a/DuetPkg/BiosVideoThunkDxe/LegacyBiosThunk.c
+++ b/DuetPkg/BiosVideoThunkDxe/LegacyBiosThunk.c
@@ -146,17 +146,17 @@ LegacyBiosInt86 (
BOOLEAN Ret;
UINT16 *Stack16;
- Regs->X.Flags.Reserved1 = 1;
- Regs->X.Flags.Reserved2 = 0;
- Regs->X.Flags.Reserved3 = 0;
- Regs->X.Flags.Reserved4 = 0;
- Regs->X.Flags.IOPL = 3;
- Regs->X.Flags.NT = 0;
- Regs->X.Flags.IF = 1;
- Regs->X.Flags.TF = 0;
- Regs->X.Flags.CF = 0;
-
ZeroMem (&ThunkRegSet, sizeof (ThunkRegSet));
+ ThunkRegSet.E.EFLAGS.Bits.Reserved_0 = 1;
+ ThunkRegSet.E.EFLAGS.Bits.Reserved_1 = 0;
+ ThunkRegSet.E.EFLAGS.Bits.Reserved_2 = 0;
+ ThunkRegSet.E.EFLAGS.Bits.Reserved_3 = 0;
+ ThunkRegSet.E.EFLAGS.Bits.IOPL = 3;
+ ThunkRegSet.E.EFLAGS.Bits.NT = 0;
+ ThunkRegSet.E.EFLAGS.Bits.IF = 1;
+ ThunkRegSet.E.EFLAGS.Bits.TF = 0;
+ ThunkRegSet.E.EFLAGS.Bits.CF = 0;
+
ThunkRegSet.E.EDI = Regs->E.EDI;
ThunkRegSet.E.ESI = Regs->E.ESI;
ThunkRegSet.E.EBP = Regs->E.EBP;
@@ -167,8 +167,6 @@ LegacyBiosInt86 (
ThunkRegSet.E.DS = Regs->E.DS;
ThunkRegSet.E.ES = Regs->E.ES;
- CopyMem (&(ThunkRegSet.E.EFLAGS), &(Regs->E.EFlags), sizeof (UINT32));
-
//
// The call to Legacy16 is a critical section to EFI
//
@@ -184,16 +182,15 @@ LegacyBiosInt86 (
ASSERT_EFI_ERROR (Status);
Stack16 = (UINT16 *)((UINT8 *) BiosDev->ThunkContext->RealModeBuffer + BiosDev->ThunkContext->RealModeBufferSize - sizeof (UINT16));
- Stack16 -= sizeof (ThunkRegSet.E.EFLAGS) / sizeof (UINT16);
- CopyMem (Stack16, &ThunkRegSet.E.EFLAGS, sizeof (ThunkRegSet.E.EFLAGS));
ThunkRegSet.E.SS = (UINT16) (((UINTN) Stack16 >> 16) << 12);
ThunkRegSet.E.ESP = (UINT16) (UINTN) Stack16;
+
ThunkRegSet.E.Eip = (UINT16)((UINT32 *)NULL)[BiosInt];
ThunkRegSet.E.CS = (UINT16)(((UINT32 *)NULL)[BiosInt] >> 16);
BiosDev->ThunkContext->RealModeState = &ThunkRegSet;
AsmThunk16 (BiosDev->ThunkContext);
-
+
//
// Restore protected mode interrupt state
//