]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/BiosVideoThunkDxe/LegacyBiosThunk.c
Fix Duet hang/reboot issue due to the NULL instance of CpuExceptionHandlerLib is...
[mirror_edk2.git] / DuetPkg / BiosVideoThunkDxe / LegacyBiosThunk.c
index e21ab362ef630b70e2d58e38dc842887db75c249..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