edkiigluebaselib.h
来自「EFI BIOS是Intel提出的下一代的BIOS标准。这里上传的Edk源代码是」· C头文件 代码 · 共 1,967 行 · 第 1/5 页
H
1,967 行
/*++
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:
EdkIIGlueBaseLib.h
Abstract:
Memory-only library functions with no library constructor/destructor
--*/
#ifndef __EDKII_GLUE_BASE_LIB_H__
#define __EDKII_GLUE_BASE_LIB_H__
//
// String Functions
//
#define StrCpy(_Dest, _Source) GlueStrCpy(_Dest, _Source)
#define StrnCpy(_Dest, _Source, _Length) GlueStrnCpy(_Dest, _Source, _Length)
#define StrLen(_String) GlueStrLen(_String)
#define StrSize(_String) GlueStrSize(_String)
#define StrCmp(_FristString, _SecondString) GlueStrCmp(_FristString, _SecondString)
#define StrnCmp(_FirstString, _SecondString, _Length) GlueStrnCmp(_FirstString, _SecondString, _Length)
#define StrCat(_Dest, _Source) GlueStrCat(_Dest, _Source)
#define StrnCat(_Dest, _Source, _Length) GlueStrnCat(_Dest, _Source, _Length)
//
// Linked List
//
#define InitializeListHead(_ListHead) GlueInitializeListHead(_ListHead)
#define InsertHeadList(_ListHead, _Entry ) GlueInsertHeadList(_ListHead, _Entry)
#define InsertTailList(_ListHead, _Entry) GlueInsertTailList(_ListHead, _Entry)
#define GetFirstNode(_List) GlueGetFirstNode(_List)
#define GetNextNode(_List, _Node) GlueGetNextNode(_List, _Node)
#define IsListEmpty(_ListHead) GlueIsListEmpty(_ListHead)
#define IsNull(_List, _Node) GlueIsNull(_List, _Node)
#define IsNodeAtEnd(_List, _Node) GlueIsNodeAtEnd(_List, _Node)
#define SwapListEntries(_FirstEntry, _SecondEntry) GlueSwapListEntries(_FirstEntry, _SecondEntry)
#define RemoveEntryList(_Entry) GlueRemoveEntryList(_Entry)
//
// Math Functions
//
#define LShiftU64(_Op, _Count) GlueLShiftU64(_Op, _Count)
#define RShiftU64(_Op, _Count) GlueRShiftU64(_Op, _Count)
#define MultU64x32(_Multiplicand, _Multiplier) GlueMultU64x32(_Multiplicand, _Multiplier)
#define DivU64x32(_Dividend, _Divisor) GlueDivU64x32(_Dividend, _Divisor)
//
// Others
//
#define GetInterruptState() GlueGetInterruptState()
//
// Definitions for architecture specific types
// These include SPIN_LOCK and BASE_LIBRARY_JUMP_BUFFER
//
//
// SPIN_LOCK
//
typedef UINTN SPIN_LOCK;
#if defined (MDE_CPU_IA32)
//
// IA32 context buffer used by SetJump() and LongJump()
//
typedef struct {
UINT32 Ebx;
UINT32 Esi;
UINT32 Edi;
UINT32 Ebp;
UINT32 Esp;
UINT32 Eip;
} BASE_LIBRARY_JUMP_BUFFER;
#elif defined (MDE_CPU_IPF)
//
// IPF context buffer used by SetJump() and LongJump()
//
typedef struct {
UINT64 F2[2];
UINT64 F3[2];
UINT64 F4[2];
UINT64 F5[2];
UINT64 F16[2];
UINT64 F17[2];
UINT64 F18[2];
UINT64 F19[2];
UINT64 F20[2];
UINT64 F21[2];
UINT64 F22[2];
UINT64 F23[2];
UINT64 F24[2];
UINT64 F25[2];
UINT64 F26[2];
UINT64 F27[2];
UINT64 F28[2];
UINT64 F29[2];
UINT64 F30[2];
UINT64 F31[2];
UINT64 R4;
UINT64 R5;
UINT64 R6;
UINT64 R7;
UINT64 SP;
UINT64 BR0;
UINT64 BR1;
UINT64 BR2;
UINT64 BR3;
UINT64 BR4;
UINT64 BR5;
UINT64 InitialUNAT;
UINT64 AfterSpillUNAT;
UINT64 PFS;
UINT64 BSP;
UINT64 Predicates;
UINT64 LoopCount;
UINT64 FPSR;
} BASE_LIBRARY_JUMP_BUFFER;
#elif defined (MDE_CPU_X64)
//
// X64 context buffer used by SetJump() and LongJump()
//
typedef struct {
UINT64 Rbx;
UINT64 Rsp;
UINT64 Rbp;
UINT64 Rdi;
UINT64 Rsi;
UINT64 R12;
UINT64 R13;
UINT64 R14;
UINT64 R15;
UINT64 Rip;
} BASE_LIBRARY_JUMP_BUFFER;
#elif defined (MDE_CPU_EBC)
//
// EBC context buffer used by SetJump() and LongJump()
//
typedef struct {
UINT64 R0;
UINT64 R1;
UINT64 R2;
UINT64 R3;
UINT64 IP;
} BASE_LIBRARY_JUMP_BUFFER;
#else
#error Unknown Processor Type
#endif
//
// String Services
//
/**
Copies one Null-terminated Unicode string to another Null-terminated Unicode
string and returns the new Unicode string.
This function copies the contents of the Unicode string Source to the Unicode
string Destination, and returns Destination. If Source and Destination
overlap, then the results are undefined.
If Destination is NULL, then ASSERT().
If Source is NULL, then ASSERT().
If Source and Destination overlap, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param Destination Pointer to a Null-terminated Unicode string.
@param Source Pointer to a Null-terminated Unicode string.
@return Destiantion
**/
CHAR16 *
EFIAPI
GlueStrCpy (
OUT CHAR16 *Destination,
IN CONST CHAR16 *Source
);
/**
Copies one Null-terminated Unicode string with a maximum length to another
Null-terminated Unicode string with a maximum length and returns the new
Unicode string.
This function copies the contents of the Unicode string Source to the Unicode
string Destination, and returns Destination. At most, Length Unicode
characters are copied from Source to Destination. If Length is 0, then
Destination is returned unmodified. If Length is greater that the number of
Unicode characters in Source, then Destination is padded with Null Unicode
characters. If Source and Destination overlap, then the results are
undefined.
If Destination is NULL, then ASSERT().
If Source is NULL, then ASSERT().
If Source and Destination overlap, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param Destination Pointer to a Null-terminated Unicode string.
@param Source Pointer to a Null-terminated Unicode string.
@param Length Maximum number of Unicode characters to copy.
@return Destination
**/
CHAR16 *
EFIAPI
GlueStrnCpy (
OUT CHAR16 *Destination,
IN CONST CHAR16 *Source,
IN UINTN Length
);
/**
Returns the length of a Null-terminated Unicode string.
This function returns the number of Unicode characters in the Null-terminated
Unicode string specified by String.
If String is NULL, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and String contains more than
PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param String Pointer to a Null-terminated Unicode string.
@return The length of String.
**/
UINTN
EFIAPI
GlueStrLen (
IN CONST CHAR16 *String
);
/**
Returns the size of a Null-terminated Unicode string in bytes, including the
Null terminator.
This function returns the size, in bytes, of the Null-terminated Unicode
string specified by String.
If String is NULL, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and String contains more than
PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param String Pointer to a Null-terminated Unicode string.
@return The size of String.
**/
UINTN
EFIAPI
GlueStrSize (
IN CONST CHAR16 *String
);
/**
Compares two Null-terminated Unicode strings, and returns the difference
between the first mismatched Unicode characters.
This function compares the Null-terminated Unicode string FirstString to the
Null-terminated Unicode string SecondString. If FirstString is identical to
SecondString, then 0 is returned. Otherwise, the value returned is the first
mismatched Unicode character in SecondString subtracted from the first
mismatched Unicode character in FirstString.
If FirstString is NULL, then ASSERT().
If SecondString is NULL, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more
than PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more
than PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param FirstString Pointer to a Null-terminated Unicode string.
@param SecondString Pointer to a Null-terminated Unicode string.
@retval 0 FirstString is identical to SecondString.
@retval !=0 FirstString is not identical to SecondString.
**/
INTN
EFIAPI
GlueStrCmp (
IN CONST CHAR16 *FirstString,
IN CONST CHAR16 *SecondString
);
/**
Compares two Null-terminated Unicode strings with maximum lengths, and
returns the difference between the first mismatched Unicode characters.
This function compares the Null-terminated Unicode string FirstString to the
Null-terminated Unicode string SecondString. At most, Length Unicode
characters will be compared. If Length is 0, then 0 is returned. If
FirstString is identical to SecondString, then 0 is returned. Otherwise, the
value returned is the first mismatched Unicode character in SecondString
subtracted from the first mismatched Unicode character in FirstString.
If FirstString is NULL, then ASSERT().
If SecondString is NULL, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and FirstString contains more
than PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and SecondString contains more
than PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param FirstString Pointer to a Null-terminated Unicode string.
@param SecondString Pointer to a Null-terminated Unicode string.
@param Length Maximum number of Unicode characters to compare.
@retval 0 FirstString is identical to SecondString.
@retval !=0 FirstString is not identical to SecondString.
**/
INTN
EFIAPI
GlueStrnCmp (
IN CONST CHAR16 *FirstString,
IN CONST CHAR16 *SecondString,
IN UINTN Length
);
/**
Concatenates one Null-terminated Unicode string to another Null-terminated
Unicode string, and returns the concatenated Unicode string.
This function concatenates two Null-terminated Unicode strings. The contents
of Null-terminated Unicode string Source are concatenated to the end of
Null-terminated Unicode string Destination. The Null-terminated concatenated
Unicode String is returned. If Source and Destination overlap, then the
results are undefined.
If Destination is NULL, then ASSERT().
If Source is NULL, then ASSERT().
If Source and Destination overlap, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and Destination contains more
than PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and Source contains more than
PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
If PcdMaximumUnicodeStringLength is not zero, and concatenating Destination
and Source results in a Unicode string with more than
PcdMaximumUnicodeStringLength Unicode characters not including the
Null-terminator, then ASSERT().
@param Destination Pointer to a Null-terminated Unicode string.
@param Source Pointer to a Null-terminated Unicode string.
@return Destination
**/
CHAR16 *
EFIAPI
GlueStrCat (
IN OUT CHAR16 *Destination,
IN CONST CHAR16 *Source
);
/**
Concatenates one Null-terminated Unicode string with a maximum length to the
end of another Null-terminated Unicode string, and returns the concatenated
Unicode string.
This function concatenates two Null-terminated Unicode strings. The contents
of Null-terminated Unicode string Source are concatenated to the end of
Null-terminated Unicode string Destination, and Destination is returned. At
most, Length Unicode characters are concatenated from Source to the end of
Destination, and Destination is always Null-terminated. If Length is 0, then
Destination is returned unmodified. If Source and Destination overlap, then
the results are undefined.
If Destination is NULL, then ASSERT().
If Source is NULL, then ASSERT().
If Source and Destination overlap, then ASSERT().
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?