1) Sync EdkCompatibilityPkg with EDK 1.04. The changes includes:

1.1) Bug fixes. (For details, please check  Documents & files: Snapshot/Release Notes at https://edk.tianocore.org/servlets/ProjectDocumentList?folderID=43&expandFolder=43&folderID=6)
  1.2) Add new UEFI protocol definitions for AbsolutePointer, FormBrowser2, HiiConfigAccess, HiiConfigRouting, HiiDatabase, HiiFont, HiiImage, HiiString, SimpleTextInputEx, DPC protocol.
  1.3) Add Smbios 2.5, 2.6 supports.

  Incompatible changes hilighted:
  1) EFI_MANAGED_NETWORK_PROTOCOL_GUID changed.
  2) EFI_IP4_IPCONFIG_DATA changed.

2) Add in EdkCompatibilityPkg/EdkCompatibilityPkg.dsc to build all libraries in this package.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4623 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12
2008-01-24 07:10:05 +00:00
parent 2c40a813fc
commit c7f33ca424
448 changed files with 18656 additions and 5615 deletions

View File

@@ -84,21 +84,63 @@ GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DRIVER_MODEL_PROTOCOL_LIST _gDriverMode
// NOTE: Limitation:
// Only one handler for SetVirtualAddressMap Event and ExitBootServices Event each
//
/*
* This is the WRONG macro and it's kept only for backward compatibility.
*/
#ifdef __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT__HANDLER__
VOID
EFIAPI
__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT__HANDLER__ (
IN EFI_EVENT Event,
IN VOID *Context
);
#endif
/*
* This is the CORRECT macro users should use.
*/
#ifdef __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__
VOID
EFIAPI
__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__ (
IN EFI_EVENT Event,
IN VOID *Context
);
#endif
/*
* Both __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT__HANDLER__ and
* __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__ are kept here although
* the former is a WRONG macro. It's kept only for backward compatibility.
* For a single module, it's not likely that both macros are defined.
*/
GLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {
#ifdef __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT__HANDLER__
__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT__HANDLER__,
#endif
#ifdef __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__
__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__,
#endif
NULL
};
/*
* This is the WRONG macro and it's kept only for backward compatibility.
*/
#ifdef __EDKII_GLUE_EXTI_BOOT_SERVICES_EVENT__HANDLER__
VOID
__EDKII_GLUE_EXTI_BOOT_SERVICES_EVENT__HANDLER__ (
IN EFI_EVENT Event,
IN VOID *Context
);
#endif
/*
* This is the CORRECT macro users should use.
*/
#ifdef __EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__
VOID
__EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__ (
@@ -120,6 +162,13 @@ RuntimeDriverExitBootServices (
IN VOID *Context
);
/*
* Both __EDKII_GLUE_EXTI_BOOT_SERVICES_EVENT__HANDLER__ and
* __EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__ are kept here although
* the former is a WRONG macro. It's kept only for backward compatibility.
* For a single module, it's not likely that both macros are defined.
*/
GLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
//
@@ -127,9 +176,15 @@ GLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEve
//
RuntimeDriverExitBootServices,
#endif
#ifdef __EDKII_GLUE_EXTI_BOOT_SERVICES_EVENT__HANDLER__
__EDKII_GLUE_EXTI_BOOT_SERVICES_EVENT__HANDLER__,
#endif
#ifdef __EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__
__EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__,
#endif
NULL
};
@@ -167,6 +222,7 @@ ProcessModuleUnloadList (
// Library constructors
//
VOID
EFIAPI
ProcessLibraryConstructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -253,6 +309,7 @@ ProcessLibraryConstructorList (
// Library Destructors
//
VOID
EFIAPI
ProcessLibraryDestructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -309,16 +366,15 @@ _DriverUnloadHandler (
//
// Close our ExitBootServices () notify function
//
#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__
if (_gDriverExitBootServicesEvent[0] != NULL) {
ASSERT (gBS != NULL);
Status = gBS->CloseEvent (_mDriverExitBootServicesNotifyEvent);
ASSERT_EFI_ERROR (Status);
}
#endif
//
// NOTE: To allow passing in gST here, any library instance having a destructor
// must depend on EfiDriverLib
//
ProcessLibraryDestructorList (ImageHandle, gST);
}
@@ -352,6 +408,7 @@ Returns:
--*/
{
#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__
EFI_EVENT_NOTIFY ChildNotifyEventHandler;
UINTN Index;
@@ -359,6 +416,7 @@ Returns:
ChildNotifyEventHandler = _gDriverExitBootServicesEvent[Index];
ChildNotifyEventHandler (Event, NULL);
}
#endif
}
EFI_DRIVER_ENTRY_POINT (_ModuleEntryPoint);
@@ -393,7 +451,6 @@ _ModuleEntryPoint (
)
{
EFI_STATUS Status;
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
// if (_gUefiDriverRevision != 0) {
// //
@@ -414,6 +471,7 @@ _ModuleEntryPoint (
//
// Register our ExitBootServices () notify function
//
#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__
if (_gDriverExitBootServicesEvent[0] != NULL) {
Status = SystemTable->BootServices->CreateEvent (
EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,
@@ -425,17 +483,34 @@ _ModuleEntryPoint (
ASSERT_EFI_ERROR (Status);
}
#endif
//
// Install unload handler...
//
Status = SystemTable->BootServices->HandleProtocol (
ImageHandle,
&gEfiLoadedImageProtocolGuid,
(VOID **)&LoadedImage
);
ASSERT_EFI_ERROR (Status);
LoadedImage->Unload = _DriverUnloadHandler;
//
// Add conditional macro to save size. The 4 macros check against
// potential functions which may be invoked, if there is no function
// to be called, we don't register Unload callback.
//
#if ( defined(__EDKII_GLUE_MODULE_UNLOAD_HANDLER__) \
|| defined(__EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__) \
|| defined(__EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__) ) \
|| __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__
do {
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
Status = SystemTable->BootServices->HandleProtocol (
ImageHandle,
&gEfiLoadedImageProtocolGuid,
(VOID **)&LoadedImage
);
ASSERT_EFI_ERROR (Status);
LoadedImage->Unload = _DriverUnloadHandler;
} while(0);
#endif
//
// Call the driver entry point
@@ -453,11 +528,13 @@ _ModuleEntryPoint (
//
// Close our ExitBootServices () notify function
//
#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__
if (_gDriverExitBootServicesEvent[0] != NULL) {
EFI_STATUS CloseEventStatus;
CloseEventStatus = SystemTable->BootServices->CloseEvent (_mDriverExitBootServicesNotifyEvent);
ASSERT_EFI_ERROR (CloseEventStatus);
}
#endif
ProcessLibraryDestructorList (ImageHandle, SystemTable);
}

View File

@@ -32,20 +32,12 @@ Abstract:
// Library constructors
//
VOID
EFIAPI
ProcessLibraryConstructorList (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
)
{
//
// Declare "Status" if any of the following libraries are used
//
#if defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__) \
|| defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__) \
|| defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__)
EFI_STATUS Status;
#endif
//
// EdkII Glue Library Constructors:
// PeiServicesTablePointerLib PeiServicesTablePointerLibConstructor()
@@ -56,6 +48,8 @@ ProcessLibraryConstructorList (
#if defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__) \
|| defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__) \
|| defined(__EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__)
EFI_STATUS Status;
Status = PeiServicesTablePointerLibConstructor (FfsHeader, PeiServices);
ASSERT_EFI_ERROR (Status);
#endif

View File

@@ -56,6 +56,7 @@ ProcessModuleUnloadList (
// Library constructors
//
VOID
EFIAPI
ProcessLibraryConstructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -133,6 +134,7 @@ ProcessLibraryConstructorList (
// Library destructors
//
VOID
EFIAPI
ProcessLibraryDestructorList (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable

View File

@@ -1,6 +1,6 @@
/*++
Copyright (c) 2004 - 2006, Intel Corporation
Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -23,7 +23,11 @@ Abstract:
#ifndef __EDKII_GLUE_DEFINITION_CHANGES_BASE_H__
#define __EDKII_GLUE_DEFINITION_CHANGES_BASE_H__
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
#include "TianoHii.h"
#else
#include "EfiInternalFormRepresentation.h"
#endif
#include "EfiPxe.h"
@@ -47,7 +51,7 @@ Abstract:
// ----------------------------------------------------------------------------------
// InternalFormRepresentation.h:
// ----------------------------------------------------------------------------------
#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
typedef struct {
EFI_IFR_OP_HEADER Header;
UINT16 QuestionId; // The ID designating what the question is about...sucked in from a #define, likely in the form of a variable name
@@ -66,6 +70,7 @@ typedef struct {
typedef struct {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_END_EXPR;
#endif
// ------------------------
// define GUID as EFI_GUID

View File

@@ -1,6 +1,6 @@
/*++
Copyright (c) 2004 - 2006, Intel Corporation
Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -23,7 +23,11 @@ Abstract:
#ifndef __EDKII_GLUE_DEFINITION_CHANGES_DXE_H__
#define __EDKII_GLUE_DEFINITION_CHANGES_DXE_H__
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
#include "TianoHii.h"
#else
#include "EfiInternalFormRepresentation.h"
#endif
#include "EdkIIGlueDefinitionChangesBase.h"
@@ -59,8 +63,10 @@ typedef EFI_MISC_SMBIOS_STRUCT_ENCAPSULATION EFI_MISC_SMBIOS_STRUCT_ENCA
// -------------------
#define gEfiAcpiSupportProtocolGuid gEfiAcpiSupportGuid
#define gEfiLoadPeImageProtocolGuid gEfiLoadPeImageGuid
#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
#define EFI_GLYPH_NON_SPACING GLYPH_NON_SPACING
#define EFI_GLYPH_WIDE GLYPH_NON_BREAKING
#endif
#define BOOT_OBJECT_AUTHORIZATION_PARMSET_GUID BOOT_OBJECT_AUTHORIZATION_PARMSET_GUIDVALUE
#define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID
#define EFI_FILE_SYSTEM_VOLUME_LABEL_ID EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID_GUID
@@ -78,7 +84,9 @@ typedef EFI_MISC_SMBIOS_STRUCT_ENCAPSULATION EFI_MISC_SMBIOS_STRUCT_ENCA
//
typedef EFI_VOLUME_OPEN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME;
typedef EFI_TEXT_OUTPUT_STRING EFI_TEXT_STRING;
#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
typedef SCREEN_DESCRIPTOR EFI_SCREEN_DESCRIPTOR;
#endif
typedef EFI_SIMPLE_TEXT_IN_PROTOCOL EFI_SIMPLE_TEXT_INPUT_PROTOCOL;
typedef EFI_SIMPLE_TEXT_OUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;
//typedef EFI_TO_LEGACY16_INIT_TABLE EFI_TO_COMPATIBILITY16_INIT_TABLE;

View File

@@ -23,9 +23,14 @@ Abstract:
#ifndef __EDKII_GLUE_DEFINITION_CHANGES_PEIM_H__
#define __EDKII_GLUE_DEFINITION_CHANGES_PEIM_H__
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
#include "TianoHii.h"
#else
#include "EfiInternalFormRepresentation.h"
#endif
#include "EdkIIGlueDefinitionChangesBase.h"
#include "EfiPciCfg.h"
//

View File

@@ -61,6 +61,45 @@ Abstract:
#endif
#endif
//
// DxePerformanceLib
//
#ifdef __EDKII_GLUE_DXE_PERFORMANCE_LIB__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#ifndef __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__
#define __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__
#endif
#ifndef __EDKII_GLUE_DXE_HOB_LIB__
#define __EDKII_GLUE_DXE_HOB_LIB__
#endif
#ifndef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#define __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
#endif
#ifndef __EDKII_GLUE_UEFI_LIB__
#define __EDKII_GLUE_UEFI_LIB__
#endif
#endif
//
// PeiPerformanceLib
//
#ifdef __EDKII_GLUE_PEI_PERFORMANCE_LIB__
#ifndef __EDKII_GLUE_BASE_LIB__
#define __EDKII_GLUE_BASE_LIB__
#endif
#ifndef __EDKII_GLUE_BASE_MEMORY_LIB__
#define __EDKII_GLUE_BASE_MEMORY_LIB__
#endif
#ifndef __EDKII_GLUE_PEI_SERVICES_LIB__
#define __EDKII_GLUE_PEI_SERVICES_LIB__
#endif
#endif
//
// EdkDxeRuntimeDriverLib
//
@@ -554,6 +593,14 @@ Abstract:
//
#endif
//
// Whether _gDriverExitBootServicesEvent[] contains effective handler
//
#if defined(__EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__) || defined(__EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__)
#define __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__ 1
#else
#define __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__ 0
#endif
//
// Check against multiple instances of same library class being used
@@ -654,6 +701,7 @@ Abstract:
#ifdef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__
EFI_STATUS
EFIAPI
UefiBootServicesTableLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -671,6 +719,7 @@ IoLibConstructor (
#ifdef __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__
EFI_STATUS
EFIAPI
UefiRuntimeServicesTableLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -679,6 +728,7 @@ UefiRuntimeServicesTableLibConstructor (
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
EFI_STATUS
EFIAPI
RuntimeDriverLibConstruct (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -687,6 +737,7 @@ RuntimeDriverLibConstruct (
#ifdef __EDKII_GLUE_DXE_HOB_LIB__
EFI_STATUS
EFIAPI
HobLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -695,6 +746,7 @@ HobLibConstructor (
#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
EFI_STATUS
EFIAPI
UefiDriverModelLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -703,6 +755,7 @@ UefiDriverModelLibConstructor (
#ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB__
EFI_STATUS
EFIAPI
PeiServicesTablePointerLibConstructor (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
@@ -711,6 +764,7 @@ PeiServicesTablePointerLibConstructor (
#ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_MM7__
EFI_STATUS
EFIAPI
PeiServicesTablePointerLibConstructor (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
@@ -719,6 +773,7 @@ PeiServicesTablePointerLibConstructor (
#ifdef __EDKII_GLUE_PEI_SERVICES_TABLE_POINTER_LIB_KR1__
EFI_STATUS
EFIAPI
PeiServicesTablePointerLibConstructor (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
@@ -736,6 +791,7 @@ SmbusLibConstructor (
#ifdef __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__
EFI_STATUS
EFIAPI
DxeServicesTableLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -760,6 +816,7 @@ DxeSalLibConstructor (
//
#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__
EFI_STATUS
EFIAPI
UefiDriverModelLibDestructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -768,6 +825,7 @@ UefiDriverModelLibDestructor (
#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__
EFI_STATUS
EFIAPI
RuntimeDriverLibDeconstruct (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable

View File

@@ -30,6 +30,10 @@ Abstract:
#define BUILD_WITH_EDKII_GLUE_LIB
#endif
#ifndef BUILD_WITH_GLUELIB
#define BUILD_WITH_GLUELIB
#endif
//
// General Type & API definitions
//

View File

@@ -31,10 +31,12 @@ Abstract:
// 0x3000 - the 3rd release
// 0x5000 - support IPF. Jan, 2007
// 0x6000 - support EBC. Feb, 2007
// 0x7000 - size reduction, Jun, 2007
// 0x7100 - backward compatibility supported, Jun, 2007
//
// For reference only, don't change the value
//
#define EDKII_GLUE_LIBRARY_VERSION 0x6000
#define EDKII_GLUE_LIBRARY_VERSION 0x7100
//
@@ -84,21 +86,19 @@ Abstract:
//
// debug print level
// only when EFI_DEBUG is defined, the mask is effective
//
#define EDKII_GLUE_DebugPrintErrorLevel EFI_D_ERROR
//
// debug propery mask
// only when EFI_DEBUG is defined, the mask is effective
//
#define EDKII_GLUE_DebugPropertyMask ( DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED \
| DEBUG_PROPERTY_DEBUG_PRINT_ENABLED \
| DEBUG_PROPERTY_DEBUG_CODE_ENABLED \
| DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED \
| DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED \
| DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED \
)
#define EDKII_GLUE_DebugPropertyMask ( DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED \
| DEBUG_PROPERTY_DEBUG_PRINT_ENABLED \
| DEBUG_PROPERTY_DEBUG_CODE_ENABLED \
| DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED \
| DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED \
| DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED \
)
//
// clear memory value
@@ -115,23 +115,22 @@ Abstract:
// This value is FSB Clock frequency. Its unit is Hz and its
// default value is 200000000, that means FSB frequency is 200Mhz.
//
#define EDKII_GLUE_FSBClock 200000000
#define EDKII_GLUE_FSBClock 200000000
//
// post code property mask
//
#define EDKII_GLUE_PostCodePropertyMask ( POST_CODE_PROPERTY_POST_CODE_ENABLED \
| POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED \
| POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED \
)
//
// status code property mask
//
#define EDKII_GLUE_ReportStatusCodePropertyMask ( REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED \
| REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED \
| REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED \
)
| REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED \
| REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED \
)
//
// for IPF only

View File

@@ -39,8 +39,13 @@ Abstract:
#include "EfiFirmwareVolumeHeader.h"
#include "EfiFirmwareFileSystem.h"
#include "PeiHob.h"
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
#include "TianoHii.h"
#else
#include "EfiInternalFormRepresentation.h"
#endif
#include "EfiStatusCode.h"
#include "EfiPerf.h"
//
// IPF only
@@ -90,10 +95,20 @@ Abstract:
// resolved when porting a module to real EDK II
//
#include EFI_GUID_DEFINITION (StatusCodeDataTypeId)
#include EFI_GUID_DEFINITION (PeiPerformanceHob)
//
// Protocol definitions
//
#if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
#include EFI_PROTOCOL_DEFINITION (FormBrowser2)
#include EFI_PROTOCOL_DEFINITION (HiiConfigAccess)
#include EFI_PROTOCOL_DEFINITION (HiiConfigRouting)
#include EFI_PROTOCOL_DEFINITION (HiiDatabase)
#include EFI_PROTOCOL_DEFINITION (HiiFont)
#include EFI_PROTOCOL_DEFINITION (HiiImage)
#include EFI_PROTOCOL_DEFINITION (HiiString)
#endif
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
#include EFI_PROTOCOL_DEFINITION (DevicePathFromText)
@@ -120,7 +135,9 @@ Abstract:
#include EFI_PROTOCOL_DEFINITION (BootScriptSave)
#include EFI_PROTOCOL_DEFINITION (BusSpecificDriverOverride)
#include EFI_PROTOCOL_DEFINITION (ComponentName)
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
#include EFI_PROTOCOL_DEFINITION (ComponentName2)
#endif
#include EFI_PROTOCOL_DEFINITION (CpuIo)
#include EFI_PROTOCOL_DEFINITION (DataHub)
#include EFI_PROTOCOL_DEFINITION (DebugPort)
@@ -140,10 +157,14 @@ Abstract:
#include EFI_PROTOCOL_DEFINITION (FirmwareVolume)
#include EFI_PROTOCOL_DEFINITION (FirmwareVolumeBlock)
#include EFI_PROTOCOL_DEFINITION (FirmwareVolumeDispatch)
#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
#include EFI_PROTOCOL_DEFINITION (FormBrowser)
#include EFI_PROTOCOL_DEFINITION (FormCallback)
#endif
#include EFI_PROTOCOL_DEFINITION (GuidedSectionExtraction)
#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
#include EFI_PROTOCOL_DEFINITION (Hii)
#endif
#include EFI_PROTOCOL_DEFINITION (IdeControllerInit)
#include EFI_PROTOCOL_DEFINITION (IncompatiblePciDeviceSupport)
#include EFI_PROTOCOL_DEFINITION (Legacy8259)

View File

@@ -45,6 +45,7 @@ Abstract:
#include "EfiCapsule.h"
#include EFI_PROTOCOL_DEFINITION (DevicePath)
#include "TianoDevicePath.h"
#include "PeiPerf.h"
//
// GUID definitions
@@ -58,6 +59,8 @@ Abstract:
#include EFI_GUID_DEFINITION (FirmwareFileSystem)
#include EFI_GUID_DEFINITION (SmramMemoryReserve)
#include EFI_GUID_DEFINITION (DataHubRecords)
#include EFI_GUID_DEFINITION (PeiPerformanceHob)
//
// *** NOTE ***: StatusCodeDataTypeId definition differences need to be
// resolved when porting a module to real EDK II

View File

@@ -73,7 +73,9 @@ Abstract:
#include EFI_PROTOCOL_DEFINITION(Bis)
#include EFI_PROTOCOL_DEFINITION(BusSpecificDriverOverride)
#include EFI_PROTOCOL_DEFINITION(ComponentName)
#include EFI_PROTOCOL_DEFINITION(ComponentName2)
#if (EFI_SPECIFICATION_VERSION >= 0x00020000)
#include EFI_PROTOCOL_DEFINITION (ComponentName2)
#endif
#include EFI_PROTOCOL_DEFINITION(DebugPort)
#include EFI_PROTOCOL_DEFINITION(DebugSupport)
#include EFI_PROTOCOL_DEFINITION(Decompress)

View File

@@ -37,5 +37,32 @@ Abstract:
#ifndef MDE_CPU_IPF
#define MDE_CPU_IPF
#endif
//
// IPF Specific Functions
//
typedef struct {
UINT64 Status;
UINT64 r9;
UINT64 r10;
UINT64 r11;
} PAL_CALL_RETURN;
#define EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_LO 0x4871260ec1a74056
#define EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID_HI 0x116e5ba645e631a0
#define EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_LO 0x4d02efdb7e97a470
#define EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID_HI 0x96a27bd29061ce8f
#define EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_LO 0x4370c6414ecb6c53
#define EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID_HI 0x78836e490e3bb28c
#define EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_LO 0x408b75e8899afd18
#define EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID_HI 0x54f4cd7e2e6e1aa4
#define EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_LO 0x46f58ce17d019990
#define EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID_HI 0xa06a6798513c76a7
#endif

View File

@@ -97,6 +97,19 @@ Abstract:
#define EFI_D_EVENT DEBUG_EVENT
#define EFI_D_ERROR DEBUG_ERROR
//
// Use the following 4 macros to save size
//
#define DebugAssertEnabled() ((BOOLEAN)((__EDKII_GLUE_PCD_PcdDebugPropertyMask__ & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0))
#define DebugPrintEnabled() ((BOOLEAN)((__EDKII_GLUE_PCD_PcdDebugPropertyMask__ & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0))
#define DebugCodeEnabled() ((BOOLEAN)((__EDKII_GLUE_PCD_PcdDebugPropertyMask__ & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0))
#define DebugClearMemoryEnabled() ((BOOLEAN)((__EDKII_GLUE_PCD_PcdDebugPropertyMask__ & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0))
/**
Prints a debug message to the debug output device if the specified error level is enabled.
@@ -177,78 +190,6 @@ DebugClearMemory (
);
/**
Returns TRUE if ASSERT() macros are enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugAssertEnabled (
VOID
);
/**
Returns TRUE if DEBUG()macros are enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugPrintEnabled (
VOID
);
/**
Returns TRUE if DEBUG_CODE()macros are enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugCodeEnabled (
VOID
);
/**
Returns TRUE if DEBUG_CLEAR_MEMORY()macro is enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugClearMemoryEnabled (
VOID
);
/**
Internal worker macro that calls DebugAssert().
@@ -259,8 +200,12 @@ DebugClearMemoryEnabled (
@param Expression Boolean expression that evailated to FALSE
**/
#ifdef EFI_DEBUG
#define _ASSERT(Expression) DebugAssert (__FILE__, __LINE__, #Expression)
#else
#define _ASSERT(Expression)
#endif
/**
@@ -273,8 +218,12 @@ DebugClearMemoryEnabled (
and a variable argument list based on the format string.
**/
#ifdef EFI_DEBUG
#define _DEBUG(Expression) DebugPrint Expression
#else
#define _DEBUG(Expression)
#endif
/**
@@ -443,6 +392,7 @@ DebugClearMemoryEnabled (
@param Guid Pointer to a protocol GUID.
**/
#ifdef EFI_DEBUG
#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid) \
do { \
if (DebugAssertEnabled ()) { \
@@ -459,6 +409,10 @@ DebugClearMemoryEnabled (
} \
} \
} while (FALSE)
#else
#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid) \
do {} while(0);
#endif
/**
@@ -563,9 +517,15 @@ DebugClearMemoryEnabled (
@param TestSignature The 32-bit signature value to match.
**/
#define CR(Record, TYPE, Field, TestSignature) \
(DebugAssertEnabled () && (_CR (Record, TYPE, Field)->Signature != TestSignature)) ? \
(TYPE *) (_ASSERT (CR has Bad Signature), Record) : \
_CR (Record, TYPE, Field)
#ifdef EFI_DEBUG
#define CR(Record, TYPE, Field, TestSignature) \
(DebugAssertEnabled () && (_CR (Record, TYPE, Field)->Signature != TestSignature)) ? \
(TYPE *) (_ASSERT (CR has Bad Signature), Record) : \
_CR (Record, TYPE, Field)
#else
#define CR(Record, TYPE, Field, TestSignature) \
_CR (Record, TYPE, Field)
#endif
#endif

View File

@@ -250,6 +250,7 @@ EfiGetNextHighMonotonicCount (
**/
VOID
EFIAPI
EfiResetSystem (
IN EFI_RESET_TYPE ResetType,
IN EFI_STATUS ResetStatus,

View File

@@ -1,6 +1,6 @@
/*++
Copyright (c) 2004 - 2006, Intel Corporation
Copyright (c) 2004 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -23,6 +23,7 @@ Abstract:
#ifndef __EDKII_GLUE_HII_LIB_H__
#define __EDKII_GLUE_HII_LIB_H__
#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
#define PreparePackages GluePreparePackages
@@ -49,6 +50,6 @@ GluePreparePackages (
)
;
#endif
#endif

View File

@@ -63,7 +63,7 @@ COMPONENT_TYPE = LIBRARY
[nmake.common]
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
[nmake.ia32]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -76,6 +76,6 @@ COMPONENT_TYPE = LIBRARY
[nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC

View File

@@ -62,7 +62,7 @@ COMPONENT_TYPE = LIBRARY
[nmake.common]
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
[nmake.ia32]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -75,5 +75,5 @@ COMPONENT_TYPE = LIBRARY
[nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC

View File

@@ -108,86 +108,3 @@ DebugClearMemory (
return Buffer;
}
/**
Returns TRUE if ASSERT() macros are enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugAssertEnabled (
VOID
)
{
return FALSE;
}
/**
Returns TRUE if DEBUG()macros are enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugPrintEnabled (
VOID
)
{
return FALSE;
}
/**
Returns TRUE if DEBUG_CODE()macros are enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugCodeEnabled (
VOID
)
{
return FALSE;
}
/**
Returns TRUE if DEBUG_CLEAR_MEMORY()macro is enabled.
This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of
PcdDebugProperyMask is set. Otherwise FALSE is returned.
@retval TRUE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
@retval FALSE The DEBUG_PROPERTY_DEBUG_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
**/
BOOLEAN
EFIAPI
DebugClearMemoryEnabled (
VOID
)
{
return FALSE;
}

View File

@@ -68,7 +68,7 @@ COMPONENT_TYPE = LIBRARY
[nmake.common]
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
[nmake.ia32]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -81,5 +81,5 @@ COMPONENT_TYPE = LIBRARY
[nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC

View File

@@ -20,7 +20,7 @@ Abstract:
--*/
#include "BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Shifts a 64-bit integer right between 0 and 63 bits. The high bits are filled

View File

@@ -26,7 +26,6 @@ COMPONENT_TYPE = LIBRARY
[sources.common]
String.c
LinkedList.c
Synchronization.c
Cpu.c
CpuDeadLoop.c
BitField.c
@@ -57,8 +56,10 @@ COMPONENT_TYPE = LIBRARY
SwapBytes32.c
SwapBytes64.c
SwitchStack.c
CheckSum.c
[sources.ia32]
SynchronizationMsc.c
x86DisablePaging32.c
x86DisablePaging64.c
x86EnablePaging32.c
@@ -74,107 +75,109 @@ COMPONENT_TYPE = LIBRARY
x86WriteGdtr.c
x86WriteIdtr.c
Unaligned.c
Ia32\Non-existing.c
Ia32\InternalSwitchStack.c
Ia32\DivS64x64Remainder.c
Ia32\ARShiftU64.asm
Ia32\CpuBreakpoint.asm
Ia32\CpuFlushTlb.asm
Ia32\CpuSleep.asm
Ia32\CpuId.asm
Ia32\CpuIdEx.asm
Ia32\CpuPause.asm
Ia32\DisableInterrupts.asm
Ia32\DisablePaging32.asm
Ia32\DivU64x32.asm
Ia32\DivU64x32Remainder.asm
Ia32\DivU64x64Remainder.asm
Ia32\EnableDisableInterrupts.asm
Ia32\EnableInterrupts.asm
Ia32\EnablePaging32.asm
Ia32\EnablePaging64.asm
Ia32\FlushCacheLine.asm
Ia32\FxSave.asm
Ia32\FxRestore.asm
Ia32\InterlockedIncrement.asm
Ia32\InterlockedDecrement.asm
Ia32\InterlockedCompareExchange32.asm
Ia32\InterlockedCompareExchange64.asm
Ia32\Invd.asm
Ia32\LongJump.asm
Ia32\LRotU64.asm
Ia32\LShiftU64.asm
Ia32\MultU64x32.asm
Ia32\MultU64x64.asm
Ia32\ModU64x32.asm
Ia32\Monitor.asm
Ia32\Mwait.asm
Ia32\ReadCr0.asm
Ia32\ReadCr2.asm
Ia32\ReadCr3.asm
Ia32\ReadCr4.asm
Ia32\ReadDr0.asm
Ia32\ReadDr1.asm
Ia32\ReadDr2.asm
Ia32\ReadDr3.asm
Ia32\ReadDr4.asm
Ia32\ReadDr5.asm
Ia32\ReadDr6.asm
Ia32\ReadDr7.asm
Ia32\ReadEflags.asm
Ia32\ReadMm0.asm
Ia32\ReadMm1.asm
Ia32\ReadMm2.asm
Ia32\ReadMm3.asm
Ia32\ReadMm4.asm
Ia32\ReadMm5.asm
Ia32\ReadMm6.asm
Ia32\ReadMm7.asm
Ia32\ReadMsr64.asm
Ia32\ReadCs.asm
Ia32\ReadDs.asm
Ia32\ReadEs.asm
Ia32\ReadFs.asm
Ia32\ReadGs.asm
Ia32\ReadSs.asm
Ia32\ReadTr.asm
Ia32\ReadGdtr.asm
Ia32\ReadIdtr.asm
Ia32\ReadLdtr.asm
Ia32\ReadTsc.asm
Ia32\ReadPmc.asm
Ia32\RShiftU64.asm
Ia32\RRotU64.asm
Ia32\SetJump.asm
Ia32\SwapBytes64.asm
Ia32\Thunk16.asm
Ia32\WriteMsr64.asm
Ia32\WriteCr0.asm
Ia32\WriteCr2.asm
Ia32\WriteCr3.asm
Ia32\WriteCr4.asm
Ia32\WriteDr0.asm
Ia32\WriteDr1.asm
Ia32\WriteDr2.asm
Ia32\WriteDr3.asm
Ia32\WriteDr4.asm
Ia32\WriteDr5.asm
Ia32\WriteDr6.asm
Ia32\WriteDr7.asm
Ia32\WriteGdtr.asm
Ia32\WriteIdtr.asm
Ia32\WriteLdtr.asm
Ia32\WriteMm0.asm
Ia32\WriteMm1.asm
Ia32\WriteMm2.asm
Ia32\WriteMm3.asm
Ia32\WriteMm4.asm
Ia32\WriteMm5.asm
Ia32\WriteMm6.asm
Ia32\WriteMm7.asm
Ia32\Wbinvd.asm
Ia32/Non-existing.c
Ia32/InternalSwitchStack.c
Ia32/DivS64x64Remainder.c
Ia32/ARShiftU64.c
Ia32/CpuBreakpoint.c
Ia32/CpuFlushTlb.c
Ia32/CpuSleep.c
Ia32/CpuId.c
Ia32/CpuIdEx.c
Ia32/CpuPause.c
Ia32/DisableInterrupts.c
Ia32/DisablePaging32.c
Ia32/DivU64x32.c
Ia32/DivU64x32Remainder.c
Ia32/DivU64x64Remainder.c
Ia32/EnableDisableInterrupts.c
Ia32/EnableInterrupts.c
Ia32/EnablePaging32.c
Ia32/EnablePaging64.asm
Ia32/FlushCacheLine.c
Ia32/FxSave.c
Ia32/FxRestore.c
Ia32/InterlockedIncrement.c
Ia32/InterlockedDecrement.c
Ia32/InterlockedCompareExchange32.c
Ia32/InterlockedCompareExchange64.c
Ia32/Invd.c
Ia32/LongJump.c
Ia32/LRotU64.c
Ia32/LShiftU64.c
Ia32/MultU64x32.c
Ia32/MultU64x64.c
Ia32/ModU64x32.c
Ia32/Monitor.c
Ia32/Mwait.c
Ia32/ReadCr0.c
Ia32/ReadCr2.c
Ia32/ReadCr3.c
Ia32/ReadCr4.c
Ia32/ReadDr0.c
Ia32/ReadDr1.c
Ia32/ReadDr2.c
Ia32/ReadDr3.c
Ia32/ReadDr4.c
Ia32/ReadDr5.c
Ia32/ReadDr6.c
Ia32/ReadDr7.c
Ia32/ReadEflags.c
Ia32/ReadMm0.c
Ia32/ReadMm1.c
Ia32/ReadMm2.c
Ia32/ReadMm3.c
Ia32/ReadMm4.c
Ia32/ReadMm5.c
Ia32/ReadMm6.c
Ia32/ReadMm7.c
Ia32/ReadMsr64.c
Ia32/ReadCs.c
Ia32/ReadDs.c
Ia32/ReadEs.c
Ia32/ReadFs.c
Ia32/ReadGs.c
Ia32/ReadSs.c
Ia32/ReadTr.c
Ia32/ReadGdtr.c
Ia32/ReadIdtr.c
Ia32/ReadLdtr.c
Ia32/ReadTsc.c
Ia32/ReadPmc.c
Ia32/RShiftU64.c
Ia32/RRotU64.c
Ia32/SetJump.c
Ia32/SwapBytes64.c
Ia32/Thunk16.asm
Ia32/WriteMsr64.c
Ia32/WriteCr0.c
Ia32/WriteCr2.c
Ia32/WriteCr3.c
Ia32/WriteCr4.c
Ia32/WriteDr0.c
Ia32/WriteDr1.c
Ia32/WriteDr2.c
Ia32/WriteDr3.c
Ia32/WriteDr4.c
Ia32/WriteDr5.c
Ia32/WriteDr6.c
Ia32/WriteDr7.c
Ia32/WriteGdtr.c
Ia32/WriteIdtr.c
Ia32/WriteLdtr.c
Ia32/WriteMm0.c
Ia32/WriteMm1.c
Ia32/WriteMm2.c
Ia32/WriteMm3.c
Ia32/WriteMm4.c
Ia32/WriteMm5.c
Ia32/WriteMm6.c
Ia32/WriteMm7.c
Ia32/Wbinvd.c
[sources.x64]
SynchronizationMsc.c
x86DisablePaging32.c
x86DisablePaging64.c
x86EnablePaging32.c
@@ -191,119 +194,130 @@ COMPONENT_TYPE = LIBRARY
x86WriteIdtr.c
Unaligned.c
Math64.c
X64\Non-existing.c
X64\SwitchStack.asm
X64\SetJump.asm
X64\LongJump.asm
X64\CpuId.asm
X64\CpuIdEx.asm
X64\ReadEflags.asm
X64\ReadMsr64.asm
X64\WriteMsr64.asm
X64\ReadCr0.asm
X64\ReadCr2.asm
X64\ReadCr3.asm
X64\ReadCr4.asm
X64\WriteCr0.asm
X64\WriteCr2.asm
X64\WriteCr3.asm
X64\WriteCr4.asm
X64\ReadDr0.asm
X64\ReadDr1.asm
X64\ReadDr2.asm
X64\ReadDr3.asm
X64\ReadDr4.asm
X64\ReadDr5.asm
X64\ReadDr6.asm
X64\ReadDr7.asm
X64\WriteDr0.asm
X64\WriteDr1.asm
X64\WriteDr2.asm
X64\WriteDr3.asm
X64\WriteDr4.asm
X64\WriteDr5.asm
X64\WriteDr6.asm
X64\WriteDr7.asm
X64\ReadCs.asm
X64\ReadDs.asm
X64\ReadEs.asm
X64\ReadFs.asm
X64\ReadGs.asm
X64\ReadSs.asm
X64\ReadTr.asm
X64\ReadGdtr.asm
X64\WriteGdtr.asm
X64\ReadIdtr.asm
X64\WriteIdtr.asm
X64\ReadLdtr.asm
X64\WriteLdtr.asm
X64\FxSave.asm
X64\FxRestore.asm
X64\ReadMm0.asm
X64\ReadMm1.asm
X64\ReadMm2.asm
X64\ReadMm3.asm
X64\ReadMm4.asm
X64\ReadMm5.asm
X64\ReadMm6.asm
X64\ReadMm7.asm
X64\WriteMm0.asm
X64\WriteMm1.asm
X64\WriteMm2.asm
X64\WriteMm3.asm
X64\WriteMm4.asm
X64\WriteMm5.asm
X64\WriteMm6.asm
X64\WriteMm7.asm
X64\ReadTsc.asm
X64\ReadPmc.asm
X64\Monitor.asm
X64\Mwait.asm
X64\EnablePaging64.asm
X64\DisablePaging64.asm
X64\Wbinvd.asm
X64\Invd.asm
X64\FlushCacheLine.asm
X64\InterlockedIncrement.asm
X64\InterlockedDecrement.asm
X64\InterlockedCompareExchange32.asm
X64\InterlockedCompareExchange64.asm
X64\EnableInterrupts.asm
X64\DisableInterrupts.asm
X64\EnableDisableInterrupts.asm
X64\CpuSleep.asm
X64\CpuPause.asm
X64\CpuBreakpoint.asm
X64\CpuFlushTlb.asm
X64\Thunk16.asm
X64/Non-existing.c
X64/SwitchStack.asm
X64/SetJump.asm
X64/LongJump.asm
X64/CpuId.asm
X64/CpuIdEx.asm
X64/ReadEflags.asm
X64/ReadMsr64.c
X64/WriteMsr64.c
X64/ReadCr0.asm
X64/ReadCr2.asm
X64/ReadCr3.asm
X64/ReadCr4.asm
X64/WriteCr0.asm
X64/WriteCr2.asm
X64/WriteCr3.asm
X64/WriteCr4.asm
X64/ReadDr0.asm
X64/ReadDr1.asm
X64/ReadDr2.asm
X64/ReadDr3.asm
X64/ReadDr4.asm
X64/ReadDr5.asm
X64/ReadDr6.asm
X64/ReadDr7.asm
X64/WriteDr0.asm
X64/WriteDr1.asm
X64/WriteDr2.asm
X64/WriteDr3.asm
X64/WriteDr4.asm
X64/WriteDr5.asm
X64/WriteDr6.asm
X64/WriteDr7.asm
X64/ReadCs.asm
X64/ReadDs.asm
X64/ReadEs.asm
X64/ReadFs.asm
X64/ReadGs.asm
X64/ReadSs.asm
X64/ReadTr.asm
X64/ReadGdtr.asm
X64/WriteGdtr.asm
X64/ReadIdtr.asm
X64/WriteIdtr.asm
X64/ReadLdtr.asm
X64/WriteLdtr.asm
X64/FxSave.asm
X64/FxRestore.asm
X64/ReadMm0.asm
X64/ReadMm1.asm
X64/ReadMm2.asm
X64/ReadMm3.asm
X64/ReadMm4.asm
X64/ReadMm5.asm
X64/ReadMm6.asm
X64/ReadMm7.asm
X64/WriteMm0.asm
X64/WriteMm1.asm
X64/WriteMm2.asm
X64/WriteMm3.asm
X64/WriteMm4.asm
X64/WriteMm5.asm
X64/WriteMm6.asm
X64/WriteMm7.asm
X64/ReadTsc.asm
X64/ReadPmc.asm
X64/Monitor.asm
X64/Mwait.asm
X64/EnablePaging64.asm
X64/DisablePaging64.asm
X64/Wbinvd.asm
X64/Invd.asm
X64/FlushCacheLine.asm
X64/InterlockedIncrement.c
X64/InterlockedDecrement.c
X64/InterlockedCompareExchange32.asm
X64/InterlockedCompareExchange64.asm
X64/EnableInterrupts.asm
X64/DisableInterrupts.asm
X64/EnableDisableInterrupts.asm
X64/CpuSleep.asm
X64/CpuPause.asm
X64/CpuBreakpoint.c
X64/CpuFlushTlb.asm
X64/Thunk16.asm
[sources.ipf]
SynchronizationMsc.c
Math64.c
Ipf\asm.h
Ipf\ia_64gen.h
Ipf\PalCallStatic.s
Ipf\setjmp.s
Ipf\longjmp.s
Ipf\SwitchStack.s
Ipf\Unaligned.c
Ipf\CpuBreakpoint.c
Ipf\InterlockedCompareExchange32.s
Ipf\InterlockedCompareExchange64.s
Ipf\Synchronization.c
Ipf\CpuPause.s
Ipf\CpuFlushTlb.s
Ipf\GetInterruptState.s
Ipf\Non-existing.c
Ipf\FlushCacheRange.s
Ipf\ReadItc.s
Ipf/asm.h
Ipf/ia_64gen.h
Ipf/PalCallStatic.s
Ipf/setjmp.s
Ipf/longjmp.s
Ipf/SwitchStack.s
Ipf/Unaligned.c
Ipf/CpuBreakpoint.c
Ipf/InterlockedCompareExchange32.s
Ipf/InterlockedCompareExchange64.s
Ipf/Synchronization.c
Ipf/CpuPause.s
Ipf/CpuFlushTlb.s
Ipf/GetInterruptState.s
Ipf/InternalSwitchStack.c
Ipf/FlushCacheRange.s
Ipf/AccessDbr.s
Ipf/AccessEicr.s
Ipf/AccessGcr.s
Ipf/AccessKr.s
Ipf/AccessPmr.s
Ipf/AccessPsr.s
Ipf/AsmPalCall.s
Ipf/ExecFc.s
Ipf/ReadCpuid.s
Ipf/AccessGp.s
[sources.ebc]
Math64.c
Unaligned.c
Ebc\SwitchStack.c
Ebc\SetJumpLongJump.c
Ebc\CpuBreakpoint.c
Ebc\Synchronization.c
Ebc/SwitchStack.c
Ebc/SetJumpLongJump.c
Ebc/CpuBreakpoint.c
Ebc/Synchronization.c
Synchronization.c
[includes.common]
.
@@ -343,7 +357,7 @@ COMPONENT_TYPE = LIBRARY
[nmake.common]
C_FLAGS = $(C_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006
LIB_STD_FLAGS = $(LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
[nmake.ia32]
C_FLAGS = $(C_FLAGS) /D MDE_CPU_IA32
@@ -356,6 +370,6 @@ COMPONENT_TYPE = LIBRARY
[nmake.ebc]
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D EDKII_GLUE_LIBRARY_IMPLEMENTATION
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006
EBC_LIB_STD_FLAGS = $(EBC_LIB_STD_FLAGS) /IGNORE:4006 /IGNORE:4221
EBC_C_STD_FLAGS = $(EBC_C_STD_FLAGS) /D MDE_CPU_EBC

View File

@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
BaseLibInternal.h
BaseLibInternals.h
Abstract:
@@ -20,8 +20,8 @@ Abstract:
--*/
#ifndef __BASE_LIB_INTERNAL_H__
#define __BASE_LIB_INTERNAL_H__
#ifndef __BASE_LIB_INTERNALS_H__
#define __BASE_LIB_INTERNALS_H__
#include "EdkIIGlueBase.h"
@@ -322,10 +322,16 @@ InternalMathDivRemS64x64 (
/**
Transfers control to a function starting with a new stack.
Transfers control to the function specified by EntryPoint using the new stack
specified by NewStack and passing in the parameters specified by Context1 and
Context2. Context1 and Context2 are optional and may be NULL. The function
EntryPoint must never return.
Transfers control to the function specified by EntryPoint using the
new stack specified by NewStack and passing in the parameters specified
by Context1 and Context2. Context1 and Context2 are optional and may
be NULL. The function EntryPoint must never return.
Marker will be ignored on IA-32, x64, and EBC.
IPF CPUs expect one additional parameter of type VOID * that specifies
the new backing store pointer.
If EntryPoint is NULL, then ASSERT().
If NewStack is NULL, then ASSERT().
@param EntryPoint A pointer to function to call with the new stack.
@param Context1 A pointer to the context to pass into the EntryPoint
@@ -334,20 +340,250 @@ InternalMathDivRemS64x64 (
function.
@param NewStack A pointer to the new stack to use for the EntryPoint
function.
@param Marker VA_LIST marker for the variable argument list.
**/
VOID
EFIAPI
InternalSwitchStack (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1,
IN VOID *Context2,
IN VOID *NewStack
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack,
IN VA_LIST Marker
);
/**
Worker function that locates the Node in the List
By searching the List, finds the location of the Node in List. At the same time,
verifies the validity of this list.
If List is NULL, then ASSERT().
If List->ForwardLink is NULL, then ASSERT().
If List->backLink is NULL, then ASSERT().
If Node is NULL, then ASSERT();
If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
of nodes in ListHead, including the ListHead node, is greater than or
equal to PcdMaximumLinkedListLength, then ASSERT().
@param List A pointer to a node in a linked list.
@param Node A pointer to one nod.
@retval TRUE Node is in List
@retval FALSE Node isn't in List, or List is invalid
**/
BOOLEAN
IsNodeInList (
IN CONST LIST_ENTRY *List,
IN CONST LIST_ENTRY *Node
);
/**
Performs an atomic increment of an 32-bit unsigned integer.
Performs an atomic increment of the 32-bit unsigned integer specified by
Value and returns the incremented value. The increment operation must be
performed using MP safe mechanisms. The state of the return value is not
guaranteed to be MP safe.
@param Value A pointer to the 32-bit value to increment.
@return The incremented value.
**/
UINT32
EFIAPI
InternalSyncIncrement (
IN volatile UINT32 *Value
);
/**
Performs an atomic decrement of an 32-bit unsigned integer.
Performs an atomic decrement of the 32-bit unsigned integer specified by
Value and returns the decrement value. The decrement operation must be
performed using MP safe mechanisms. The state of the return value is not
guaranteed to be MP safe.
@param Value A pointer to the 32-bit value to decrement.
@return The decrement value.
**/
UINT32
EFIAPI
InternalSyncDecrement (
IN volatile UINT32 *Value
);
/**
Performs an atomic compare exchange operation on a 32-bit unsigned integer.
Performs an atomic compare exchange operation on the 32-bit unsigned integer
specified by Value. If Value is equal to CompareValue, then Value is set to
ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
then Value is returned. The compare exchange operation must be performed using
MP safe mechanisms.
@param Value A pointer to the 32-bit value for the compare exchange
operation.
@param CompareValue 32-bit value used in compare operation.
@param ExchangeValue 32-bit value used in exchange operation.
@return The original *Value before exchange.
**/
UINT32
EFIAPI
InternalSyncCompareExchange32 (
IN volatile UINT32 *Value,
IN UINT32 CompareValue,
IN UINT32 ExchangeValue
);
/**
Performs an atomic compare exchange operation on a 64-bit unsigned integer.
Performs an atomic compare exchange operation on the 64-bit unsigned integer specified
by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and
CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.
The compare exchange operation must be performed using MP safe mechanisms.
@param Value A pointer to the 64-bit value for the compare exchange
operation.
@param CompareValue 64-bit value used in compare operation.
@param ExchangeValue 64-bit value used in exchange operation.
@return The original *Value before exchange.
**/
UINT64
EFIAPI
InternalSyncCompareExchange64 (
IN volatile UINT64 *Value,
IN UINT64 CompareValue,
IN UINT64 ExchangeValue
);
/**
Worker function that returns a bit field from Operand
Returns the bitfield specified by the StartBit and the EndBit from Operand.
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@param EndBit The ordinal of the most significant bit in the bit field.
@return The bit field read.
**/
unsigned int
BitFieldReadUint (
IN unsigned int Operand,
IN UINTN StartBit,
IN UINTN EndBit
);
/**
Worker function that reads a bit field from Operand, performs a bitwise OR,
and returns the result.
Performs a bitwise OR between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData. All other bits in Operand are
preserved. The new value is returned.
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@param EndBit The ordinal of the most significant bit in the bit field.
@param OrData The value to OR with the read value from the value
@return The new value.
**/
unsigned int
BitFieldOrUint (
IN unsigned int Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN unsigned int OrData
);
/**
Worker function that reads a bit field from Operand, performs a bitwise AND,
and returns the result.
Performs a bitwise AND between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData. All other bits in Operand are
preserved. The new value is returned.
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@param EndBit The ordinal of the most significant bit in the bit field.
@param AndData The value to And with the read value from the value
@return The new value.
**/
unsigned int
BitFieldAndUint (
IN unsigned int Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN unsigned int AndData
);
/**
Worker function that checks ASSERT condition for JumpBuffer
Checks ASSERT condition for JumpBuffer.
If JumpBuffer is NULL, then ASSERT().
For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().
@param JumpBuffer A pointer to CPU context buffer.
**/
VOID
EFIAPI
InternalAssertJumpBuffer (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
);
/**
Restores the CPU context that was saved with SetJump().
Restores the CPU context from the buffer specified by JumpBuffer.
This function never returns to the caller.
Instead is resumes execution based on the state of JumpBuffer.
@param JumpBuffer A pointer to CPU context buffer.
@param Value The value to return when the SetJump() context is restored.
**/
VOID
EFIAPI
InternalLongJump (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
IN UINTN Value
);
//
// Ia32 and x64 specific functions
//
#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
/**
Reads the current Global Descriptor Table Register(GDTR) descriptor.
@@ -595,219 +831,46 @@ InternalX86DisablePaging64 (
IN UINT32 NewStack
);
/**
Worker function that locates the Node in the List
By searching the List, finds the location of the Node in List. At the same time,
verifies the validity of this list.
If List is NULL, then ASSERT().
If List->ForwardLink is NULL, then ASSERT().
If List->backLink is NULL, then ASSERT().
If Node is NULL, then ASSERT();
If PcdMaximumLinkedListLenth is not zero, and prior to insertion the number
of nodes in ListHead, including the ListHead node, is greater than or
equal to PcdMaximumLinkedListLength, then ASSERT().
@param List A pointer to a node in a linked list.
@param Node A pointer to one nod.
@retval TRUE Node is in List
@retval FALSE Node isn't in List, or List is invalid
**/
BOOLEAN
IsNodeInList (
IN CONST LIST_ENTRY *List,
IN CONST LIST_ENTRY *Node
);
#elif defined (MDE_CPU_IPF)
//
//
// IPF specific functions
//
/**
Performs an atomic increment of an 32-bit unsigned integer.
Transfers control to a function starting with a new stack.
Performs an atomic increment of the 32-bit unsigned integer specified by
Value and returns the incremented value. The increment operation must be
performed using MP safe mechanisms. The state of the return value is not
guaranteed to be MP safe.
Transfers control to the function specified by EntryPoint using the new stack
specified by NewStack and passing in the parameters specified by Context1 and
Context2. Context1 and Context2 are optional and may be NULL. The function
EntryPoint must never return.
@param Value A pointer to the 32-bit value to increment.
If EntryPoint is NULL, then ASSERT().
If NewStack is NULL, then ASSERT().
@return The incremented value.
**/
UINT32
EFIAPI
InternalSyncIncrement (
IN volatile UINT32 *Value
);
/**
Performs an atomic decrement of an 32-bit unsigned integer.
Performs an atomic decrement of the 32-bit unsigned integer specified by
Value and returns the decrement value. The decrement operation must be
performed using MP safe mechanisms. The state of the return value is not
guaranteed to be MP safe.
@param Value A pointer to the 32-bit value to decrement.
@return The decrement value.
**/
UINT32
EFIAPI
InternalSyncDecrement (
IN volatile UINT32 *Value
);
/**
Performs an atomic compare exchange operation on a 32-bit unsigned integer.
Performs an atomic compare exchange operation on the 32-bit unsigned integer
specified by Value. If Value is equal to CompareValue, then Value is set to
ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
then Value is returned. The compare exchange operation must be performed using
MP safe mechanisms.
@param Value A pointer to the 32-bit value for the compare exchange
operation.
@param CompareValue 32-bit value used in compare operation.
@param ExchangeValue 32-bit value used in exchange operation.
@return The original *Value before exchange.
**/
UINT32
EFIAPI
InternalSyncCompareExchange32 (
IN volatile UINT32 *Value,
IN UINT32 CompareValue,
IN UINT32 ExchangeValue
);
/**
Performs an atomic compare exchange operation on a 64-bit unsigned integer.
Performs an atomic compare exchange operation on the 64-bit unsigned integer specified
by Value. If Value is equal to CompareValue, then Value is set to ExchangeValue and
CompareValue is returned. If Value is not equal to CompareValue, then Value is returned.
The compare exchange operation must be performed using MP safe mechanisms.
@param Value A pointer to the 64-bit value for the compare exchange
operation.
@param CompareValue 64-bit value used in compare operation.
@param ExchangeValue 64-bit value used in exchange operation.
@return The original *Value before exchange.
**/
UINT64
EFIAPI
InternalSyncCompareExchange64 (
IN volatile UINT64 *Value,
IN UINT64 CompareValue,
IN UINT64 ExchangeValue
);
/**
Worker function that returns a bit field from Operand
Returns the bitfield specified by the StartBit and the EndBit from Operand.
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@param EndBit The ordinal of the most significant bit in the bit field.
@return The bit field read.
**/
unsigned int
BitFieldReadUint (
IN unsigned int Operand,
IN UINTN StartBit,
IN UINTN EndBit
);
/**
Worker function that reads a bit field from Operand, performs a bitwise OR,
and returns the result.
Performs a bitwise OR between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData. All other bits in Operand are
preserved. The new value is returned.
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@param EndBit The ordinal of the most significant bit in the bit field.
@param OrData The value to OR with the read value from the value
@return The new value.
**/
unsigned int
BitFieldOrUint (
IN unsigned int Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN unsigned int OrData
);
/**
Worker function that reads a bit field from Operand, performs a bitwise AND,
and returns the result.
Performs a bitwise AND between the bit field specified by StartBit and EndBit
in Operand and the value specified by AndData. All other bits in Operand are
preserved. The new value is returned.
@param Operand Operand on which to perform the bitfield operation.
@param StartBit The ordinal of the least significant bit in the bit field.
@param EndBit The ordinal of the most significant bit in the bit field.
@param AndData The value to And with the read value from the value
@return The new value.
**/
unsigned int
BitFieldAndUint (
IN unsigned int Operand,
IN UINTN StartBit,
IN UINTN EndBit,
IN unsigned int AndData
);
/**
Worker function that checks ASSERT condition for JumpBuffer
Checks ASSERT condition for JumpBuffer.
If JumpBuffer is NULL, then ASSERT().
For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, then ASSERT().
@param JumpBuffer A pointer to CPU context buffer.
**/
VOID
InternalAssertJumpBuffer (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
);
/**
Restores the CPU context that was saved with SetJump().
Restores the CPU context from the buffer specified by JumpBuffer.
This function never returns to the caller.
Instead is resumes execution based on the state of JumpBuffer.
@param JumpBuffer A pointer to CPU context buffer.
@param Value The value to return when the SetJump() context is restored.
@param EntryPoint A pointer to function to call with the new stack.
@param Context1 A pointer to the context to pass into the EntryPoint
function.
@param Context2 A pointer to the context to pass into the EntryPoint
function.
@param NewStack A pointer to the new stack to use for the EntryPoint
function.
@param NewBsp A pointer to the new memory location for RSE backing
store.
**/
VOID
EFIAPI
InternalLongJump (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
IN UINTN Value
AsmSwitchStackAndBackingStore (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack,
IN VOID *NewBsp
);
#else
#endif
#endif

View File

@@ -20,7 +20,7 @@ Abstract:
--*/
#include "BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Worker function that returns a bit field from Operand

View File

@@ -0,0 +1,336 @@
/**
Utility functions to generate checksum based on 2's complement
algorithm.
Copyright (c) 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: CheckSum.c
**/
#include "BaseLibInternals.h"
/**
Calculate the sum of all elements in a buffer in unit of UINT8.
During calculation, the carry bits are dropped.
This function calculates the sum of all elements in a buffer
in unit of UINT8. The carry bits in result of addition are dropped.
The result is returned as UINT8. If Length is Zero, then Zero is
returned.
If Buffer is NULL, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the sum operation.
@param Length The size, in bytes, of Buffer .
@return Sum The sum of Buffer with carry bits dropped during additions.
**/
UINT8
EFIAPI
CalculateSum8 (
IN CONST UINT8 *Buffer,
IN UINTN Length
)
{
UINT8 Sum;
UINTN Count;
ASSERT (Buffer != NULL);
ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
for (Sum = 0, Count = 0; Count < Length; Count++) {
Sum = (UINT8) (Sum + *(Buffer + Count));
}
return Sum;
}
/**
Returns the two's complement checksum of all elements in a buffer
of 8-bit values.
This function first calculates the sum of the 8-bit values in the
buffer specified by Buffer and Length. The carry bits in the result
of addition are dropped. Then, the two's complement of the sum is
returned. If Length is 0, then 0 is returned.
If Buffer is NULL, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the checksum operation.
@param Length The size, in bytes, of Buffer.
@return Checksum The 2's complement checksum of Buffer.
**/
UINT8
EFIAPI
CalculateCheckSum8 (
IN CONST UINT8 *Buffer,
IN UINTN Length
)
{
UINT8 CheckSum;
CheckSum = CalculateSum8 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
return (UINT8) (0x100 - CheckSum);
}
/**
Returns the sum of all elements in a buffer of 16-bit values. During
calculation, the carry bits are dropped.
This function calculates the sum of the 16-bit values in the buffer
specified by Buffer and Length. The carry bits in result of addition are dropped.
The 16-bit result is returned. If Length is 0, then 0 is returned.
If Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
If Length is not aligned on a 16-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the sum operation.
@param Length The size, in bytes, of Buffer.
@return Sum The sum of Buffer with carry bits dropped during additions.
**/
UINT16
EFIAPI
CalculateSum16 (
IN CONST UINT16 *Buffer,
IN UINTN Length
)
{
UINT16 Sum;
UINTN Count;
ASSERT (Buffer != NULL);
ASSERT (((UINTN) Buffer & 0x1) == 0);
ASSERT ((Length & 0x1) == 0);
ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
for (Sum = 0, Count = 0; Count < Length; Count++) {
Sum = (UINT16) (Sum + *(Buffer + Count));
}
return Sum;
}
/**
Returns the two's complement checksum of all elements in a buffer of
16-bit values.
This function first calculates the sum of the 16-bit values in the buffer
specified by Buffer and Length. The carry bits in the result of addition
are dropped. Then, the two's complement of the sum is returned. If Length
is 0, then 0 is returned.
If Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 16-bit boundary, then ASSERT().
If Length is not aligned on a 16-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the checksum operation.
@param Length The size, in bytes, of Buffer.
@return Checksum The 2's complement checksum of Buffer.
**/
UINT16
EFIAPI
CalculateCheckSum16 (
IN CONST UINT16 *Buffer,
IN UINTN Length
)
{
UINT16 CheckSum;
CheckSum = CalculateSum16 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
return (UINT16) (0x10000 - CheckSum);
}
/**
Returns the sum of all elements in a buffer of 32-bit values. During
calculation, the carry bits are dropped.
This function calculates the sum of the 32-bit values in the buffer
specified by Buffer and Length. The carry bits in result of addition are dropped.
The 32-bit result is returned. If Length is 0, then 0 is returned.
If Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
If Length is not aligned on a 32-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the sum operation.
@param Length The size, in bytes, of Buffer.
@return Sum The sum of Buffer with carry bits dropped during additions.
**/
UINT32
EFIAPI
CalculateSum32 (
IN CONST UINT32 *Buffer,
IN UINTN Length
)
{
UINT32 Sum;
UINTN Count;
ASSERT (Buffer != NULL);
ASSERT (((UINTN) Buffer & 0x3) == 0);
ASSERT ((Length & 0x3) == 0);
ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
for (Sum = 0, Count = 0; Count < Length; Count++) {
Sum = Sum + *(Buffer + Count);
}
return Sum;
}
/**
Returns the two's complement checksum of all elements in a buffer of
32-bit values.
This function first calculates the sum of the 32-bit values in the buffer
specified by Buffer and Length. The carry bits in the result of addition
are dropped. Then, the two's complement of the sum is returned. If Length
is 0, then 0 is returned.
If Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 32-bit boundary, then ASSERT().
If Length is not aligned on a 32-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the checksum operation.
@param Length The size, in bytes, of Buffer.
@return Checksum The 2's complement checksum of Buffer.
**/
UINT32
EFIAPI
CalculateCheckSum32 (
IN CONST UINT32 *Buffer,
IN UINTN Length
)
{
UINT32 CheckSum;
CheckSum = CalculateSum32 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
return (UINT32) ((UINT32)(-1) - CheckSum + 1);
}
/**
Returns the sum of all elements in a buffer of 64-bit values. During
calculation, the carry bits are dropped.
This function calculates the sum of the 64-bit values in the buffer
specified by Buffer and Length. The carry bits in result of addition are dropped.
The 64-bit result is returned. If Length is 0, then 0 is returned.
If Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
If Length is not aligned on a 64-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the sum operation.
@param Length The size, in bytes, of Buffer.
@return Sum The sum of Buffer with carry bits dropped during additions.
**/
UINT64
EFIAPI
CalculateSum64 (
IN CONST UINT64 *Buffer,
IN UINTN Length
)
{
UINT64 Sum;
UINTN Count;
ASSERT (Buffer != NULL);
ASSERT (((UINTN) Buffer & 0x7) == 0);
ASSERT ((Length & 0x7) == 0);
ASSERT (Length <= (MAX_ADDRESS - ((UINTN) Buffer) + 1));
for (Sum = 0, Count = 0; Count < Length; Count++) {
Sum = Sum + *(Buffer + Count);
}
return Sum;
}
/**
Returns the two's complement checksum of all elements in a buffer of
64-bit values.
This function first calculates the sum of the 64-bit values in the buffer
specified by Buffer and Length. The carry bits in the result of addition
are dropped. Then, the two's complement of the sum is returned. If Length
is 0, then 0 is returned.
If Buffer is NULL, then ASSERT().
If Buffer is not aligned on a 64-bit boundary, then ASSERT().
If Length is not aligned on a 64-bit boundary, then ASSERT().
If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
@param Buffer Pointer to the buffer to carry out the checksum operation.
@param Length The size, in bytes, of Buffer.
@return Checksum The 2's complement checksum of Buffer.
**/
UINT64
EFIAPI
CalculateCheckSum64 (
IN CONST UINT64 *Buffer,
IN UINTN Length
)
{
UINT64 CheckSum;
CheckSum = CalculateSum64 (Buffer, Length);
//
// Return the checksum based on 2's complement.
//
return (UINT64) ((UINT64)(-1) - CheckSum + 1);
}

View File

@@ -20,7 +20,7 @@ Abstract:
--*/
#include "BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Disables CPU interrupts and returns the interrupt state prior to the disable

View File

@@ -19,7 +19,7 @@ Abstract:
--*/
#include "BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Executes an infinite loop.

View File

@@ -20,7 +20,7 @@ Abstract:
--*/
#include "BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Divides a 64-bit signed integer by a 64-bit signed integer and generates a

View File

@@ -20,7 +20,7 @@ Abstract:
--*/
#include "BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates

View File

@@ -20,7 +20,7 @@ Abstract:
--*/
#include "BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Divides a 64-bit unsigned integer by a 32-bit unsigned integer and generates

View File

@@ -19,7 +19,7 @@ Abstract:
--*/
#include "BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Divides a 64-bit unsigned integer by a 64-bit unsigned integer and generates

View File

@@ -19,7 +19,7 @@ Abstract:
--*/
#include "..\BaseLibInternal.h"
#include "BaseLibInternals.h"
extern
UINT64

View File

@@ -19,7 +19,7 @@ Abstract:
--*/
#include "..\BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Worker function that checks ASSERT condition for JumpBuffer
@@ -33,6 +33,7 @@ Abstract:
**/
VOID
EFIAPI
InternalAssertJumpBuffer (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
);

View File

@@ -19,15 +19,18 @@ Abstract:
--*/
#include "..\BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Transfers control to a function starting with a new stack.
Transfers control to the function specified by EntryPoint using the new stack
specified by NewStack and passing in the parameters specified by Context1 and
Context2. Context1 and Context2 are optional and may be NULL. The function
EntryPoint must never return.
by Context1 and Context2. Context1 and Context2 are optional and may
be NULL. The function EntryPoint must never return.
Marker will be ignored on IA-32, x64, and EBC.
IPF CPUs expect one additional parameter of type VOID * that specifies
the new backing store pointer.
If EntryPoint is NULL, then ASSERT().
If NewStack is NULL, then ASSERT().
@@ -39,21 +42,30 @@ Abstract:
function.
@param NewStack A pointer to the new stack to use for the EntryPoint
function.
@param Marker VA_LIST marker for the variable argument list.
**/
VOID
EFIAPI
InternalSwitchStack (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack,
IN VA_LIST Marker
)
{
//
// This version of this function does not actually change the stack pointer
// This is to support compilation of CPU types that do not support assemblers
// such as EBC
//
//
// Stack should be aligned with CPU_STACK_ALIGNMENT
//
ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
EntryPoint (Context1, Context2);
}

View File

@@ -19,7 +19,7 @@ Abstract:
--*/
#include "..\BaseLibInternal.h"
#include "BaseLibInternals.h"
UINT32
EFIAPI

View File

@@ -19,7 +19,7 @@ Abstract:
--*/
#include "BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Returns the value of the highest bit set in a 32-bit value. Equivalent to

View File

@@ -20,7 +20,7 @@ Abstract:
--*/
#include "BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Returns the value of the highest bit set in a 64-bit value. Equivalent to

View File

@@ -20,7 +20,7 @@ Abstract:
--*/
#include "BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Returns the bit position of the highest bit set in a 32-bit value. Equivalent

View File

@@ -20,7 +20,7 @@ Abstract:
--*/
#include "BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Returns the bit position of the highest bit set in a 64-bit value. Equivalent

View File

@@ -1,44 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; ARShiftU64.asm
;
; Abstract:
;
; 64-bit arithmetic right shift function for IA-32
;
;------------------------------------------------------------------------------
.686
.model flat,C
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathARShiftU64 (
; IN UINT64 Operand,
; IN UINTN Count
; );
;------------------------------------------------------------------------------
InternalMathARShiftU64 PROC
mov cl, [esp + 12]
mov eax, [esp + 8]
cdq
test cl, 32
cmovz edx, eax
cmovz eax, [esp + 4]
shrd eax, edx, cl
sar edx, cl
ret
InternalMathARShiftU64 ENDP
END

View File

@@ -0,0 +1,35 @@
/**
64-bit arithmetic right shift function for IA-32.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
UINT64
EFIAPI
InternalMathARShiftU64 (
IN UINT64 Operand,
IN UINTN Count
)
{
_asm {
mov cl, byte ptr [Count]
mov eax, dword ptr [Operand + 4]
cdq
test cl, 32
cmovz edx, eax
cmovz eax, dword ptr [Operand + 0]
shrd eax, edx, cl
sar edx, cl
}
}

View File

@@ -1,39 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; CpuBreakpoint.Asm
;
; Abstract:
;
; CpuBreakpoint function
;
; Notes:
;
;------------------------------------------------------------------------------
.686
.model flat
.xmm
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; CpuBreakpoint (
; VOID
; );
;------------------------------------------------------------------------------
_CpuBreakpoint PROC
int 3
ret
_CpuBreakpoint ENDP
END

View File

@@ -0,0 +1,40 @@
/*++
Copyright (c) 2004 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
CpuBreakpoint.c
Abstract:
--*/
#include "BaseLibInternals.h"
//
// Microsoft Visual Studio 7.1 Function Prototypes for I/O Intrinsics
//
void __debugbreak ();
#pragma intrinsic(__debugbreak)
VOID
EFIAPI
CpuBreakpoint (
VOID
)
{
__debugbreak ();
}

View File

@@ -1,39 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; CpuFlushTlb.Asm
;
; Abstract:
;
; CpuFlushTlb function
;
; Notes:
;
;------------------------------------------------------------------------------
.386p
.model flat,C
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; CpuFlushTlb (
; VOID
; );
;------------------------------------------------------------------------------
CpuFlushTlb PROC
mov eax, cr3
mov cr3, eax ; moving to CR3 flushes TLB
ret
CpuFlushTlb ENDP
END

View File

@@ -0,0 +1,28 @@
/**
CpuFlushTlb function.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
VOID
EFIAPI
CpuFlushTlb (
VOID
)
{
_asm {
mov eax, cr3
mov cr3, eax
}
}

View File

@@ -1,64 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; CpuId.Asm
;
; Abstract:
;
; AsmCpuid function
;
; Notes:
;
;------------------------------------------------------------------------------
.586P
.model flat,C
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; AsmCpuid (
; IN UINT32 RegisterInEax,
; OUT UINT32 *RegisterOutEax OPTIONAL,
; OUT UINT32 *RegisterOutEbx OPTIONAL,
; OUT UINT32 *RegisterOutEcx OPTIONAL,
; OUT UINT32 *RegisterOutEdx OPTIONAL
; );
;------------------------------------------------------------------------------
AsmCpuid PROC USES ebx
push ebp
mov ebp, esp
mov eax, [ebp + 12]
cpuid
push ecx
mov ecx, [ebp + 16]
jecxz @F
mov [ecx], eax
@@:
mov ecx, [ebp + 20]
jecxz @F
mov [ecx], ebx
@@:
mov ecx, [ebp + 24]
jecxz @F
pop [ecx]
@@:
mov ecx, [ebp + 28]
jecxz @F
mov [ecx], edx
@@:
mov eax, [ebp + 12]
leave
ret
AsmCpuid ENDP
END

View File

@@ -0,0 +1,51 @@
/**
AsmCpuid function.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
UINT32
EFIAPI
AsmCpuid (
IN UINT32 Index,
OUT UINT32 *RegisterEax, OPTIONAL
OUT UINT32 *RegisterEbx, OPTIONAL
OUT UINT32 *RegisterEcx, OPTIONAL
OUT UINT32 *RegisterEdx OPTIONAL
)
{
_asm {
mov eax, Index
cpuid
push ecx
mov ecx, RegisterEax
jecxz SkipEax
mov [ecx], eax
SkipEax:
mov ecx, RegisterEbx
jecxz SkipEbx
mov [ecx], ebx
SkipEbx:
pop eax
mov ecx, RegisterEcx
jecxz SkipEcx
mov [ecx], eax
SkipEcx:
mov ecx, RegisterEdx
jecxz SkipEdx
mov [ecx], edx
SkipEdx:
mov eax, Index
}
}

View File

@@ -1,66 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; CpuIdEx.Asm
;
; Abstract:
;
; AsmCpuidEx function
;
; Notes:
;
;------------------------------------------------------------------------------
.686
.model flat,C
.code
;------------------------------------------------------------------------------
; UINT32
; EFIAPI
; AsmCpuidEx (
; IN UINT32 RegisterInEax,
; IN UINT32 RegisterInEcx,
; OUT UINT32 *RegisterOutEax OPTIONAL,
; OUT UINT32 *RegisterOutEbx OPTIONAL,
; OUT UINT32 *RegisterOutEcx OPTIONAL,
; OUT UINT32 *RegisterOutEdx OPTIONAL
; )
;------------------------------------------------------------------------------
AsmCpuidEx PROC USES ebx
push ebp
mov ebp, esp
mov eax, [ebp + 12]
mov ecx, [ebp + 16]
cpuid
push ecx
mov ecx, [ebp + 20]
jecxz @F
mov [ecx], eax
@@:
mov ecx, [ebp + 24]
jecxz @F
mov [ecx], ebx
@@:
mov ecx, [ebp + 28]
jecxz @F
pop [ecx]
@@:
mov edx, [ebp + 32]
jecxz @F
mov [ecx], edx
@@:
mov eax, [ebp + 12]
leave
ret
AsmCpuidEx ENDP
END

View File

@@ -0,0 +1,52 @@
/**
AsmCpuidEx function.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
UINT32
EFIAPI
AsmCpuidEx (
IN UINT32 Index,
IN UINT32 SubIndex,
OUT UINT32 *RegisterEax, OPTIONAL
OUT UINT32 *RegisterEbx, OPTIONAL
OUT UINT32 *RegisterEcx, OPTIONAL
OUT UINT32 *RegisterEdx OPTIONAL
)
{
_asm {
mov eax, Index
mov ecx, SubIndex
cpuid
push ecx
mov ecx, RegisterEax
jecxz SkipEax
mov [ecx], eax
SkipEax:
mov ecx, RegisterEbx
jecxz SkipEbx
mov [ecx], ebx
SkipEbx:
pop eax
mov ecx, RegisterEcx
jecxz SkipEcx
mov [ecx], eax
SkipEcx:
mov ecx, RegisterEdx
jecxz SkipEdx
mov [ecx], edx
SkipEdx:
mov eax, Index
}
}

View File

@@ -1,39 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; CpuPause.Asm
;
; Abstract:
;
; CpuPause function
;
; Notes:
;
;------------------------------------------------------------------------------
.686
.model flat,C
.xmm
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; CpuPause (
; VOID
; );
;------------------------------------------------------------------------------
CpuPause PROC
pause
ret
CpuPause ENDP
END

View File

@@ -0,0 +1,27 @@
/**
CpuPause function.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
VOID
EFIAPI
CpuPause (
VOID
)
{
_asm {
pause
}
}

View File

@@ -0,0 +1,27 @@
/**
CpuSleep function.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
VOID
EFIAPI
CpuSleep (
VOID
)
{
_asm {
hlt
}
}

View File

@@ -1,38 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; DisableInterrupts.Asm
;
; Abstract:
;
; DisableInterrupts function
;
; Notes:
;
;------------------------------------------------------------------------------
.386p
.model flat,C
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; DisableInterrupts (
; VOID
; );
;------------------------------------------------------------------------------
DisableInterrupts PROC
cli
ret
DisableInterrupts ENDP
END

View File

@@ -0,0 +1,27 @@
/**
DisableInterrupts function.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
VOID
EFIAPI
DisableInterrupts (
VOID
)
{
_asm {
cli
}
}

View File

@@ -1,55 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; DisablePaging32.Asm
;
; Abstract:
;
; AsmDisablePaging32 function
;
; Notes:
;
;------------------------------------------------------------------------------
.386
.model flat,C
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalX86DisablePaging32 (
; IN SWITCH_STACK_ENTRY_POINT EntryPoint,
; IN VOID *Context1, OPTIONAL
; IN VOID *Context2, OPTIONAL
; IN VOID *NewStack
; );
;------------------------------------------------------------------------------
InternalX86DisablePaging32 PROC
mov ebx, [esp + 4]
mov ecx, [esp + 8]
mov edx, [esp + 12]
pushfd
pop edi ; save EFLAGS to edi
cli
mov eax, cr0
btr eax, 31
mov esp, [esp + 16]
mov cr0, eax
push edi
popfd ; restore EFLAGS from edi
push edx
push ecx
call ebx
jmp $ ; EntryPoint() should not return
InternalX86DisablePaging32 ENDP
END

View File

@@ -0,0 +1,48 @@
/**
AsmDisablePaging32 function.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
__declspec (naked)
VOID
EFIAPI
InternalX86DisablePaging32 (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack
)
{
_asm {
push ebp
mov ebp, esp
mov ebx, EntryPoint
mov ecx, Context1
mov edx, Context2
pushfd
pop edi // save EFLAGS to edi
cli
mov eax, cr0
btr eax, 31
mov esp, NewStack
mov cr0, eax
push edi
popfd // restore EFLAGS from edi
push edx
push ecx
call ebx
jmp $ // EntryPoint() should not return
}
}

View File

@@ -20,7 +20,7 @@ Abstract:
--*/
#include "..\BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Worker function that Divides a 64-bit signed integer by a 64-bit signed integer and

View File

@@ -1,44 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; DivU64x32.asm
;
; Abstract:
;
; Calculate the quotient of a 64-bit integer by a 32-bit integer
;
;------------------------------------------------------------------------------
.386
.model flat,C
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathDivU64x32 (
; IN UINT64 Dividend,
; IN UINT32 Divisor
; );
;------------------------------------------------------------------------------
InternalMathDivU64x32 PROC
mov eax, [esp + 8]
mov ecx, [esp + 12]
xor edx, edx
div ecx
push eax ; save quotient on stack
mov eax, [esp + 8]
div ecx
pop edx ; restore high-order dword of the quotient
ret
InternalMathDivU64x32 ENDP
END

View File

@@ -0,0 +1,35 @@
/**
Calculate the quotient of a 64-bit integer by a 32-bit integer
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
UINT64
EFIAPI
InternalMathDivU64x32 (
IN UINT64 Dividend,
IN UINT32 Divisor
)
{
_asm {
mov eax, dword ptr [Dividend + 4]
mov ecx, Divisor
xor edx, edx
div ecx
push eax ; save quotient on stack
mov eax, dword ptr [Dividend]
div ecx
pop edx ; restore high-order dword of the quotient
}
}

View File

@@ -1,49 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; DivError.asm
;
; Abstract:
;
; Set error flag for all division functions
;
;------------------------------------------------------------------------------
.386
.model flat,C
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathDivRemU64x32 (
; IN UINT64 Dividend,
; IN UINT32 Divisor,
; OUT UINT32 *Remainder
; );
;------------------------------------------------------------------------------
InternalMathDivRemU64x32 PROC
mov ecx, [esp + 12] ; ecx <- divisor
mov eax, [esp + 8] ; eax <- dividend[32..63]
xor edx, edx
div ecx ; eax <- quotient[32..63], edx <- remainder
push eax
mov eax, [esp + 8] ; eax <- dividend[0..31]
div ecx ; eax <- quotient[0..31]
mov ecx, [esp + 20] ; ecx <- Remainder
jecxz @F ; abandon remainder if Remainder == NULL
mov [ecx], edx
@@:
pop edx ; edx <- quotient[32..63]
ret
InternalMathDivRemU64x32 ENDP
END

View File

@@ -0,0 +1,40 @@
/**
Set error flag for all division functions
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
UINT64
EFIAPI
InternalMathDivRemU64x32 (
IN UINT64 Dividend,
IN UINT32 Divisor,
OUT UINT32 *Remainder
)
{
_asm {
mov ecx, Divisor
mov eax, dword ptr [Dividend + 4]
xor edx, edx
div ecx
push eax
mov eax, dword ptr [Dividend + 0]
div ecx
mov ecx, Remainder
jecxz RemainderNull // abandon remainder if Remainder == NULL
mov [ecx], edx
RemainderNull:
pop edx
}
}

View File

@@ -1,90 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; DivU64x64Remainder.asm
;
; Abstract:
;
; Calculate the quotient of a 64-bit integer by a 64-bit integer and returns
; both the quotient and the remainder
;
;------------------------------------------------------------------------------
.386
.model flat,C
.code
EXTERN InternalMathDivRemU64x32:PROC
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathDivRemU64x64 (
; IN UINT64 Dividend,
; IN UINT64 Divisor,
; OUT UINT64 *Remainder OPTIONAL
; );
;------------------------------------------------------------------------------
InternalMathDivRemU64x64 PROC
mov ecx, [esp + 16] ; ecx <- divisor[32..63]
test ecx, ecx
jnz _@DivRemU64x64 ; call _@DivRemU64x64 if Divisor > 2^32
mov ecx, [esp + 20]
jecxz @F
and dword ptr [ecx + 4], 0 ; zero high dword of remainder
mov [esp + 16], ecx ; set up stack frame to match DivRemU64x32
@@:
jmp InternalMathDivRemU64x32
InternalMathDivRemU64x64 ENDP
_@DivRemU64x64 PROC USES ebx esi edi
mov edx, dword ptr [esp + 20]
mov eax, dword ptr [esp + 16] ; edx:eax <- dividend
mov edi, edx
mov esi, eax ; edi:esi <- dividend
mov ebx, dword ptr [esp + 24] ; ecx:ebx <- divisor
@@:
shr edx, 1
rcr eax, 1
shrd ebx, ecx, 1
shr ecx, 1
jnz @B
div ebx
mov ebx, eax ; ebx <- quotient
mov ecx, [esp + 28] ; ecx <- high dword of divisor
mul dword ptr [esp + 24] ; edx:eax <- quotient * divisor[0..31]
imul ecx, ebx ; ecx <- quotient * divisor[32..63]
add edx, ecx ; edx <- (quotient * divisor)[32..63]
mov ecx, dword ptr [esp + 32] ; ecx <- addr for Remainder
jc @TooLarge ; product > 2^64
cmp edi, edx ; compare high 32 bits
ja @Correct
jb @TooLarge ; product > dividend
cmp esi, eax
jae @Correct ; product <= dividend
@TooLarge:
dec ebx ; adjust quotient by -1
jecxz @Return ; return if Remainder == NULL
sub eax, dword ptr [esp + 24]
sbb edx, dword ptr [esp + 28] ; edx:eax <- (quotient - 1) * divisor
@Correct:
jecxz @Return
sub esi, eax
sbb edi, edx ; edi:esi <- remainder
mov [ecx], esi
mov [ecx + 4], edi
@Return:
mov eax, ebx ; eax <- quotient
xor edx, edx ; quotient is 32 bits long
ret
_@DivRemU64x64 ENDP
END

View File

@@ -0,0 +1,68 @@
/**
Calculate the quotient of a 64-bit integer by a 64-bit integer and returns
both the quotient and the remainderSet error flag for all division functions
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
UINT64
EFIAPI
InternalMathDivRemU64x64 (
IN UINT64 Dividend,
IN UINT64 Divisor,
OUT UINT64 *Remainder OPTIONAL
)
{
_asm {
mov edx, dword ptr [Dividend + 4]
mov eax, dword ptr [Dividend + 0] // edx:eax <- dividend
mov edi, edx
mov esi, eax // edi:esi <- dividend
mov ecx, dword ptr [Divisor + 4]
mov ebx, dword ptr [Divisor + 0] // ecx:ebx <- divisor
BitLoop:
shr edx, 1
rcr eax, 1
shrd ebx, ecx, 1
shr ecx, 1
jnz BitLoop
div ebx
mov ebx, eax // ebx <- quotient
mov ecx, dword ptr [Divisor + 4]
mul dword ptr [Divisor]
imul ecx, ebx
add edx, ecx
mov ecx, Remainder
jc TooLarge // product > 2^64
cmp edi, edx // compare high 32 bits
ja Correct
jb TooLarge // product > dividend
cmp esi, eax
jae Correct // product <= dividend
TooLarge:
dec ebx // adjust quotient by -1
jecxz Return // return if Remainder == NULL
sub eax, dword ptr [Divisor + 0]
sbb edx, dword ptr [Divisor + 4]
Correct:
jecxz Return
sub esi, eax
sbb edi, edx // edi:esi <- remainder
mov [ecx], esi
mov [ecx + 4], edi
Return:
mov eax, ebx // eax <- quotient
xor edx, edx
}
}

View File

@@ -1,39 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; EnableDisableInterrupts.Asm
;
; Abstract:
;
; EnableDisableInterrupts function
;
; Notes:
;
;------------------------------------------------------------------------------
.386p
.model flat
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; EnableDisableInterrupts (
; VOID
; );
;------------------------------------------------------------------------------
_EnableDisableInterrupts PROC
sti
cli
ret
_EnableDisableInterrupts ENDP
END

View File

@@ -0,0 +1,30 @@
/**
EnableDisableInterrupts function
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
VOID
EFIAPI
EnableDisableInterrupts (
VOID
)
{
_asm {
sti
nop
nop
cli
}
}

View File

@@ -1,38 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; EnableInterrupts.Asm
;
; Abstract:
;
; EnableInterrupts function
;
; Notes:
;
;------------------------------------------------------------------------------
.386p
.model flat
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; EnableInterrupts (
; VOID
; );
;------------------------------------------------------------------------------
_EnableInterrupts PROC
sti
ret
_EnableInterrupts ENDP
END

View File

@@ -0,0 +1,27 @@
/**
EnableInterrupts function
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
VOID
EFIAPI
EnableInterrupts (
VOID
)
{
_asm {
sti
}
}

View File

@@ -1,55 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; EnablePaging32.Asm
;
; Abstract:
;
; AsmEnablePaging32 function
;
; Notes:
;
;------------------------------------------------------------------------------
.386
.model flat,C
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalX86EnablePaging32 (
; IN SWITCH_STACK_ENTRY_POINT EntryPoint,
; IN VOID *Context1, OPTIONAL
; IN VOID *Context2, OPTIONAL
; IN VOID *NewStack
; );
;------------------------------------------------------------------------------
InternalX86EnablePaging32 PROC
mov ebx, [esp + 4]
mov ecx, [esp + 8]
mov edx, [esp + 12]
pushfd
pop edi ; save flags in edi
cli
mov eax, cr0
bts eax, 31
mov esp, [esp + 16]
mov cr0, eax
push edi
popfd ; restore flags
push edx
push ecx
call ebx
jmp $
InternalX86EnablePaging32 ENDP
END

View File

@@ -0,0 +1,48 @@
/**
AsmEnablePaging32 function
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
__declspec (naked)
VOID
EFIAPI
InternalX86EnablePaging32 (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack
)
{
_asm {
push ebp
mov ebp, esp
mov ebx, EntryPoint
mov ecx, Context1
mov edx, Context2
pushfd
pop edi
cli
mov eax, cr0
bts eax, 31
mov esp, NewStack
mov cr0, eax
push edi
popfd
push edx
push ecx
call ebx
jmp $
}
}

View File

@@ -1,40 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; FlushCacheLine.Asm
;
; Abstract:
;
; AsmFlushCacheLine function
;
; Notes:
;
;------------------------------------------------------------------------------
.586P
.model flat,C
.xmm
.code
;------------------------------------------------------------------------------
; VOID *
; EFIAPI
; AsmFlushCacheLine (
; IN VOID *LinearAddress
; );
;------------------------------------------------------------------------------
AsmFlushCacheLine PROC
mov eax, [esp + 4]
clflush [eax]
ret
AsmFlushCacheLine ENDP
END

View File

@@ -0,0 +1,28 @@
/**
AsmFlushCacheLine function
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
VOID *
EFIAPI
AsmFlushCacheLine (
IN VOID *LinearAddress
)
{
_asm {
mov eax, LinearAddress
clflush [eax]
}
}

View File

@@ -1,40 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; FxRestore.Asm
;
; Abstract:
;
; AsmFxRestore function
;
; Notes:
;
;------------------------------------------------------------------------------
.586
.model flat,C
.xmm
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalX86FxRestore (
; IN CONST IA32_FX_BUFFER *Buffer
; );
;------------------------------------------------------------------------------
InternalX86FxRestore PROC
mov eax, [esp + 4] ; Buffer must be 16-byte aligned
fxrstor [eax]
ret
InternalX86FxRestore ENDP
END

View File

@@ -0,0 +1,28 @@
/**
AsmFxRestore function
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
VOID
EFIAPI
InternalX86FxRestore (
IN CONST IA32_FX_BUFFER *Buffer
)
{
_asm {
mov eax, Buffer
fxrstor [eax]
}
}

View File

@@ -1,40 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; FxSave.Asm
;
; Abstract:
;
; AsmFxSave function
;
; Notes:
;
;------------------------------------------------------------------------------
.586
.model flat,C
.xmm
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalX86FxSave (
; OUT IA32_FX_BUFFER *Buffer
; );
;------------------------------------------------------------------------------
InternalX86FxSave PROC
mov eax, [esp + 4] ; Buffer must be 16-byte aligned
fxsave [eax]
ret
InternalX86FxSave ENDP
END

View File

@@ -0,0 +1,28 @@
/**
AsmFxSave function
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
VOID
EFIAPI
InternalX86FxSave (
OUT IA32_FX_BUFFER *Buffer
)
{
_asm {
mov eax, Buffer
fxsave [eax]
}
}

View File

@@ -1,43 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; InterlockedCompareExchange32.Asm
;
; Abstract:
;
; InterlockedCompareExchange32 function
;
; Notes:
;
;------------------------------------------------------------------------------
.486
.model flat,C
.code
;------------------------------------------------------------------------------
; UINT32
; EFIAPI
; InternalSyncCompareExchange32 (
; IN UINT32 *Value,
; IN UINT32 CompareValue,
; IN UINT32 ExchangeValue
; );
;------------------------------------------------------------------------------
InternalSyncCompareExchange32 PROC
mov ecx, [esp + 4]
mov eax, [esp + 8]
mov edx, [esp + 12]
lock cmpxchg [ecx], edx
ret
InternalSyncCompareExchange32 ENDP
END

View File

@@ -0,0 +1,32 @@
/**
InterlockedCompareExchange32 function
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
UINT32
EFIAPI
InternalSyncCompareExchange32 (
IN volatile UINT32 *Value,
IN UINT32 CompareValue,
IN UINT32 ExchangeValue
)
{
_asm {
mov ecx, Value
mov eax, CompareValue
mov edx, ExchangeValue
lock cmpxchg [ecx], edx
}
}

View File

@@ -1,45 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; InterlockedCompareExchange64.Asm
;
; Abstract:
;
; InterlockedCompareExchange64 function
;
; Notes:
;
;------------------------------------------------------------------------------
.586P
.model flat,C
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalSyncCompareExchange64 (
; IN UINT64 *Value,
; IN UINT64 CompareValue,
; IN UINT64 ExchangeValue
; );
;------------------------------------------------------------------------------
InternalSyncCompareExchange64 PROC USES esi ebx
mov esi, [esp + 12]
mov eax, [esp + 16]
mov edx, [esp + 20]
mov ebx, [esp + 24]
mov ecx, [esp + 28]
lock cmpxchg8b qword ptr [esi]
ret
InternalSyncCompareExchange64 ENDP
END

View File

@@ -0,0 +1,33 @@
/**
InterlockedCompareExchange64 function
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
UINT64
EFIAPI
InternalSyncCompareExchange64 (
IN volatile UINT64 *Value,
IN UINT64 CompareValue,
IN UINT64 ExchangeValue
)
{
_asm {
mov esi, Value
mov eax, dword ptr [CompareValue + 0]
mov edx, dword ptr [CompareValue + 4]
mov ebx, dword ptr [ExchangeValue + 0]
mov ecx, dword ptr [ExchangeValue + 4]
lock cmpxchg8b qword ptr [esi]
}
}

View File

@@ -1,40 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; InterlockedDecrement.Asm
;
; Abstract:
;
; InterlockedDecrement function
;
; Notes:
;
;------------------------------------------------------------------------------
.386
.model flat,C
.code
;------------------------------------------------------------------------------
; UINT32
; EFIAPI
; InternalSyncDecrement (
; IN UINT32 *Value
; );
;------------------------------------------------------------------------------
InternalSyncDecrement PROC
mov eax, [esp + 4]
lock dec dword ptr [eax]
mov eax, [eax]
ret
InternalSyncDecrement ENDP
END

View File

@@ -0,0 +1,28 @@
/**
InterlockedDecrement function
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
UINT32
EFIAPI
InternalSyncDecrement (
IN volatile UINT32 *Value
)
{
_asm {
mov eax, Value
lock dec dword ptr [eax]
mov eax, [eax]
}
}

View File

@@ -1,40 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; InterlockedIncrement.Asm
;
; Abstract:
;
; InterlockedIncrement function
;
; Notes:
;
;------------------------------------------------------------------------------
.386
.model flat,C
.code
;------------------------------------------------------------------------------
; UINT32
; EFIAPI
; InternalSyncIncrement (
; IN UINT32 *Value
; );
;------------------------------------------------------------------------------
InternalSyncIncrement PROC
mov eax, [esp + 4]
lock inc dword ptr [eax]
mov eax, [eax]
ret
InternalSyncIncrement ENDP
END

View File

@@ -0,0 +1,29 @@
/**
InterLockedIncrement function
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
UINT32
EFIAPI
InternalSyncIncrement (
IN volatile UINT32 *Value
)
{
_asm {
mov eax, Value
lock inc dword ptr [eax]
mov eax, [eax]
}
}

View File

@@ -20,15 +20,21 @@ Abstract:
--*/
#include "..\BaseLibInternal.h"
#include "BaseLibInternals.h"
/**
Transfers control to a function starting with a new stack.
Transfers control to the function specified by EntryPoint using the new stack
specified by NewStack and passing in the parameters specified by Context1 and
Context2. Context1 and Context2 are optional and may be NULL. The function
EntryPoint must never return.
by Context1 and Context2. Context1 and Context2 are optional and may
be NULL. The function EntryPoint must never return.
Marker will be ignored on IA-32, x64, and EBC.
IPF CPUs expect one additional parameter of type VOID * that specifies
the new backing store pointer.
If EntryPoint is NULL, then ASSERT().
If NewStack is NULL, then ASSERT().
@param EntryPoint A pointer to function to call with the new stack.
@param Context1 A pointer to the context to pass into the EntryPoint
@@ -37,19 +43,26 @@ Abstract:
function.
@param NewStack A pointer to the new stack to use for the EntryPoint
function.
@param Marker VA_LIST marker for the variable argument list.
**/
VOID
EFIAPI
InternalSwitchStack (
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
IN VOID *Context1,
IN VOID *Context2,
IN VOID *NewStack
IN VOID *Context1, OPTIONAL
IN VOID *Context2, OPTIONAL
IN VOID *NewStack,
IN VA_LIST Marker
)
{
BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
//
// Stack should be aligned with CPU_STACK_ALIGNMENT
//
ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
JumpBuffer.Eip = (UINTN)EntryPoint;
JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID*);
JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2);

View File

@@ -0,0 +1,27 @@
/**
AsmInvd function
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
VOID
EFIAPI
AsmInvd (
VOID
)
{
_asm {
invd
}
}

View File

@@ -1,47 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; LRotU64.asm
;
; Abstract:
;
; 64-bit left rotation for Ia32
;
;------------------------------------------------------------------------------
.686
.model flat,C
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathLRotU64 (
; IN UINT64 Operand,
; IN UINTN Count
; );
;------------------------------------------------------------------------------
InternalMathLRotU64 PROC USES ebx
mov cl, [esp + 16]
mov edx, [esp + 12]
mov eax, [esp + 8]
shld ebx, edx, cl
shld edx, eax, cl
ror ebx, cl
shld eax, ebx, cl
test cl, 32 ; Count >= 32?
cmovnz ecx, eax
cmovnz eax, edx
cmovnz edx, ecx
ret
InternalMathLRotU64 ENDP
END

View File

@@ -0,0 +1,46 @@
/*++
Copyright (c) 2004 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
LRotU64.c
Abstract:
--*/
#include "BaseLibInternals.h"
UINT64
EFIAPI
InternalMathLRotU64 (
IN UINT64 Operand,
IN UINTN Count
)
{
_asm {
mov cl, byte ptr [Count]
mov edx, dword ptr [Operand + 4]
mov eax, dword ptr [Operand + 0]
shld ebx, edx, cl
shld edx, eax, cl
ror ebx, cl
shld eax, ebx, cl
test cl, 32 ; Count >= 32?
cmovnz ecx, eax
cmovnz eax, edx
cmovnz edx, ecx
}
}

View File

@@ -1,44 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; LShiftU64.asm
;
; Abstract:
;
; 64-bit left shift function for IA-32
;
;------------------------------------------------------------------------------
.686
.model flat,C
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathLShiftU64 (
; IN UINT64 Operand,
; IN UINTN Count
; );
;------------------------------------------------------------------------------
InternalMathLShiftU64 PROC
mov cl, [esp + 12]
xor eax, eax
mov edx, [esp + 4]
test cl, 32 ; Count >= 32?
cmovz eax, edx
cmovz edx, [esp + 8]
shld edx, eax, cl
shl eax, cl
ret
InternalMathLShiftU64 ENDP
END

View File

@@ -0,0 +1,43 @@
/*++
Copyright (c) 2004 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
LShiftU64.c
Abstract:
--*/
#include "BaseLibInternals.h"
UINT64
EFIAPI
InternalMathLShiftU64 (
IN UINT64 Operand,
IN UINTN Count
)
{
_asm {
mov cl, byte ptr [Count]
xor eax, eax
mov edx, dword ptr [Operand + 0]
test cl, 32 // Count >= 32?
cmovz eax, edx
cmovz edx, dword ptr [Operand + 4]
shld edx, eax, cl
shl eax, cl
}
}

View File

@@ -1,44 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; LongJump.Asm
;
; Abstract:
;
; Implementation of _LongJump() on IA-32.
;
;------------------------------------------------------------------------------
.386
.model flat,C
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; InternalLongJump (
; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
; IN UINTN Value
; );
;------------------------------------------------------------------------------
InternalLongJump PROC
pop eax ; skip return address
pop edx ; edx <- JumpBuffer
pop eax ; eax <- Value
mov ebx, [edx]
mov esi, [edx + 4]
mov edi, [edx + 8]
mov ebp, [edx + 12]
mov esp, [edx + 16]
jmp dword ptr [edx + 20] ; restore "eip"
InternalLongJump ENDP
END

View File

@@ -0,0 +1,37 @@
/**
Implementation of _LongJump() on IA-32.
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
__declspec (naked)
VOID
EFIAPI
InternalLongJump (
IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
IN UINTN Value
)
{
_asm {
pop eax ; skip return address
pop edx ; edx <- JumpBuffer
pop eax ; eax <- Value
mov ebx, [edx]
mov esi, [edx + 4]
mov edi, [edx + 8]
mov ebp, [edx + 12]
mov esp, [edx + 16]
jmp dword ptr [edx + 20]
}
}

View File

@@ -1,43 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; DivU64x32.asm
;
; Abstract:
;
; Calculate the remainder of a 64-bit integer by a 32-bit integer
;
;------------------------------------------------------------------------------
.386
.model flat,C
.code
;------------------------------------------------------------------------------
; UINT32
; EFIAPI
; InternalMathModU64x32 (
; IN UINT64 Dividend,
; IN UINT32 Divisor
; );
;------------------------------------------------------------------------------
InternalMathModU64x32 PROC
mov eax, [esp + 8]
mov ecx, [esp + 12]
xor edx, edx
div ecx
mov eax, [esp + 4]
div ecx
mov eax, edx
ret
InternalMathModU64x32 ENDP
END

View File

@@ -0,0 +1,41 @@
/*++
Copyright (c) 2004 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
ModU64x32.c
Abstract:
--*/
#include "BaseLibInternals.h"
UINT32
EFIAPI
InternalMathModU64x32 (
IN UINT64 Dividend,
IN UINT32 Divisor
)
{
_asm {
mov eax, dword ptr [Dividend + 4]
mov ecx, Divisor
xor edx, edx
div ecx
mov eax, dword ptr [Dividend + 0]
div ecx
mov eax, edx
}
}

View File

@@ -1,43 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; Monitor.Asm
;
; Abstract:
;
; AsmMonitor function
;
; Notes:
;
;------------------------------------------------------------------------------
.686
.model flat,C
.code
;------------------------------------------------------------------------------
; UINTN
; EFIAPI
; AsmMonitor (
; IN UINTN Eax,
; IN UINTN Ecx,
; IN UINTN Edx
; );
;------------------------------------------------------------------------------
AsmMonitor PROC
mov eax, [esp + 4]
mov ecx, [esp + 8]
mov edx, [esp + 12]
DB 0fh, 1, 0c8h ; monitor
ret
AsmMonitor ENDP
END

View File

@@ -0,0 +1,34 @@
/**
AsmMonitor function
Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "BaseLibInternals.h"
UINTN
EFIAPI
AsmMonitor (
IN UINTN RegisterEax,
IN UINTN RegisterEcx,
IN UINTN RegisterEdx
)
{
_asm {
mov eax, RegisterEax
mov ecx, RegisterEcx
mov edx, RegisterEdx
_emit 0x0f // monitor
_emit 0x01
_emit 0xc8
}
}

View File

@@ -1,41 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; MultU64x32.asm
;
; Abstract:
;
; Calculate the product of a 64-bit integer and a 32-bit integer
;
;------------------------------------------------------------------------------
.386
.model flat,C
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathMultU64x32 (
; IN UINT64 Multiplicand,
; IN UINT32 Multiplier
; );
;------------------------------------------------------------------------------
InternalMathMultU64x32 PROC
mov ecx, [esp + 12]
mov eax, ecx
imul ecx, [esp + 8] ; overflow not detectable
mul dword ptr [esp + 4]
add edx, ecx
ret
InternalMathMultU64x32 ENDP
END

View File

@@ -0,0 +1,40 @@
/*++
Copyright (c) 2004 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
MultU64x32.c
Abstract:
--*/
#include "BaseLibInternals.h"
UINT64
EFIAPI
InternalMathMultU64x32 (
IN UINT64 Multiplicand,
IN UINT32 Multiplier
)
{
_asm {
mov ecx, Multiplier
mov eax, ecx
imul ecx, dword ptr [Multiplicand + 4] // overflow not detectable
mul dword ptr [Multiplicand + 0]
add edx, ecx
}
}

View File

@@ -1,45 +0,0 @@
; Copyright (c) 2004, Intel Corporation
; All rights reserved. This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
; Module Name:
;
; MultU64x64.asm
;
; Abstract:
;
; Calculate the product of a 64-bit integer and another 64-bit integer
;
;------------------------------------------------------------------------------
.386
.model flat,C
.code
;------------------------------------------------------------------------------
; UINT64
; EFIAPI
; InternalMathMultU64x64 (
; IN UINT64 Multiplicand,
; IN UINT64 Multiplier
; );
;------------------------------------------------------------------------------
InternalMathMultU64x64 PROC USES ebx
mov ebx, [esp + 8] ; ebx <- M1[0..31]
mov edx, [esp + 16] ; edx <- M2[0..31]
mov ecx, ebx
mov eax, edx
imul ebx, [esp + 20] ; ebx <- M1[0..31] * M2[32..63]
imul edx, [esp + 12] ; edx <- M1[32..63] * M2[0..31]
add ebx, edx ; carries are abandoned
mul ecx ; edx:eax <- M1[0..31] * M2[0..31]
add edx, ebx ; carries are abandoned
ret
InternalMathMultU64x64 ENDP
END

View File

@@ -0,0 +1,44 @@
/*++
Copyright (c) 2004 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
MultU64x64.c
Abstract:
--*/
#include "BaseLibInternals.h"
UINT64
EFIAPI
InternalMathMultU64x64 (
IN UINT64 Multiplicand,
IN UINT64 Multiplier
)
{
_asm {
mov ebx, dword ptr [Multiplicand + 0]
mov edx, dword ptr [Multiplier + 0]
mov ecx, ebx
mov eax, edx
imul ebx, dword ptr [Multiplier + 4]
imul edx, dword ptr [Multiplicand + 4]
add ebx, edx
mul ecx
add edx, ebx
}
}

Some files were not shown because too many files have changed in this diff Show More