/** @file\r
\r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
// Pass in handoff data\r
//\r
TempData = (UINTN) EfiToLegacy16BootTable;\r
- Regs.X.ES = EFI_SEGMENT ((UINT32) TempData);\r
- Regs.X.BX = EFI_OFFSET ((UINT32) TempData);\r
+ Regs.X.ES = NORMALIZE_EFI_SEGMENT ((UINT32) TempData);\r
+ Regs.X.BX = NORMALIZE_EFI_OFFSET ((UINT32) TempData);\r
\r
Private->LegacyBios.FarCall86 (\r
This,\r
/** @file\r
\r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
#define PROTECTED_MODE_BASE_VECTOR_MASTER 0x68\r
#define PROTECTED_MODE_BASE_VECTOR_SLAVE 0x70\r
\r
+//\r
+// When we call CSM16 functions, some CSM16 use es:[offset + 0xabcd] to get data passed from CSM32, \r
+// offset + 0xabcd could overflow which exceeds 0xFFFF which is invalid in real mode. \r
+// So this will keep offset as small as possible to avoid offset overflow in real mode. \r
+//\r
+#define NORMALIZE_EFI_SEGMENT(_Adr) (UINT16) (((UINTN) (_Adr)) >> 4)\r
+#define NORMALIZE_EFI_OFFSET(_Adr) (UINT16) (((UINT16) ((UINTN) (_Adr))) & 0xf)\r
+\r
//\r
// Trace defines\r
//\r
/** @file\r
\r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
//\r
// Pass in handoff data\r
//\r
- Regs.X.ES = EFI_SEGMENT ((UINTN)EfiToLegacy16BootTable);\r
- Regs.X.BX = EFI_OFFSET ((UINTN)EfiToLegacy16BootTable);\r
+ Regs.X.ES = NORMALIZE_EFI_SEGMENT ((UINTN)EfiToLegacy16BootTable);\r
+ Regs.X.BX = NORMALIZE_EFI_OFFSET ((UINTN)EfiToLegacy16BootTable);\r
\r
Private->LegacyBios.FarCall86 (\r
This,\r