]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/BiosVideoThunkDxe/LegacyBiosThunk.c
Fix more InitializeDebugAgent API change bugs. GDB stub was not turned on in example...
[mirror_edk2.git] / DuetPkg / BiosVideoThunkDxe / LegacyBiosThunk.c
index 08ed35c1f4aadfe93050c5bc424daad7fb1f1f64..c1fab403a7659fb1b87741ebbbb0773950990ae4 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Provide legacy thunk interface for accessing Bios Video Rom.\r
   \r
-Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
+Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
 http://opensource.org/licenses/bsd-license.php                                            \r
@@ -30,26 +30,25 @@ InitializeBiosIntCaller (
   UINT32                RealModeBufferSize;\r
   UINT32                ExtraStackSize;\r
   EFI_PHYSICAL_ADDRESS  LegacyRegionBase;\r
-  \r
+  UINT32                LegacyRegionSize;\r
   //\r
   // Get LegacyRegion\r
   //\r
   AsmGetThunk16Properties (&RealModeBufferSize, &ExtraStackSize);\r
-\r
+  LegacyRegionSize = (((RealModeBufferSize + ExtraStackSize) / EFI_PAGE_SIZE) + 1) * EFI_PAGE_SIZE;\r
   LegacyRegionBase = 0x100000;\r
   Status = gBS->AllocatePages (\r
                   AllocateMaxAddress,\r
                   EfiACPIMemoryNVS,\r
-                  EFI_SIZE_TO_PAGES(RealModeBufferSize + ExtraStackSize + 200),\r
+                  EFI_SIZE_TO_PAGES(LegacyRegionSize),\r
                   &LegacyRegionBase\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r
   \r
   ThunkContext->RealModeBuffer     = (VOID*)(UINTN)LegacyRegionBase;\r
-  ThunkContext->RealModeBufferSize = EFI_PAGES_TO_SIZE (RealModeBufferSize);\r
-  ThunkContext->ThunkAttributes    = 3;\r
+  ThunkContext->RealModeBufferSize = LegacyRegionSize;\r
+  ThunkContext->ThunkAttributes    = THUNK_ATTRIBUTE_BIG_REAL_MODE|THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15;\r
   AsmPrepareThunk16(ThunkContext);\r
-  \r
 }\r
 \r
 /**\r
@@ -137,7 +136,7 @@ EFIAPI
 LegacyBiosInt86 (\r
   IN  BIOS_VIDEO_DEV                 *BiosDev,\r
   IN  UINT8                           BiosInt,\r
-  IN  EFI_IA32_REGISTER_SET           *Regs\r
+  IN  IA32_REGISTER_SET              *Regs\r
   )\r
 {\r
   UINTN                 Status;\r
@@ -216,9 +215,9 @@ LegacyBiosInt86 (
   Regs->E.DS       = ThunkRegSet.E.DS;  \r
   Regs->E.ES       = ThunkRegSet.E.ES;\r
 \r
-  CopyMem (&(Regs->E.EFlags), &(ThunkRegSet.E.EFLAGS), sizeof (UINT32));\r
+  CopyMem (&(Regs->E.EFLAGS), &(ThunkRegSet.E.EFLAGS), sizeof (UINT32));\r
 \r
-  Ret = (BOOLEAN) (Regs->E.EFlags.CF == 1);\r
+  Ret = (BOOLEAN) (Regs->E.EFLAGS.Bits.CF == 1);\r
 \r
   return Ret;\r
 }\r