Update to make end-of-line consistent for all source files in MdePkg. There are no other updates besides that change.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9141 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,118 +1,118 @@
|
|||||||
|
|
||||||
/** @file
|
/** @file
|
||||||
Processor or Compiler specific defines and types for ARM.
|
Processor or Compiler specific defines and types for ARM.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
|
Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef __PROCESSOR_BIND_H__
|
#ifndef __PROCESSOR_BIND_H__
|
||||||
#define __PROCESSOR_BIND_H__
|
#define __PROCESSOR_BIND_H__
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Define the processor type so other code can make processor based choices
|
/// Define the processor type so other code can make processor based choices
|
||||||
///
|
///
|
||||||
#define MDE_CPU_ARM
|
#define MDE_CPU_ARM
|
||||||
|
|
||||||
//
|
//
|
||||||
// Make sure we are useing the correct packing rules per EFI specification
|
// Make sure we are useing the correct packing rules per EFI specification
|
||||||
//
|
//
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _MSC_EXTENSIONS
|
#if _MSC_EXTENSIONS
|
||||||
//
|
//
|
||||||
// use Microsoft* C complier dependent interger width types
|
// use Microsoft* C complier dependent interger width types
|
||||||
//
|
//
|
||||||
typedef unsigned __int64 UINT64;
|
typedef unsigned __int64 UINT64;
|
||||||
typedef __int64 INT64;
|
typedef __int64 INT64;
|
||||||
typedef unsigned __int32 UINT32;
|
typedef unsigned __int32 UINT32;
|
||||||
typedef __int32 INT32;
|
typedef __int32 INT32;
|
||||||
typedef unsigned short UINT16;
|
typedef unsigned short UINT16;
|
||||||
typedef unsigned short CHAR16;
|
typedef unsigned short CHAR16;
|
||||||
typedef short INT16;
|
typedef short INT16;
|
||||||
typedef unsigned char BOOLEAN;
|
typedef unsigned char BOOLEAN;
|
||||||
typedef unsigned char UINT8;
|
typedef unsigned char UINT8;
|
||||||
typedef char CHAR8;
|
typedef char CHAR8;
|
||||||
typedef char INT8;
|
typedef char INT8;
|
||||||
#else
|
#else
|
||||||
//
|
//
|
||||||
// Assume standard ARM alignment.
|
// Assume standard ARM alignment.
|
||||||
// Need to check portability of long long
|
// Need to check portability of long long
|
||||||
//
|
//
|
||||||
typedef unsigned long long UINT64;
|
typedef unsigned long long UINT64;
|
||||||
typedef long long INT64;
|
typedef long long INT64;
|
||||||
typedef unsigned int UINT32;
|
typedef unsigned int UINT32;
|
||||||
typedef int INT32;
|
typedef int INT32;
|
||||||
typedef unsigned short UINT16;
|
typedef unsigned short UINT16;
|
||||||
typedef unsigned short CHAR16;
|
typedef unsigned short CHAR16;
|
||||||
typedef short INT16;
|
typedef short INT16;
|
||||||
typedef unsigned char BOOLEAN;
|
typedef unsigned char BOOLEAN;
|
||||||
typedef unsigned char UINT8;
|
typedef unsigned char UINT8;
|
||||||
typedef char CHAR8;
|
typedef char CHAR8;
|
||||||
typedef char INT8;
|
typedef char INT8;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
|
/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
|
||||||
/// 8 bytes on supported 64-bit processor instructions)
|
/// 8 bytes on supported 64-bit processor instructions)
|
||||||
///
|
///
|
||||||
typedef UINT32 UINTN;
|
typedef UINT32 UINTN;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
|
/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
|
||||||
/// 8 bytes on supported 64-bit processor instructions)
|
/// 8 bytes on supported 64-bit processor instructions)
|
||||||
///
|
///
|
||||||
typedef INT32 INTN;
|
typedef INT32 INTN;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Processor specific defines
|
// Processor specific defines
|
||||||
//
|
//
|
||||||
|
|
||||||
///
|
///
|
||||||
/// A value of native width with the highest bit set.
|
/// A value of native width with the highest bit set.
|
||||||
///
|
///
|
||||||
#define MAX_BIT 0x80000000
|
#define MAX_BIT 0x80000000
|
||||||
|
|
||||||
///
|
///
|
||||||
/// A value of native width with the two highest bits set.
|
/// A value of native width with the two highest bits set.
|
||||||
///
|
///
|
||||||
#define MAX_2_BITS 0xC0000000
|
#define MAX_2_BITS 0xC0000000
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Maximum legal ARM address
|
/// Maximum legal ARM address
|
||||||
///
|
///
|
||||||
#define MAX_ADDRESS 0xFFFFFFFF
|
#define MAX_ADDRESS 0xFFFFFFFF
|
||||||
|
|
||||||
///
|
///
|
||||||
/// The stack alignment required for ARM
|
/// The stack alignment required for ARM
|
||||||
///
|
///
|
||||||
#define CPU_STACK_ALIGNMENT sizeof(UINT64)
|
#define CPU_STACK_ALIGNMENT sizeof(UINT64)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Modifier to ensure that all protocol member functions and EFI intrinsics
|
// Modifier to ensure that all protocol member functions and EFI intrinsics
|
||||||
// use the correct C calling convention. All protocol member functions and
|
// use the correct C calling convention. All protocol member functions and
|
||||||
// EFI intrinsics are required to modify thier member functions with EFIAPI.
|
// EFI intrinsics are required to modify thier member functions with EFIAPI.
|
||||||
//
|
//
|
||||||
#define EFIAPI
|
#define EFIAPI
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
///
|
///
|
||||||
/// For GNU assembly code, .global or .globl can declare global symbols.
|
/// For GNU assembly code, .global or .globl can declare global symbols.
|
||||||
/// Define this macro to unify the usage.
|
/// Define this macro to unify the usage.
|
||||||
///
|
///
|
||||||
#define ASM_GLOBAL .globl
|
#define ASM_GLOBAL .globl
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return the pointer to the first instruction of a function given a function pointer.
|
Return the pointer to the first instruction of a function given a function pointer.
|
||||||
On ARM CPU architectures, these two pointer values are the same,
|
On ARM CPU architectures, these two pointer values are the same,
|
||||||
@ -123,6 +123,6 @@ typedef INT32 INTN;
|
|||||||
@return The pointer to the first instruction of a function given a function pointer.
|
@return The pointer to the first instruction of a function given a function pointer.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define FUNCTION_ENTRY_POINT(FunctionPointer) (FunctionPointer)
|
#define FUNCTION_ENTRY_POINT(FunctionPointer) (FunctionPointer)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
functions, and CPU architecture-specific functions.
|
functions, and CPU architecture-specific functions.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||||
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -126,26 +126,26 @@ typedef struct {
|
|||||||
|
|
||||||
#endif // defined (MDE_CPU_EBC)
|
#endif // defined (MDE_CPU_EBC)
|
||||||
|
|
||||||
#if defined (MDE_CPU_ARM)
|
#if defined (MDE_CPU_ARM)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT32 R3; ///< Copy of R13
|
UINT32 R3; ///< Copy of R13
|
||||||
UINT32 R4;
|
UINT32 R4;
|
||||||
UINT32 R5;
|
UINT32 R5;
|
||||||
UINT32 R6;
|
UINT32 R6;
|
||||||
UINT32 R7;
|
UINT32 R7;
|
||||||
UINT32 R8;
|
UINT32 R8;
|
||||||
UINT32 R9;
|
UINT32 R9;
|
||||||
UINT32 R10;
|
UINT32 R10;
|
||||||
UINT32 R11;
|
UINT32 R11;
|
||||||
UINT32 R12;
|
UINT32 R12;
|
||||||
UINT32 R14;
|
UINT32 R14;
|
||||||
} BASE_LIBRARY_JUMP_BUFFER;
|
} BASE_LIBRARY_JUMP_BUFFER;
|
||||||
|
|
||||||
#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 4
|
#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 4
|
||||||
|
|
||||||
#endif // defined (MDE_CPU_ARM)
|
#endif // defined (MDE_CPU_ARM)
|
||||||
|
|
||||||
//
|
//
|
||||||
// String Services
|
// String Services
|
||||||
//
|
//
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
and can be ported easily to any environment.
|
and can be ported easily to any environment.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||||
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -192,10 +192,10 @@ typedef struct {
|
|||||||
/// otherwise, the entry remains to be 0.
|
/// otherwise, the entry remains to be 0.
|
||||||
///
|
///
|
||||||
PHYSICAL_ADDRESS HiiResourceData;
|
PHYSICAL_ADDRESS HiiResourceData;
|
||||||
///
|
///
|
||||||
/// Private storage for implementation specific data.
|
/// Private storage for implementation specific data.
|
||||||
///
|
///
|
||||||
UINT64 Context;
|
UINT64 Context;
|
||||||
} PE_COFF_LOADER_IMAGE_CONTEXT;
|
} PE_COFF_LOADER_IMAGE_CONTEXT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
processor and handle context save and restore operations.
|
processor and handle context save and restore operations.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -472,61 +472,61 @@ typedef struct {
|
|||||||
UINT64 Ip;
|
UINT64 Ip;
|
||||||
} EFI_SYSTEM_CONTEXT_EBC;
|
} EFI_SYSTEM_CONTEXT_EBC;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// ARM processor exception types
|
/// ARM processor exception types
|
||||||
///
|
///
|
||||||
#define EXCEPT_ARM_RESET 0
|
#define EXCEPT_ARM_RESET 0
|
||||||
#define EXCEPT_ARM_UNDEFINED_INSTRUCTION 1
|
#define EXCEPT_ARM_UNDEFINED_INSTRUCTION 1
|
||||||
#define EXCEPT_ARM_SOFTWARE_INTERRUPT 2
|
#define EXCEPT_ARM_SOFTWARE_INTERRUPT 2
|
||||||
#define EXCEPT_ARM_PREFETCH_ABORT 3
|
#define EXCEPT_ARM_PREFETCH_ABORT 3
|
||||||
#define EXCEPT_ARM_DATA_ABORT 4
|
#define EXCEPT_ARM_DATA_ABORT 4
|
||||||
#define EXCEPT_ARM_RESERVED 5
|
#define EXCEPT_ARM_RESERVED 5
|
||||||
#define EXCEPT_ARM_IRQ 6
|
#define EXCEPT_ARM_IRQ 6
|
||||||
#define EXCEPT_ARM_FIQ 7
|
#define EXCEPT_ARM_FIQ 7
|
||||||
|
|
||||||
///
|
///
|
||||||
/// For coding convenience, define the maximum valid ARM exception.
|
/// For coding convenience, define the maximum valid ARM exception.
|
||||||
///
|
///
|
||||||
#define MAX_ARM_EXCEPTION EXCEPT_ARM_FIQ
|
#define MAX_ARM_EXCEPTION EXCEPT_ARM_FIQ
|
||||||
|
|
||||||
///
|
///
|
||||||
/// ARM processor context definition
|
/// ARM processor context definition
|
||||||
///
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT32 R0;
|
UINT32 R0;
|
||||||
UINT32 R1;
|
UINT32 R1;
|
||||||
UINT32 R2;
|
UINT32 R2;
|
||||||
UINT32 R3;
|
UINT32 R3;
|
||||||
UINT32 R4;
|
UINT32 R4;
|
||||||
UINT32 R5;
|
UINT32 R5;
|
||||||
UINT32 R6;
|
UINT32 R6;
|
||||||
UINT32 R7;
|
UINT32 R7;
|
||||||
UINT32 R8;
|
UINT32 R8;
|
||||||
UINT32 R9;
|
UINT32 R9;
|
||||||
UINT32 R10;
|
UINT32 R10;
|
||||||
UINT32 R11;
|
UINT32 R11;
|
||||||
UINT32 R12;
|
UINT32 R12;
|
||||||
UINT32 SP;
|
UINT32 SP;
|
||||||
UINT32 LR;
|
UINT32 LR;
|
||||||
UINT32 PC;
|
UINT32 PC;
|
||||||
UINT32 CPSR;
|
UINT32 CPSR;
|
||||||
UINT32 DFSR;
|
UINT32 DFSR;
|
||||||
UINT32 DFAR;
|
UINT32 DFAR;
|
||||||
UINT32 IFSR;
|
UINT32 IFSR;
|
||||||
UINT32 IFAR;
|
UINT32 IFAR;
|
||||||
} EFI_SYSTEM_CONTEXT_ARM;
|
} EFI_SYSTEM_CONTEXT_ARM;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Universal EFI_SYSTEM_CONTEXT definition
|
/// Universal EFI_SYSTEM_CONTEXT definition
|
||||||
///
|
///
|
||||||
typedef union {
|
typedef union {
|
||||||
EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
|
EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
|
||||||
EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
|
EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
|
||||||
EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
|
EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
|
||||||
EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
|
EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
|
||||||
EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
|
EFI_SYSTEM_CONTEXT_ARM *SystemContextArm;
|
||||||
} EFI_SYSTEM_CONTEXT;
|
} EFI_SYSTEM_CONTEXT;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -566,8 +566,8 @@ typedef enum {
|
|||||||
IsaIa32 = IMAGE_FILE_MACHINE_I386, ///< 0x014C
|
IsaIa32 = IMAGE_FILE_MACHINE_I386, ///< 0x014C
|
||||||
IsaX64 = IMAGE_FILE_MACHINE_X64, ///< 0x8664
|
IsaX64 = IMAGE_FILE_MACHINE_X64, ///< 0x8664
|
||||||
IsaIpf = IMAGE_FILE_MACHINE_IA64, ///< 0x0200
|
IsaIpf = IMAGE_FILE_MACHINE_IA64, ///< 0x0200
|
||||||
IsaEbc = IMAGE_FILE_MACHINE_EBC, ///< 0x0EBC
|
IsaEbc = IMAGE_FILE_MACHINE_EBC, ///< 0x0EBC
|
||||||
IsaArm = IMAGE_FILE_MACHINE_ARMTHUMB_MIXED ///< 0x01c2
|
IsaArm = IMAGE_FILE_MACHINE_ARMTHUMB_MIXED ///< 0x01c2
|
||||||
} EFI_INSTRUCTION_SET_ARCHITECTURE;
|
} EFI_INSTRUCTION_SET_ARCHITECTURE;
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Defines data types and constants introduced in UEFI.
|
Defines data types and constants introduced in UEFI.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||||
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -198,11 +198,11 @@ typedef union {
|
|||||||
///
|
///
|
||||||
#define EFI_IMAGE_MACHINE_X64 0x8664
|
#define EFI_IMAGE_MACHINE_X64 0x8664
|
||||||
|
|
||||||
///
|
///
|
||||||
/// PE32+ Machine type for ARM mixed ARM and Thumb/Thumb2 images
|
/// PE32+ Machine type for ARM mixed ARM and Thumb/Thumb2 images
|
||||||
///
|
///
|
||||||
#define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED 0x01C2
|
#define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED 0x01C2
|
||||||
|
|
||||||
|
|
||||||
#if defined (MDE_CPU_IA32)
|
#if defined (MDE_CPU_IA32)
|
||||||
|
|
||||||
@ -225,13 +225,13 @@ typedef union {
|
|||||||
|
|
||||||
#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_IA32)
|
#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_IA32)
|
||||||
|
|
||||||
#elif defined (MDE_CPU_ARM)
|
#elif defined (MDE_CPU_ARM)
|
||||||
|
|
||||||
#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
|
#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
|
||||||
(((Machine) == EFI_IMAGE_MACHINE_ARMTHUMB_MIXED) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
|
(((Machine) == EFI_IMAGE_MACHINE_ARMTHUMB_MIXED) || ((Machine) == EFI_IMAGE_MACHINE_EBC))
|
||||||
|
|
||||||
#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_ARMTHUMB_MIXED)
|
#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_ARMTHUMB_MIXED)
|
||||||
|
|
||||||
#elif defined (MDE_CPU_EBC)
|
#elif defined (MDE_CPU_EBC)
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
by this include file.
|
by this include file.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||||
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -2061,7 +2061,7 @@ typedef struct {
|
|||||||
#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"
|
#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"
|
||||||
#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"
|
#define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"
|
||||||
#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"
|
#define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"
|
||||||
#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"
|
#define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"
|
||||||
|
|
||||||
#if defined (MDE_CPU_IA32)
|
#if defined (MDE_CPU_IA32)
|
||||||
#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
|
#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
|
||||||
@ -2070,8 +2070,8 @@ typedef struct {
|
|||||||
#elif defined (MDE_CPU_X64)
|
#elif defined (MDE_CPU_X64)
|
||||||
#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_X64
|
#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_X64
|
||||||
#elif defined (MDE_CPU_EBC)
|
#elif defined (MDE_CPU_EBC)
|
||||||
#elif defined (MDE_CPU_ARM)
|
#elif defined (MDE_CPU_ARM)
|
||||||
#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_ARM
|
#define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_ARM
|
||||||
#else
|
#else
|
||||||
#error Unknown Processor Type
|
#error Unknown Processor Type
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# This library assumes there are no chipset dependencies required to maintain caches.
|
# This library assumes there are no chipset dependencies required to maintain caches.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2008, Intel Corporation<BR>
|
# Copyright (c) 2007 - 2008, Intel Corporation<BR>
|
||||||
# Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
# Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
#
|
#
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -42,9 +42,9 @@
|
|||||||
[Sources.EBC]
|
[Sources.EBC]
|
||||||
EbcCache.c
|
EbcCache.c
|
||||||
|
|
||||||
[Sources.ARM]
|
[Sources.ARM]
|
||||||
ArmCache.c
|
ArmCache.c
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
|
|
||||||
|
@ -1,36 +1,36 @@
|
|||||||
/** @file
|
/** @file
|
||||||
CpuFlushTlb function for Ia32/X64 GCC.
|
CpuFlushTlb function for Ia32/X64 GCC.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||||
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.
|
Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.
|
||||||
|
|
||||||
Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.
|
Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
CpuFlushTlb (
|
CpuFlushTlb (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"movl %%cr3, %0\n\t"
|
"movl %%cr3, %0\n\t"
|
||||||
"movl %0, %%cr3 "
|
"movl %0, %%cr3 "
|
||||||
: "r" // %0
|
: "r" // %0
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
/** @file
|
/** @file
|
||||||
CpuSleep function for Ia32/X64 GCC.
|
CpuSleep function for Ia32/X64 GCC.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||||
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Places the CPU in a sleep state until an interrupt is received.
|
Places the CPU in a sleep state until an interrupt is received.
|
||||||
|
|
||||||
Places the CPU in a sleep state until an interrupt is received. If interrupts
|
Places the CPU in a sleep state until an interrupt is received. If interrupts
|
||||||
are disabled prior to calling this function, then the CPU will be placed in a
|
are disabled prior to calling this function, then the CPU will be placed in a
|
||||||
sleep state indefinitely.
|
sleep state indefinitely.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
CpuSleep (
|
CpuSleep (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__ ("hlt"::: "memory");
|
__asm__ __volatile__ ("hlt"::: "memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,430 +1,430 @@
|
|||||||
/** @file
|
/** @file
|
||||||
I/O Library for ARM.
|
I/O Library for ARM.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Include common header file for this module.
|
// Include common header file for this module.
|
||||||
//
|
//
|
||||||
#include "BaseIoLibIntrinsicInternal.h"
|
#include "BaseIoLibIntrinsicInternal.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads an 8-bit I/O port.
|
Reads an 8-bit I/O port.
|
||||||
|
|
||||||
Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
|
Reads the 8-bit I/O port specified by Port. The 8-bit read value is returned.
|
||||||
This function must guarantee that all I/O read and write operations are
|
This function must guarantee that all I/O read and write operations are
|
||||||
serialized.
|
serialized.
|
||||||
|
|
||||||
If 8-bit I/O port operations are not supported, then ASSERT().
|
If 8-bit I/O port operations are not supported, then ASSERT().
|
||||||
|
|
||||||
@param Port The I/O port to read.
|
@param Port The I/O port to read.
|
||||||
|
|
||||||
@return The value read.
|
@return The value read.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT8
|
UINT8
|
||||||
EFIAPI
|
EFIAPI
|
||||||
IoRead8 (
|
IoRead8 (
|
||||||
IN UINTN Port
|
IN UINTN Port
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes an 8-bit I/O port.
|
Writes an 8-bit I/O port.
|
||||||
|
|
||||||
Writes the 8-bit I/O port specified by Port with the value specified by Value
|
Writes the 8-bit I/O port specified by Port with the value specified by Value
|
||||||
and returns Value. This function must guarantee that all I/O read and write
|
and returns Value. This function must guarantee that all I/O read and write
|
||||||
operations are serialized.
|
operations are serialized.
|
||||||
|
|
||||||
If 8-bit I/O port operations are not supported, then ASSERT().
|
If 8-bit I/O port operations are not supported, then ASSERT().
|
||||||
|
|
||||||
@param Port The I/O port to write.
|
@param Port The I/O port to write.
|
||||||
@param Value The value to write to the I/O port.
|
@param Value The value to write to the I/O port.
|
||||||
|
|
||||||
@return The value written the I/O port.
|
@return The value written the I/O port.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT8
|
UINT8
|
||||||
EFIAPI
|
EFIAPI
|
||||||
IoWrite8 (
|
IoWrite8 (
|
||||||
IN UINTN Port,
|
IN UINTN Port,
|
||||||
IN UINT8 Value
|
IN UINT8 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads a 16-bit I/O port.
|
Reads a 16-bit I/O port.
|
||||||
|
|
||||||
Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
|
Reads the 16-bit I/O port specified by Port. The 16-bit read value is returned.
|
||||||
This function must guarantee that all I/O read and write operations are
|
This function must guarantee that all I/O read and write operations are
|
||||||
serialized.
|
serialized.
|
||||||
|
|
||||||
If 16-bit I/O port operations are not supported, then ASSERT().
|
If 16-bit I/O port operations are not supported, then ASSERT().
|
||||||
|
|
||||||
@param Port The I/O port to read.
|
@param Port The I/O port to read.
|
||||||
|
|
||||||
@return The value read.
|
@return The value read.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT16
|
UINT16
|
||||||
EFIAPI
|
EFIAPI
|
||||||
IoRead16 (
|
IoRead16 (
|
||||||
IN UINTN Port
|
IN UINTN Port
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes a 16-bit I/O port.
|
Writes a 16-bit I/O port.
|
||||||
|
|
||||||
Writes the 16-bit I/O port specified by Port with the value specified by Value
|
Writes the 16-bit I/O port specified by Port with the value specified by Value
|
||||||
and returns Value. This function must guarantee that all I/O read and write
|
and returns Value. This function must guarantee that all I/O read and write
|
||||||
operations are serialized.
|
operations are serialized.
|
||||||
|
|
||||||
If 16-bit I/O port operations are not supported, then ASSERT().
|
If 16-bit I/O port operations are not supported, then ASSERT().
|
||||||
|
|
||||||
@param Port The I/O port to write.
|
@param Port The I/O port to write.
|
||||||
@param Value The value to write to the I/O port.
|
@param Value The value to write to the I/O port.
|
||||||
|
|
||||||
@return The value written the I/O port.
|
@return The value written the I/O port.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT16
|
UINT16
|
||||||
EFIAPI
|
EFIAPI
|
||||||
IoWrite16 (
|
IoWrite16 (
|
||||||
IN UINTN Port,
|
IN UINTN Port,
|
||||||
IN UINT16 Value
|
IN UINT16 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads a 32-bit I/O port.
|
Reads a 32-bit I/O port.
|
||||||
|
|
||||||
Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
|
Reads the 32-bit I/O port specified by Port. The 32-bit read value is returned.
|
||||||
This function must guarantee that all I/O read and write operations are
|
This function must guarantee that all I/O read and write operations are
|
||||||
serialized.
|
serialized.
|
||||||
|
|
||||||
If 32-bit I/O port operations are not supported, then ASSERT().
|
If 32-bit I/O port operations are not supported, then ASSERT().
|
||||||
|
|
||||||
@param Port The I/O port to read.
|
@param Port The I/O port to read.
|
||||||
|
|
||||||
@return The value read.
|
@return The value read.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
IoRead32 (
|
IoRead32 (
|
||||||
IN UINTN Port
|
IN UINTN Port
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes a 32-bit I/O port.
|
Writes a 32-bit I/O port.
|
||||||
|
|
||||||
Writes the 32-bit I/O port specified by Port with the value specified by Value
|
Writes the 32-bit I/O port specified by Port with the value specified by Value
|
||||||
and returns Value. This function must guarantee that all I/O read and write
|
and returns Value. This function must guarantee that all I/O read and write
|
||||||
operations are serialized.
|
operations are serialized.
|
||||||
|
|
||||||
If 32-bit I/O port operations are not supported, then ASSERT().
|
If 32-bit I/O port operations are not supported, then ASSERT().
|
||||||
|
|
||||||
@param Port The I/O port to write.
|
@param Port The I/O port to write.
|
||||||
@param Value The value to write to the I/O port.
|
@param Value The value to write to the I/O port.
|
||||||
|
|
||||||
@return The value written the I/O port.
|
@return The value written the I/O port.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
IoWrite32 (
|
IoWrite32 (
|
||||||
IN UINTN Port,
|
IN UINTN Port,
|
||||||
IN UINT32 Value
|
IN UINT32 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads a 64-bit I/O port.
|
Reads a 64-bit I/O port.
|
||||||
|
|
||||||
Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
|
Reads the 64-bit I/O port specified by Port. The 64-bit read value is returned.
|
||||||
This function must guarantee that all I/O read and write operations are
|
This function must guarantee that all I/O read and write operations are
|
||||||
serialized.
|
serialized.
|
||||||
|
|
||||||
If 64-bit I/O port operations are not supported, then ASSERT().
|
If 64-bit I/O port operations are not supported, then ASSERT().
|
||||||
If Port is not aligned on a 64-bit boundary, then ASSERT().
|
If Port is not aligned on a 64-bit boundary, then ASSERT().
|
||||||
|
|
||||||
@param Port The I/O port to read.
|
@param Port The I/O port to read.
|
||||||
|
|
||||||
@return The value read.
|
@return The value read.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
IoRead64 (
|
IoRead64 (
|
||||||
IN UINTN Port
|
IN UINTN Port
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes a 64-bit I/O port.
|
Writes a 64-bit I/O port.
|
||||||
|
|
||||||
Writes the 64-bit I/O port specified by Port with the value specified by Value
|
Writes the 64-bit I/O port specified by Port with the value specified by Value
|
||||||
and returns Value. This function must guarantee that all I/O read and write
|
and returns Value. This function must guarantee that all I/O read and write
|
||||||
operations are serialized.
|
operations are serialized.
|
||||||
|
|
||||||
If 64-bit I/O port operations are not supported, then ASSERT().
|
If 64-bit I/O port operations are not supported, then ASSERT().
|
||||||
If Port is not aligned on a 64-bit boundary, then ASSERT().
|
If Port is not aligned on a 64-bit boundary, then ASSERT().
|
||||||
|
|
||||||
@param Port The I/O port to write.
|
@param Port The I/O port to write.
|
||||||
@param Value The value to write to the I/O port.
|
@param Value The value to write to the I/O port.
|
||||||
|
|
||||||
@return The value written the I/O port.
|
@return The value written the I/O port.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
IoWrite64 (
|
IoWrite64 (
|
||||||
IN UINTN Port,
|
IN UINTN Port,
|
||||||
IN UINT64 Value
|
IN UINT64 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads an 8-bit MMIO register.
|
Reads an 8-bit MMIO register.
|
||||||
|
|
||||||
Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
|
Reads the 8-bit MMIO register specified by Address. The 8-bit read value is
|
||||||
returned. This function must guarantee that all MMIO read and write
|
returned. This function must guarantee that all MMIO read and write
|
||||||
operations are serialized.
|
operations are serialized.
|
||||||
|
|
||||||
If 8-bit MMIO register operations are not supported, then ASSERT().
|
If 8-bit MMIO register operations are not supported, then ASSERT().
|
||||||
|
|
||||||
@param Address The MMIO register to read.
|
@param Address The MMIO register to read.
|
||||||
|
|
||||||
@return The value read.
|
@return The value read.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT8
|
UINT8
|
||||||
EFIAPI
|
EFIAPI
|
||||||
MmioRead8 (
|
MmioRead8 (
|
||||||
IN UINTN Address
|
IN UINTN Address
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT8 Value;
|
UINT8 Value;
|
||||||
|
|
||||||
Value = *(volatile UINT8*)Address;
|
Value = *(volatile UINT8*)Address;
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes an 8-bit MMIO register.
|
Writes an 8-bit MMIO register.
|
||||||
|
|
||||||
Writes the 8-bit MMIO register specified by Address with the value specified
|
Writes the 8-bit MMIO register specified by Address with the value specified
|
||||||
by Value and returns Value. This function must guarantee that all MMIO read
|
by Value and returns Value. This function must guarantee that all MMIO read
|
||||||
and write operations are serialized.
|
and write operations are serialized.
|
||||||
|
|
||||||
If 8-bit MMIO register operations are not supported, then ASSERT().
|
If 8-bit MMIO register operations are not supported, then ASSERT().
|
||||||
|
|
||||||
@param Address The MMIO register to write.
|
@param Address The MMIO register to write.
|
||||||
@param Value The value to write to the MMIO register.
|
@param Value The value to write to the MMIO register.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT8
|
UINT8
|
||||||
EFIAPI
|
EFIAPI
|
||||||
MmioWrite8 (
|
MmioWrite8 (
|
||||||
IN UINTN Address,
|
IN UINTN Address,
|
||||||
IN UINT8 Value
|
IN UINT8 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
*(volatile UINT8*)Address = Value;
|
*(volatile UINT8*)Address = Value;
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads a 16-bit MMIO register.
|
Reads a 16-bit MMIO register.
|
||||||
|
|
||||||
Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
|
Reads the 16-bit MMIO register specified by Address. The 16-bit read value is
|
||||||
returned. This function must guarantee that all MMIO read and write
|
returned. This function must guarantee that all MMIO read and write
|
||||||
operations are serialized.
|
operations are serialized.
|
||||||
|
|
||||||
If 16-bit MMIO register operations are not supported, then ASSERT().
|
If 16-bit MMIO register operations are not supported, then ASSERT().
|
||||||
|
|
||||||
@param Address The MMIO register to read.
|
@param Address The MMIO register to read.
|
||||||
|
|
||||||
@return The value read.
|
@return The value read.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT16
|
UINT16
|
||||||
EFIAPI
|
EFIAPI
|
||||||
MmioRead16 (
|
MmioRead16 (
|
||||||
IN UINTN Address
|
IN UINTN Address
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT16 Value;
|
UINT16 Value;
|
||||||
|
|
||||||
ASSERT ((Address & 1) == 0);
|
ASSERT ((Address & 1) == 0);
|
||||||
Value = *(volatile UINT16*)Address;
|
Value = *(volatile UINT16*)Address;
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes a 16-bit MMIO register.
|
Writes a 16-bit MMIO register.
|
||||||
|
|
||||||
Writes the 16-bit MMIO register specified by Address with the value specified
|
Writes the 16-bit MMIO register specified by Address with the value specified
|
||||||
by Value and returns Value. This function must guarantee that all MMIO read
|
by Value and returns Value. This function must guarantee that all MMIO read
|
||||||
and write operations are serialized.
|
and write operations are serialized.
|
||||||
|
|
||||||
If 16-bit MMIO register operations are not supported, then ASSERT().
|
If 16-bit MMIO register operations are not supported, then ASSERT().
|
||||||
|
|
||||||
@param Address The MMIO register to write.
|
@param Address The MMIO register to write.
|
||||||
@param Value The value to write to the MMIO register.
|
@param Value The value to write to the MMIO register.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT16
|
UINT16
|
||||||
EFIAPI
|
EFIAPI
|
||||||
MmioWrite16 (
|
MmioWrite16 (
|
||||||
IN UINTN Address,
|
IN UINTN Address,
|
||||||
IN UINT16 Value
|
IN UINT16 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT ((Address & 1) == 0);
|
ASSERT ((Address & 1) == 0);
|
||||||
*(volatile UINT16*)Address = Value;
|
*(volatile UINT16*)Address = Value;
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads a 32-bit MMIO register.
|
Reads a 32-bit MMIO register.
|
||||||
|
|
||||||
Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
|
Reads the 32-bit MMIO register specified by Address. The 32-bit read value is
|
||||||
returned. This function must guarantee that all MMIO read and write
|
returned. This function must guarantee that all MMIO read and write
|
||||||
operations are serialized.
|
operations are serialized.
|
||||||
|
|
||||||
If 32-bit MMIO register operations are not supported, then ASSERT().
|
If 32-bit MMIO register operations are not supported, then ASSERT().
|
||||||
|
|
||||||
@param Address The MMIO register to read.
|
@param Address The MMIO register to read.
|
||||||
|
|
||||||
@return The value read.
|
@return The value read.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
MmioRead32 (
|
MmioRead32 (
|
||||||
IN UINTN Address
|
IN UINTN Address
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 Value;
|
UINT32 Value;
|
||||||
|
|
||||||
ASSERT ((Address & 3) == 0);
|
ASSERT ((Address & 3) == 0);
|
||||||
Value = *(volatile UINT32*)Address;
|
Value = *(volatile UINT32*)Address;
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes a 32-bit MMIO register.
|
Writes a 32-bit MMIO register.
|
||||||
|
|
||||||
Writes the 32-bit MMIO register specified by Address with the value specified
|
Writes the 32-bit MMIO register specified by Address with the value specified
|
||||||
by Value and returns Value. This function must guarantee that all MMIO read
|
by Value and returns Value. This function must guarantee that all MMIO read
|
||||||
and write operations are serialized.
|
and write operations are serialized.
|
||||||
|
|
||||||
If 32-bit MMIO register operations are not supported, then ASSERT().
|
If 32-bit MMIO register operations are not supported, then ASSERT().
|
||||||
|
|
||||||
@param Address The MMIO register to write.
|
@param Address The MMIO register to write.
|
||||||
@param Value The value to write to the MMIO register.
|
@param Value The value to write to the MMIO register.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
MmioWrite32 (
|
MmioWrite32 (
|
||||||
IN UINTN Address,
|
IN UINTN Address,
|
||||||
IN UINT32 Value
|
IN UINT32 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT ((Address & 3) == 0);
|
ASSERT ((Address & 3) == 0);
|
||||||
*(volatile UINT32*)Address = Value;
|
*(volatile UINT32*)Address = Value;
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads a 64-bit MMIO register.
|
Reads a 64-bit MMIO register.
|
||||||
|
|
||||||
Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
|
Reads the 64-bit MMIO register specified by Address. The 64-bit read value is
|
||||||
returned. This function must guarantee that all MMIO read and write
|
returned. This function must guarantee that all MMIO read and write
|
||||||
operations are serialized.
|
operations are serialized.
|
||||||
|
|
||||||
If 64-bit MMIO register operations are not supported, then ASSERT().
|
If 64-bit MMIO register operations are not supported, then ASSERT().
|
||||||
|
|
||||||
@param Address The MMIO register to read.
|
@param Address The MMIO register to read.
|
||||||
|
|
||||||
@return The value read.
|
@return The value read.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
MmioRead64 (
|
MmioRead64 (
|
||||||
IN UINTN Address
|
IN UINTN Address
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 Value;
|
UINT64 Value;
|
||||||
|
|
||||||
ASSERT ((Address & 7) == 0);
|
ASSERT ((Address & 7) == 0);
|
||||||
Value = *(volatile UINT64*)Address;
|
Value = *(volatile UINT64*)Address;
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes a 64-bit MMIO register.
|
Writes a 64-bit MMIO register.
|
||||||
|
|
||||||
Writes the 64-bit MMIO register specified by Address with the value specified
|
Writes the 64-bit MMIO register specified by Address with the value specified
|
||||||
by Value and returns Value. This function must guarantee that all MMIO read
|
by Value and returns Value. This function must guarantee that all MMIO read
|
||||||
and write operations are serialized.
|
and write operations are serialized.
|
||||||
|
|
||||||
If 64-bit MMIO register operations are not supported, then ASSERT().
|
If 64-bit MMIO register operations are not supported, then ASSERT().
|
||||||
|
|
||||||
@param Address The MMIO register to write.
|
@param Address The MMIO register to write.
|
||||||
@param Value The value to write to the MMIO register.
|
@param Value The value to write to the MMIO register.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
MmioWrite64 (
|
MmioWrite64 (
|
||||||
IN UINTN Address,
|
IN UINTN Address,
|
||||||
IN UINT64 Value
|
IN UINT64 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT ((Address & 7) == 0);
|
ASSERT ((Address & 7) == 0);
|
||||||
*(volatile UINT64*)Address = Value;
|
*(volatile UINT64*)Address = Value;
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,36 +1,36 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# CpuBreakpoint() for ARM
|
# CpuBreakpoint() for ARM
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
# Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
# Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
# Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.align 2
|
.align 2
|
||||||
.globl ASM_PFX(CpuBreakpoint)
|
.globl ASM_PFX(CpuBreakpoint)
|
||||||
|
|
||||||
#/**
|
#/**
|
||||||
# Generates a breakpoint on the CPU.
|
# Generates a breakpoint on the CPU.
|
||||||
#
|
#
|
||||||
# Generates a breakpoint on the CPU. The breakpoint must be implemented such
|
# Generates a breakpoint on the CPU. The breakpoint must be implemented such
|
||||||
# that code can resume normal execution after the breakpoint.
|
# that code can resume normal execution after the breakpoint.
|
||||||
#
|
#
|
||||||
#**/
|
#**/
|
||||||
#VOID
|
#VOID
|
||||||
#EFIAPI
|
#EFIAPI
|
||||||
#CpuBreakpoint (
|
#CpuBreakpoint (
|
||||||
# VOID
|
# VOID
|
||||||
# );
|
# );
|
||||||
#
|
#
|
||||||
ASM_PFX(CpuBreakpoint):
|
ASM_PFX(CpuBreakpoint):
|
||||||
swi 0xdbdbdb
|
swi 0xdbdbdb
|
||||||
bx lr
|
bx lr
|
||||||
|
@ -1,38 +1,38 @@
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
; CpuBreakpoint() for ARM
|
; CpuBreakpoint() for ARM
|
||||||
;
|
;
|
||||||
; Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
; Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
; Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
; Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
; All rights reserved. This program and the accompanying materials
|
; All rights reserved. This program and the accompanying materials
|
||||||
; are licensed and made available under the terms and conditions of the BSD License
|
; 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
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
; http://opensource.org/licenses/bsd-license.php
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
;
|
;
|
||||||
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
;
|
;
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
EXPORT CpuBreakpoint
|
EXPORT CpuBreakpoint
|
||||||
|
|
||||||
AREA Cpu_Breakpoint, CODE, READONLY
|
AREA Cpu_Breakpoint, CODE, READONLY
|
||||||
|
|
||||||
;/**
|
;/**
|
||||||
; Generates a breakpoint on the CPU.
|
; Generates a breakpoint on the CPU.
|
||||||
;
|
;
|
||||||
; Generates a breakpoint on the CPU. The breakpoint must be implemented such
|
; Generates a breakpoint on the CPU. The breakpoint must be implemented such
|
||||||
; that code can resume normal execution after the breakpoint.
|
; that code can resume normal execution after the breakpoint.
|
||||||
;
|
;
|
||||||
;**/
|
;**/
|
||||||
;VOID
|
;VOID
|
||||||
;EFIAPI
|
;EFIAPI
|
||||||
;CpuBreakpoint (
|
;CpuBreakpoint (
|
||||||
; VOID
|
; VOID
|
||||||
; );
|
; );
|
||||||
;
|
;
|
||||||
CpuBreakpoint
|
CpuBreakpoint
|
||||||
swi 0xdbdbdb
|
swi 0xdbdbdb
|
||||||
bx lr
|
bx lr
|
||||||
|
|
||||||
END
|
END
|
||||||
|
@ -1,41 +1,41 @@
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
; CpuPause() for ARM
|
; CpuPause() for ARM
|
||||||
;
|
;
|
||||||
; Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
; Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
; Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
; Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
; All rights reserved. This program and the accompanying materials
|
; All rights reserved. This program and the accompanying materials
|
||||||
; are licensed and made available under the terms and conditions of the BSD License
|
; 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
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
; http://opensource.org/licenses/bsd-license.php
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
;
|
;
|
||||||
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
;
|
;
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
EXPORT CpuPause
|
EXPORT CpuPause
|
||||||
AREA cpu_pause, CODE, READONLY
|
AREA cpu_pause, CODE, READONLY
|
||||||
|
|
||||||
;/**
|
;/**
|
||||||
; Requests CPU to pause for a short period of time.
|
; Requests CPU to pause for a short period of time.
|
||||||
;
|
;
|
||||||
; Requests CPU to pause for a short period of time. Typically used in MP
|
; Requests CPU to pause for a short period of time. Typically used in MP
|
||||||
; systems to prevent memory starvation while waiting for a spin lock.
|
; systems to prevent memory starvation while waiting for a spin lock.
|
||||||
;
|
;
|
||||||
;**/
|
;**/
|
||||||
;VOID
|
;VOID
|
||||||
;EFIAPI
|
;EFIAPI
|
||||||
;CpuPause (
|
;CpuPause (
|
||||||
; VOID
|
; VOID
|
||||||
; );
|
; );
|
||||||
;
|
;
|
||||||
CpuPause
|
CpuPause
|
||||||
NOP
|
NOP
|
||||||
NOP
|
NOP
|
||||||
NOP
|
NOP
|
||||||
NOP
|
NOP
|
||||||
NOP
|
NOP
|
||||||
BX LR
|
BX LR
|
||||||
|
|
||||||
END
|
END
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# DisableInterrupts() for ARM
|
# DisableInterrupts() for ARM
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
# Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
# Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
# Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.p2align 2
|
.p2align 2
|
||||||
.globl ASM_PFX(DisableInterrupts)
|
.globl ASM_PFX(DisableInterrupts)
|
||||||
|
|
||||||
#/**
|
#/**
|
||||||
# Disables CPU interrupts.
|
# Disables CPU interrupts.
|
||||||
#
|
#
|
||||||
#**/
|
#**/
|
||||||
#VOID
|
#VOID
|
||||||
#EFIAPI
|
#EFIAPI
|
||||||
#DisableInterrupts (
|
#DisableInterrupts (
|
||||||
# VOID
|
# VOID
|
||||||
# );
|
# );
|
||||||
#
|
#
|
||||||
ASM_PFX(DisableInterrupts):
|
ASM_PFX(DisableInterrupts):
|
||||||
mrs R0,CPSR
|
mrs R0,CPSR
|
||||||
orr R0,R0,#0x80 @Disable IRQ interrupts
|
orr R0,R0,#0x80 @Disable IRQ interrupts
|
||||||
msr CPSR_c,R0
|
msr CPSR_c,R0
|
||||||
bx LR
|
bx LR
|
||||||
|
@ -1,37 +1,37 @@
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
; DisableInterrupts() for ARM
|
; DisableInterrupts() for ARM
|
||||||
;
|
;
|
||||||
; Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
; Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
; Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
; Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
; All rights reserved. This program and the accompanying materials
|
; All rights reserved. This program and the accompanying materials
|
||||||
; are licensed and made available under the terms and conditions of the BSD License
|
; 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
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
; http://opensource.org/licenses/bsd-license.php
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
;
|
;
|
||||||
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
;
|
;
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
EXPORT DisableInterrupts
|
EXPORT DisableInterrupts
|
||||||
|
|
||||||
AREA Interrupt_disable, CODE, READONLY
|
AREA Interrupt_disable, CODE, READONLY
|
||||||
|
|
||||||
;/**
|
;/**
|
||||||
; Disables CPU interrupts.
|
; Disables CPU interrupts.
|
||||||
;
|
;
|
||||||
;**/
|
;**/
|
||||||
;VOID
|
;VOID
|
||||||
;EFIAPI
|
;EFIAPI
|
||||||
;DisableInterrupts (
|
;DisableInterrupts (
|
||||||
; VOID
|
; VOID
|
||||||
; );
|
; );
|
||||||
;
|
;
|
||||||
DisableInterrupts
|
DisableInterrupts
|
||||||
MRS R0,CPSR
|
MRS R0,CPSR
|
||||||
ORR R0,R0,#0x80 ;Disable IRQ interrupts
|
ORR R0,R0,#0x80 ;Disable IRQ interrupts
|
||||||
MSR CPSR_c,R0
|
MSR CPSR_c,R0
|
||||||
BX LR
|
BX LR
|
||||||
|
|
||||||
END
|
END
|
||||||
|
@ -1,36 +1,36 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# EnableInterrupts() for ARM
|
# EnableInterrupts() for ARM
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
# Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
# Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
# Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.p2align 2
|
.p2align 2
|
||||||
.globl ASM_PFX(EnableInterrupts)
|
.globl ASM_PFX(EnableInterrupts)
|
||||||
|
|
||||||
|
|
||||||
#/**
|
#/**
|
||||||
# Enables CPU interrupts.
|
# Enables CPU interrupts.
|
||||||
#
|
#
|
||||||
#**/
|
#**/
|
||||||
#VOID
|
#VOID
|
||||||
#EFIAPI
|
#EFIAPI
|
||||||
#EnableInterrupts (
|
#EnableInterrupts (
|
||||||
# VOID
|
# VOID
|
||||||
# );
|
# );
|
||||||
#
|
#
|
||||||
ASM_PFX(EnableInterrupts):
|
ASM_PFX(EnableInterrupts):
|
||||||
mrs R0,CPSR
|
mrs R0,CPSR
|
||||||
bic R0,R0,#0x80 @Enable IRQ interrupts
|
bic R0,R0,#0x80 @Enable IRQ interrupts
|
||||||
msr CPSR_c,R0
|
msr CPSR_c,R0
|
||||||
bx LR
|
bx LR
|
||||||
|
@ -1,37 +1,37 @@
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
; EnableInterrupts() for ARM
|
; EnableInterrupts() for ARM
|
||||||
;
|
;
|
||||||
; Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
; Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
; Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
; Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
; All rights reserved. This program and the accompanying materials
|
; All rights reserved. This program and the accompanying materials
|
||||||
; are licensed and made available under the terms and conditions of the BSD License
|
; 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
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
; http://opensource.org/licenses/bsd-license.php
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
;
|
;
|
||||||
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
;
|
;
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
EXPORT EnableInterrupts
|
EXPORT EnableInterrupts
|
||||||
|
|
||||||
AREA Interrupt_enable, CODE, READONLY
|
AREA Interrupt_enable, CODE, READONLY
|
||||||
|
|
||||||
;/**
|
;/**
|
||||||
; Enables CPU interrupts.
|
; Enables CPU interrupts.
|
||||||
;
|
;
|
||||||
;**/
|
;**/
|
||||||
;VOID
|
;VOID
|
||||||
;EFIAPI
|
;EFIAPI
|
||||||
;EnableInterrupts (
|
;EnableInterrupts (
|
||||||
; VOID
|
; VOID
|
||||||
; );
|
; );
|
||||||
;
|
;
|
||||||
EnableInterrupts
|
EnableInterrupts
|
||||||
MRS R0,CPSR
|
MRS R0,CPSR
|
||||||
BIC R0,R0,#0x80 ;Enable IRQ interrupts
|
BIC R0,R0,#0x80 ;Enable IRQ interrupts
|
||||||
MSR CPSR_c,R0
|
MSR CPSR_c,R0
|
||||||
BX LR
|
BX LR
|
||||||
|
|
||||||
END
|
END
|
||||||
|
@ -1,61 +1,61 @@
|
|||||||
/** @file
|
/** @file
|
||||||
GCC inline implementation of BaseLib processor specific functions.
|
GCC inline implementation of BaseLib processor specific functions.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2007, Intel Corporation<BR>
|
Copyright (c) 2006 - 2007, Intel Corporation<BR>
|
||||||
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "BaseLibInternals.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Requests CPU to pause for a short period of time.
|
Requests CPU to pause for a short period of time.
|
||||||
|
|
||||||
Requests CPU to pause for a short period of time. Typically used in MP
|
Requests CPU to pause for a short period of time. Typically used in MP
|
||||||
systems to prevent memory starvation while waiting for a spin lock.
|
systems to prevent memory starvation while waiting for a spin lock.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
CpuPause (
|
CpuPause (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"nop\n\t"
|
"nop\n\t"
|
||||||
"nop\n\t"
|
"nop\n\t"
|
||||||
"nop\n\t"
|
"nop\n\t"
|
||||||
"nop\n\t"
|
"nop\n\t"
|
||||||
"nop\n\t"
|
"nop\n\t"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSwitchStackAsm (
|
InternalSwitchStackAsm (
|
||||||
SWITCH_STACK_ENTRY_POINT EntryPoint,
|
SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||||
VOID *Context,
|
VOID *Context,
|
||||||
VOID *Context2,
|
VOID *Context2,
|
||||||
VOID *NewStack
|
VOID *NewStack
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"mov lr, %0\n\t"
|
"mov lr, %0\n\t"
|
||||||
"mov sp, %3\n\t"
|
"mov sp, %3\n\t"
|
||||||
"mov %r0, %1\n\t"
|
"mov %r0, %1\n\t"
|
||||||
"mov %r1, %2\n\t"
|
"mov %r1, %2\n\t"
|
||||||
"bx lr\n\t"
|
"bx lr\n\t"
|
||||||
: /* no output operand */
|
: /* no output operand */
|
||||||
: "r" (EntryPoint),
|
: "r" (EntryPoint),
|
||||||
"r" (Context),
|
"r" (Context),
|
||||||
"r" (Context2),
|
"r" (Context2),
|
||||||
"r" (NewStack)
|
"r" (NewStack)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,43 +1,43 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# GetInterruptState() function for ARM
|
# GetInterruptState() function for ARM
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
# Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
# Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
# Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.p2align 2
|
.p2align 2
|
||||||
.globl _GetInterruptState
|
.globl _GetInterruptState
|
||||||
|
|
||||||
#/**
|
#/**
|
||||||
# Retrieves the current CPU interrupt state.
|
# Retrieves the current CPU interrupt state.
|
||||||
#
|
#
|
||||||
# Returns TRUE is interrupts are currently enabled. Otherwise
|
# Returns TRUE is interrupts are currently enabled. Otherwise
|
||||||
# returns FALSE.
|
# returns FALSE.
|
||||||
#
|
#
|
||||||
# @retval TRUE CPU interrupts are enabled.
|
# @retval TRUE CPU interrupts are enabled.
|
||||||
# @retval FALSE CPU interrupts are disabled.
|
# @retval FALSE CPU interrupts are disabled.
|
||||||
#
|
#
|
||||||
#**/
|
#**/
|
||||||
#
|
#
|
||||||
#BOOLEAN
|
#BOOLEAN
|
||||||
#EFIAPI
|
#EFIAPI
|
||||||
#GetInterruptState (
|
#GetInterruptState (
|
||||||
# VOID
|
# VOID
|
||||||
# );
|
# );
|
||||||
#
|
#
|
||||||
_GetInterruptState:
|
_GetInterruptState:
|
||||||
mrs R0, CPSR
|
mrs R0, CPSR
|
||||||
tst R0, #0x80 @Check if IRQ is enabled.
|
tst R0, #0x80 @Check if IRQ is enabled.
|
||||||
moveq R0, #1
|
moveq R0, #1
|
||||||
movne R0, #0
|
movne R0, #0
|
||||||
bx LR
|
bx LR
|
||||||
|
@ -1,45 +1,45 @@
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
; GetInterruptState() function for ARM
|
; GetInterruptState() function for ARM
|
||||||
;
|
;
|
||||||
; Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
; Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
; Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
; Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
; All rights reserved. This program and the accompanying materials
|
; All rights reserved. This program and the accompanying materials
|
||||||
; are licensed and made available under the terms and conditions of the BSD License
|
; 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
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
; http://opensource.org/licenses/bsd-license.php
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
;
|
;
|
||||||
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
;
|
;
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
EXPORT GetInterruptState
|
EXPORT GetInterruptState
|
||||||
|
|
||||||
AREA Interrupt_enable, CODE, READONLY
|
AREA Interrupt_enable, CODE, READONLY
|
||||||
|
|
||||||
;/**
|
;/**
|
||||||
; Retrieves the current CPU interrupt state.
|
; Retrieves the current CPU interrupt state.
|
||||||
;
|
;
|
||||||
; Returns TRUE is interrupts are currently enabled. Otherwise
|
; Returns TRUE is interrupts are currently enabled. Otherwise
|
||||||
; returns FALSE.
|
; returns FALSE.
|
||||||
;
|
;
|
||||||
; @retval TRUE CPU interrupts are enabled.
|
; @retval TRUE CPU interrupts are enabled.
|
||||||
; @retval FALSE CPU interrupts are disabled.
|
; @retval FALSE CPU interrupts are disabled.
|
||||||
;
|
;
|
||||||
;**/
|
;**/
|
||||||
;
|
;
|
||||||
;BOOLEAN
|
;BOOLEAN
|
||||||
;EFIAPI
|
;EFIAPI
|
||||||
;GetInterruptState (
|
;GetInterruptState (
|
||||||
; VOID
|
; VOID
|
||||||
; );
|
; );
|
||||||
;
|
;
|
||||||
GetInterruptState
|
GetInterruptState
|
||||||
MRS R0, CPSR
|
MRS R0, CPSR
|
||||||
TST R0, #0x80 ;Check if IRQ is enabled.
|
TST R0, #0x80 ;Check if IRQ is enabled.
|
||||||
MOVEQ R0, #1
|
MOVEQ R0, #1
|
||||||
MOVNE R0, #0
|
MOVNE R0, #0
|
||||||
BX LR
|
BX LR
|
||||||
|
|
||||||
END
|
END
|
||||||
|
@ -1,59 +1,59 @@
|
|||||||
/** @file
|
/** @file
|
||||||
SwitchStack() function for ARM.
|
SwitchStack() function for ARM.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2007, Intel Corporation<BR>
|
Copyright (c) 2006 - 2007, Intel Corporation<BR>
|
||||||
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "BaseLibInternals.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Transfers control to a function starting with a new stack.
|
Transfers control to a function starting with a new stack.
|
||||||
|
|
||||||
Transfers control to the function specified by EntryPoint using the
|
Transfers control to the function specified by EntryPoint using the
|
||||||
new stack specified by NewStack and passing in the parameters specified
|
new stack specified by NewStack and passing in the parameters specified
|
||||||
by Context1 and Context2. Context1 and Context2 are optional and may
|
by Context1 and Context2. Context1 and Context2 are optional and may
|
||||||
be NULL. The function EntryPoint must never return.
|
be NULL. The function EntryPoint must never return.
|
||||||
Marker will be ignored on IA-32, x64, and EBC.
|
Marker will be ignored on IA-32, x64, and EBC.
|
||||||
IPF CPUs expect one additional parameter of type VOID * that specifies
|
IPF CPUs expect one additional parameter of type VOID * that specifies
|
||||||
the new backing store pointer.
|
the new backing store pointer.
|
||||||
|
|
||||||
If EntryPoint is NULL, then ASSERT().
|
If EntryPoint is NULL, then ASSERT().
|
||||||
If NewStack is NULL, then ASSERT().
|
If NewStack is NULL, then ASSERT().
|
||||||
|
|
||||||
@param EntryPoint A pointer to function to call with the new stack.
|
@param EntryPoint A pointer to function to call with the new stack.
|
||||||
@param Context1 A pointer to the context to pass into the EntryPoint
|
@param Context1 A pointer to the context to pass into the EntryPoint
|
||||||
function.
|
function.
|
||||||
@param Context2 A pointer to the context to pass into the EntryPoint
|
@param Context2 A pointer to the context to pass into the EntryPoint
|
||||||
function.
|
function.
|
||||||
@param NewStack A pointer to the new stack to use for the EntryPoint
|
@param NewStack A pointer to the new stack to use for the EntryPoint
|
||||||
function.
|
function.
|
||||||
@param Marker VA_LIST marker for the variable argument list.
|
@param Marker VA_LIST marker for the variable argument list.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSwitchStack (
|
InternalSwitchStack (
|
||||||
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||||
IN VOID *Context1, OPTIONAL
|
IN VOID *Context1, OPTIONAL
|
||||||
IN VOID *Context2, OPTIONAL
|
IN VOID *Context2, OPTIONAL
|
||||||
IN VOID *NewStack,
|
IN VOID *NewStack,
|
||||||
IN VA_LIST Marker
|
IN VA_LIST Marker
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Stack should be aligned with CPU_STACK_ALIGNMENT
|
// Stack should be aligned with CPU_STACK_ALIGNMENT
|
||||||
//
|
//
|
||||||
ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
|
ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
|
||||||
|
|
||||||
InternalSwitchStackAsm (EntryPoint, Context1, Context2, NewStack);
|
InternalSwitchStackAsm (EntryPoint, Context1, Context2, NewStack);
|
||||||
}
|
}
|
||||||
|
@ -1,70 +1,70 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
# Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
# Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
# Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# 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
|
# which accompanies this distribution. The full text of the license may be found at
|
||||||
# http://opensource.org/licenses/bsd-license.php
|
# http://opensource.org/licenses/bsd-license.php
|
||||||
#
|
#
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
.text
|
.text
|
||||||
.p2align 2
|
.p2align 2
|
||||||
|
|
||||||
.globl ASM_PFX(SetJump)
|
.globl ASM_PFX(SetJump)
|
||||||
.globl ASM_PFX(InternalLongJump)
|
.globl ASM_PFX(InternalLongJump)
|
||||||
|
|
||||||
#/**
|
#/**
|
||||||
# Saves the current CPU context that can be restored with a call to LongJump() and returns 0.#
|
# Saves the current CPU context that can be restored with a call to LongJump() and returns 0.#
|
||||||
#
|
#
|
||||||
# Saves the current CPU context in the buffer specified by JumpBuffer and returns 0. The initial
|
# Saves the current CPU context in the buffer specified by JumpBuffer and returns 0. The initial
|
||||||
# call to SetJump() must always return 0. Subsequent calls to LongJump() cause a non-zero
|
# call to SetJump() must always return 0. Subsequent calls to LongJump() cause a non-zero
|
||||||
# value to be returned by SetJump().
|
# value to be returned by SetJump().
|
||||||
#
|
#
|
||||||
# If JumpBuffer is NULL, then ASSERT().
|
# If JumpBuffer is NULL, then ASSERT().
|
||||||
# For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, 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.
|
# @param JumpBuffer A pointer to CPU context buffer.
|
||||||
#
|
#
|
||||||
#**/
|
#**/
|
||||||
#
|
#
|
||||||
#UINTN
|
#UINTN
|
||||||
#EFIAPI
|
#EFIAPI
|
||||||
#SetJump (
|
#SetJump (
|
||||||
# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer // R0
|
# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer // R0
|
||||||
# );
|
# );
|
||||||
#
|
#
|
||||||
ASM_PFX(SetJump):
|
ASM_PFX(SetJump):
|
||||||
mov r3, r13
|
mov r3, r13
|
||||||
stmia r0, {r3-r12,r14}
|
stmia r0, {r3-r12,r14}
|
||||||
eor r0, r0, r0
|
eor r0, r0, r0
|
||||||
bx lr
|
bx lr
|
||||||
|
|
||||||
#/**
|
#/**
|
||||||
# Restores the CPU context that was saved with SetJump().#
|
# Restores the CPU context that was saved with SetJump().#
|
||||||
#
|
#
|
||||||
# Restores the CPU context from the buffer specified by JumpBuffer.
|
# Restores the CPU context from the buffer specified by JumpBuffer.
|
||||||
# This function never returns to the caller.
|
# This function never returns to the caller.
|
||||||
# Instead is resumes execution based on the state of JumpBuffer.
|
# Instead is resumes execution based on the state of JumpBuffer.
|
||||||
#
|
#
|
||||||
# @param JumpBuffer A pointer to CPU context buffer.
|
# @param JumpBuffer A pointer to CPU context buffer.
|
||||||
# @param Value The value to return when the SetJump() context is restored.
|
# @param Value The value to return when the SetJump() context is restored.
|
||||||
#
|
#
|
||||||
#**/
|
#**/
|
||||||
#VOID
|
#VOID
|
||||||
#EFIAPI
|
#EFIAPI
|
||||||
#InternalLongJump (
|
#InternalLongJump (
|
||||||
# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, // R0
|
# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, // R0
|
||||||
# IN UINTN Value // R1
|
# IN UINTN Value // R1
|
||||||
# );
|
# );
|
||||||
#
|
#
|
||||||
ASM_PFX(InternalLongJump):
|
ASM_PFX(InternalLongJump):
|
||||||
ldmia r0, {r3-r12,r14}
|
ldmia r0, {r3-r12,r14}
|
||||||
mov r13, r3
|
mov r13, r3
|
||||||
mov r0, r1
|
mov r0, r1
|
||||||
bx lr
|
bx lr
|
||||||
|
|
||||||
ASM_FUNCTION_REMOVE_IF_UNREFERENCED()
|
ASM_FUNCTION_REMOVE_IF_UNREFERENCED()
|
||||||
|
@ -1,70 +1,70 @@
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
; Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
; Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
; Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
; Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
; All rights reserved. This program and the accompanying materials
|
; All rights reserved. This program and the accompanying materials
|
||||||
; are licensed and made available under the terms and conditions of the BSD License
|
; 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
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
; http://opensource.org/licenses/bsd-license.php
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
;
|
;
|
||||||
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
;
|
;
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
EXPORT SetJump
|
EXPORT SetJump
|
||||||
EXPORT InternalLongJump
|
EXPORT InternalLongJump
|
||||||
|
|
||||||
AREA BaseLib, CODE, READONLY
|
AREA BaseLib, CODE, READONLY
|
||||||
|
|
||||||
;/**
|
;/**
|
||||||
; Saves the current CPU context that can be restored with a call to LongJump() and returns 0.;
|
; Saves the current CPU context that can be restored with a call to LongJump() and returns 0.;
|
||||||
;
|
;
|
||||||
; Saves the current CPU context in the buffer specified by JumpBuffer and returns 0. The initial
|
; Saves the current CPU context in the buffer specified by JumpBuffer and returns 0. The initial
|
||||||
; call to SetJump() must always return 0. Subsequent calls to LongJump() cause a non-zero
|
; call to SetJump() must always return 0. Subsequent calls to LongJump() cause a non-zero
|
||||||
; value to be returned by SetJump().
|
; value to be returned by SetJump().
|
||||||
;
|
;
|
||||||
; If JumpBuffer is NULL, then ASSERT().
|
; If JumpBuffer is NULL, then ASSERT().
|
||||||
; For IPF CPUs, if JumpBuffer is not aligned on a 16-byte boundary, 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.
|
; @param JumpBuffer A pointer to CPU context buffer.
|
||||||
;
|
;
|
||||||
;**/
|
;**/
|
||||||
;
|
;
|
||||||
;UINTN
|
;UINTN
|
||||||
;EFIAPI
|
;EFIAPI
|
||||||
;SetJump (
|
;SetJump (
|
||||||
; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer // R0
|
; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer // R0
|
||||||
; )
|
; )
|
||||||
;
|
;
|
||||||
SetJump
|
SetJump
|
||||||
MOV R3, R13
|
MOV R3, R13
|
||||||
STM R0, {R3-R12,R14}
|
STM R0, {R3-R12,R14}
|
||||||
EOR R0, R0
|
EOR R0, R0
|
||||||
BX LR
|
BX LR
|
||||||
|
|
||||||
;/**
|
;/**
|
||||||
; Restores the CPU context that was saved with SetJump().;
|
; Restores the CPU context that was saved with SetJump().;
|
||||||
;
|
;
|
||||||
; Restores the CPU context from the buffer specified by JumpBuffer.
|
; Restores the CPU context from the buffer specified by JumpBuffer.
|
||||||
; This function never returns to the caller.
|
; This function never returns to the caller.
|
||||||
; Instead is resumes execution based on the state of JumpBuffer.
|
; Instead is resumes execution based on the state of JumpBuffer.
|
||||||
;
|
;
|
||||||
; @param JumpBuffer A pointer to CPU context buffer.
|
; @param JumpBuffer A pointer to CPU context buffer.
|
||||||
; @param Value The value to return when the SetJump() context is restored.
|
; @param Value The value to return when the SetJump() context is restored.
|
||||||
;
|
;
|
||||||
;**/
|
;**/
|
||||||
;VOID
|
;VOID
|
||||||
;EFIAPI
|
;EFIAPI
|
||||||
;InternalLongJump (
|
;InternalLongJump (
|
||||||
; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, // R0
|
; IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer, // R0
|
||||||
; IN UINTN Value // R1
|
; IN UINTN Value // R1
|
||||||
; );
|
; );
|
||||||
;
|
;
|
||||||
InternalLongJump
|
InternalLongJump
|
||||||
LDM R0, {R3-R12,R14}
|
LDM R0, {R3-R12,R14}
|
||||||
MOV R13, R3
|
MOV R13, R3
|
||||||
MOV R0, R1
|
MOV R0, R1
|
||||||
BX LR
|
BX LR
|
||||||
|
|
||||||
END
|
END
|
||||||
|
@ -1,45 +1,45 @@
|
|||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
;
|
;
|
||||||
; Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
; Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
; Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
; Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
; All rights reserved. This program and the accompanying materials
|
; All rights reserved. This program and the accompanying materials
|
||||||
; are licensed and made available under the terms and conditions of the BSD License
|
; 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
|
; which accompanies this distribution. The full text of the license may be found at
|
||||||
; http://opensource.org/licenses/bsd-license.php
|
; http://opensource.org/licenses/bsd-license.php
|
||||||
;
|
;
|
||||||
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
;
|
;
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
EXPORT InternalSwitchStackAsm
|
EXPORT InternalSwitchStackAsm
|
||||||
|
|
||||||
AREA Switch_Stack, CODE, READONLY
|
AREA Switch_Stack, CODE, READONLY
|
||||||
|
|
||||||
;/**
|
;/**
|
||||||
; This allows the caller to switch the stack and goes to the new entry point
|
; This allows the caller to switch the stack and goes to the new entry point
|
||||||
;
|
;
|
||||||
; @param EntryPoint Pointer to the location to enter
|
; @param EntryPoint Pointer to the location to enter
|
||||||
; @param Context Parameter to pass in
|
; @param Context Parameter to pass in
|
||||||
; @param Context2 Parameter2 to pass in
|
; @param Context2 Parameter2 to pass in
|
||||||
; @param NewStack New Location of the stack
|
; @param NewStack New Location of the stack
|
||||||
;
|
;
|
||||||
; @return Nothing. Goes to the Entry Point passing in the new parameters
|
; @return Nothing. Goes to the Entry Point passing in the new parameters
|
||||||
;
|
;
|
||||||
;**/
|
;**/
|
||||||
;VOID
|
;VOID
|
||||||
;EFIAPI
|
;EFIAPI
|
||||||
;InternalSwitchStackAsm (
|
;InternalSwitchStackAsm (
|
||||||
; SWITCH_STACK_ENTRY_POINT EntryPoint,
|
; SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||||
; VOID *Context,
|
; VOID *Context,
|
||||||
; VOID *Context2,
|
; VOID *Context2,
|
||||||
; VOID *NewStack
|
; VOID *NewStack
|
||||||
; );
|
; );
|
||||||
;
|
;
|
||||||
InternalSwitchStackAsm
|
InternalSwitchStackAsm
|
||||||
MOV LR, R0
|
MOV LR, R0
|
||||||
MOV SP, R3
|
MOV SP, R3
|
||||||
MOV R0, R1
|
MOV R0, R1
|
||||||
MOV R1, R2
|
MOV R1, R2
|
||||||
BX LR
|
BX LR
|
||||||
END
|
END
|
||||||
|
@ -1,252 +1,252 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Unaligned access functions of BaseLib for ARM.
|
Unaligned access functions of BaseLib for ARM.
|
||||||
|
|
||||||
volatile was added to work around optimization issues.
|
volatile was added to work around optimization issues.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "BaseLibInternals.h"
|
#include "BaseLibInternals.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads a 16-bit value from memory that may be unaligned.
|
Reads a 16-bit value from memory that may be unaligned.
|
||||||
|
|
||||||
This function returns the 16-bit value pointed to by Buffer. The function
|
This function returns the 16-bit value pointed to by Buffer. The function
|
||||||
guarantees that the read operation does not produce an alignment fault.
|
guarantees that the read operation does not produce an alignment fault.
|
||||||
|
|
||||||
If the Buffer is NULL, then ASSERT().
|
If the Buffer is NULL, then ASSERT().
|
||||||
|
|
||||||
@param Buffer Pointer to a 16-bit value that may be unaligned.
|
@param Buffer Pointer to a 16-bit value that may be unaligned.
|
||||||
|
|
||||||
@return The 16-bit value read from Buffer.
|
@return The 16-bit value read from Buffer.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT16
|
UINT16
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ReadUnaligned16 (
|
ReadUnaligned16 (
|
||||||
IN CONST UINT16 *Buffer
|
IN CONST UINT16 *Buffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
volatile UINT8 LowerByte;
|
volatile UINT8 LowerByte;
|
||||||
volatile UINT8 HigherByte;
|
volatile UINT8 HigherByte;
|
||||||
|
|
||||||
ASSERT (Buffer != NULL);
|
ASSERT (Buffer != NULL);
|
||||||
|
|
||||||
LowerByte = ((UINT8*)Buffer)[0];
|
LowerByte = ((UINT8*)Buffer)[0];
|
||||||
HigherByte = ((UINT8*)Buffer)[1];
|
HigherByte = ((UINT8*)Buffer)[1];
|
||||||
|
|
||||||
return (UINT16)(LowerByte | (HigherByte << 8));
|
return (UINT16)(LowerByte | (HigherByte << 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes a 16-bit value to memory that may be unaligned.
|
Writes a 16-bit value to memory that may be unaligned.
|
||||||
|
|
||||||
This function writes the 16-bit value specified by Value to Buffer. Value is
|
This function writes the 16-bit value specified by Value to Buffer. Value is
|
||||||
returned. The function guarantees that the write operation does not produce
|
returned. The function guarantees that the write operation does not produce
|
||||||
an alignment fault.
|
an alignment fault.
|
||||||
|
|
||||||
If the Buffer is NULL, then ASSERT().
|
If the Buffer is NULL, then ASSERT().
|
||||||
|
|
||||||
@param Buffer Pointer to a 16-bit value that may be unaligned.
|
@param Buffer Pointer to a 16-bit value that may be unaligned.
|
||||||
@param Value 16-bit value to write to Buffer.
|
@param Value 16-bit value to write to Buffer.
|
||||||
|
|
||||||
@return The 16-bit value to write to Buffer.
|
@return The 16-bit value to write to Buffer.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT16
|
UINT16
|
||||||
EFIAPI
|
EFIAPI
|
||||||
WriteUnaligned16 (
|
WriteUnaligned16 (
|
||||||
OUT UINT16 *Buffer,
|
OUT UINT16 *Buffer,
|
||||||
IN UINT16 Value
|
IN UINT16 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (Buffer != NULL);
|
ASSERT (Buffer != NULL);
|
||||||
|
|
||||||
((volatile UINT8*)Buffer)[0] = (UINT8)Value;
|
((volatile UINT8*)Buffer)[0] = (UINT8)Value;
|
||||||
((volatile UINT8*)Buffer)[1] = (UINT8)(Value >> 8);
|
((volatile UINT8*)Buffer)[1] = (UINT8)(Value >> 8);
|
||||||
|
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads a 24-bit value from memory that may be unaligned.
|
Reads a 24-bit value from memory that may be unaligned.
|
||||||
|
|
||||||
This function returns the 24-bit value pointed to by Buffer. The function
|
This function returns the 24-bit value pointed to by Buffer. The function
|
||||||
guarantees that the read operation does not produce an alignment fault.
|
guarantees that the read operation does not produce an alignment fault.
|
||||||
|
|
||||||
If the Buffer is NULL, then ASSERT().
|
If the Buffer is NULL, then ASSERT().
|
||||||
|
|
||||||
@param Buffer Pointer to a 24-bit value that may be unaligned.
|
@param Buffer Pointer to a 24-bit value that may be unaligned.
|
||||||
|
|
||||||
@return The 24-bit value read from Buffer.
|
@return The 24-bit value read from Buffer.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ReadUnaligned24 (
|
ReadUnaligned24 (
|
||||||
IN CONST UINT32 *Buffer
|
IN CONST UINT32 *Buffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (Buffer != NULL);
|
ASSERT (Buffer != NULL);
|
||||||
|
|
||||||
return (UINT32)(
|
return (UINT32)(
|
||||||
ReadUnaligned16 ((UINT16*)Buffer) |
|
ReadUnaligned16 ((UINT16*)Buffer) |
|
||||||
(((UINT8*)Buffer)[2] << 16)
|
(((UINT8*)Buffer)[2] << 16)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes a 24-bit value to memory that may be unaligned.
|
Writes a 24-bit value to memory that may be unaligned.
|
||||||
|
|
||||||
This function writes the 24-bit value specified by Value to Buffer. Value is
|
This function writes the 24-bit value specified by Value to Buffer. Value is
|
||||||
returned. The function guarantees that the write operation does not produce
|
returned. The function guarantees that the write operation does not produce
|
||||||
an alignment fault.
|
an alignment fault.
|
||||||
|
|
||||||
If the Buffer is NULL, then ASSERT().
|
If the Buffer is NULL, then ASSERT().
|
||||||
|
|
||||||
@param Buffer Pointer to a 24-bit value that may be unaligned.
|
@param Buffer Pointer to a 24-bit value that may be unaligned.
|
||||||
@param Value 24-bit value to write to Buffer.
|
@param Value 24-bit value to write to Buffer.
|
||||||
|
|
||||||
@return The 24-bit value to write to Buffer.
|
@return The 24-bit value to write to Buffer.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
WriteUnaligned24 (
|
WriteUnaligned24 (
|
||||||
OUT UINT32 *Buffer,
|
OUT UINT32 *Buffer,
|
||||||
IN UINT32 Value
|
IN UINT32 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (Buffer != NULL);
|
ASSERT (Buffer != NULL);
|
||||||
|
|
||||||
WriteUnaligned16 ((UINT16*)Buffer, (UINT16)Value);
|
WriteUnaligned16 ((UINT16*)Buffer, (UINT16)Value);
|
||||||
*(UINT8*)((UINT16*)Buffer + 1) = (UINT8)(Value >> 16);
|
*(UINT8*)((UINT16*)Buffer + 1) = (UINT8)(Value >> 16);
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads a 32-bit value from memory that may be unaligned.
|
Reads a 32-bit value from memory that may be unaligned.
|
||||||
|
|
||||||
This function returns the 32-bit value pointed to by Buffer. The function
|
This function returns the 32-bit value pointed to by Buffer. The function
|
||||||
guarantees that the read operation does not produce an alignment fault.
|
guarantees that the read operation does not produce an alignment fault.
|
||||||
|
|
||||||
If the Buffer is NULL, then ASSERT().
|
If the Buffer is NULL, then ASSERT().
|
||||||
|
|
||||||
@param Buffer Pointer to a 32-bit value that may be unaligned.
|
@param Buffer Pointer to a 32-bit value that may be unaligned.
|
||||||
|
|
||||||
@return The 32-bit value read from Buffer.
|
@return The 32-bit value read from Buffer.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ReadUnaligned32 (
|
ReadUnaligned32 (
|
||||||
IN CONST UINT32 *Buffer
|
IN CONST UINT32 *Buffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT16 LowerBytes;
|
UINT16 LowerBytes;
|
||||||
UINT16 HigherBytes;
|
UINT16 HigherBytes;
|
||||||
|
|
||||||
ASSERT (Buffer != NULL);
|
ASSERT (Buffer != NULL);
|
||||||
|
|
||||||
LowerBytes = ReadUnaligned16 ((UINT16*) Buffer);
|
LowerBytes = ReadUnaligned16 ((UINT16*) Buffer);
|
||||||
HigherBytes = ReadUnaligned16 ((UINT16*) Buffer + 1);
|
HigherBytes = ReadUnaligned16 ((UINT16*) Buffer + 1);
|
||||||
|
|
||||||
return (UINT32) (LowerBytes | (HigherBytes << 16));
|
return (UINT32) (LowerBytes | (HigherBytes << 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes a 32-bit value to memory that may be unaligned.
|
Writes a 32-bit value to memory that may be unaligned.
|
||||||
|
|
||||||
This function writes the 32-bit value specified by Value to Buffer. Value is
|
This function writes the 32-bit value specified by Value to Buffer. Value is
|
||||||
returned. The function guarantees that the write operation does not produce
|
returned. The function guarantees that the write operation does not produce
|
||||||
an alignment fault.
|
an alignment fault.
|
||||||
|
|
||||||
If the Buffer is NULL, then ASSERT().
|
If the Buffer is NULL, then ASSERT().
|
||||||
|
|
||||||
@param Buffer Pointer to a 32-bit value that may be unaligned.
|
@param Buffer Pointer to a 32-bit value that may be unaligned.
|
||||||
@param Value 32-bit value to write to Buffer.
|
@param Value 32-bit value to write to Buffer.
|
||||||
|
|
||||||
@return The 32-bit value to write to Buffer.
|
@return The 32-bit value to write to Buffer.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
WriteUnaligned32 (
|
WriteUnaligned32 (
|
||||||
OUT UINT32 *Buffer,
|
OUT UINT32 *Buffer,
|
||||||
IN UINT32 Value
|
IN UINT32 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (Buffer != NULL);
|
ASSERT (Buffer != NULL);
|
||||||
|
|
||||||
WriteUnaligned16 ((UINT16*)Buffer, (UINT16)Value);
|
WriteUnaligned16 ((UINT16*)Buffer, (UINT16)Value);
|
||||||
WriteUnaligned16 ((UINT16*)Buffer + 1, (UINT16)(Value >> 16));
|
WriteUnaligned16 ((UINT16*)Buffer + 1, (UINT16)(Value >> 16));
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads a 64-bit value from memory that may be unaligned.
|
Reads a 64-bit value from memory that may be unaligned.
|
||||||
|
|
||||||
This function returns the 64-bit value pointed to by Buffer. The function
|
This function returns the 64-bit value pointed to by Buffer. The function
|
||||||
guarantees that the read operation does not produce an alignment fault.
|
guarantees that the read operation does not produce an alignment fault.
|
||||||
|
|
||||||
If the Buffer is NULL, then ASSERT().
|
If the Buffer is NULL, then ASSERT().
|
||||||
|
|
||||||
@param Buffer Pointer to a 64-bit value that may be unaligned.
|
@param Buffer Pointer to a 64-bit value that may be unaligned.
|
||||||
|
|
||||||
@return The 64-bit value read from Buffer.
|
@return The 64-bit value read from Buffer.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ReadUnaligned64 (
|
ReadUnaligned64 (
|
||||||
IN CONST UINT64 *Buffer
|
IN CONST UINT64 *Buffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 LowerBytes;
|
UINT32 LowerBytes;
|
||||||
UINT32 HigherBytes;
|
UINT32 HigherBytes;
|
||||||
|
|
||||||
ASSERT (Buffer != NULL);
|
ASSERT (Buffer != NULL);
|
||||||
|
|
||||||
LowerBytes = ReadUnaligned32 ((UINT32*) Buffer);
|
LowerBytes = ReadUnaligned32 ((UINT32*) Buffer);
|
||||||
HigherBytes = ReadUnaligned32 ((UINT32*) Buffer + 1);
|
HigherBytes = ReadUnaligned32 ((UINT32*) Buffer + 1);
|
||||||
|
|
||||||
return (UINT64) (LowerBytes | LShiftU64 (HigherBytes, 32));
|
return (UINT64) (LowerBytes | LShiftU64 (HigherBytes, 32));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes a 64-bit value to memory that may be unaligned.
|
Writes a 64-bit value to memory that may be unaligned.
|
||||||
|
|
||||||
This function writes the 64-bit value specified by Value to Buffer. Value is
|
This function writes the 64-bit value specified by Value to Buffer. Value is
|
||||||
returned. The function guarantees that the write operation does not produce
|
returned. The function guarantees that the write operation does not produce
|
||||||
an alignment fault.
|
an alignment fault.
|
||||||
|
|
||||||
If the Buffer is NULL, then ASSERT().
|
If the Buffer is NULL, then ASSERT().
|
||||||
|
|
||||||
@param Buffer Pointer to a 64-bit value that may be unaligned.
|
@param Buffer Pointer to a 64-bit value that may be unaligned.
|
||||||
@param Value 64-bit value to write to Buffer.
|
@param Value 64-bit value to write to Buffer.
|
||||||
|
|
||||||
@return The 64-bit value to write to Buffer.
|
@return The 64-bit value to write to Buffer.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
WriteUnaligned64 (
|
WriteUnaligned64 (
|
||||||
OUT UINT64 *Buffer,
|
OUT UINT64 *Buffer,
|
||||||
IN UINT64 Value
|
IN UINT64 Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT (Buffer != NULL);
|
ASSERT (Buffer != NULL);
|
||||||
|
|
||||||
WriteUnaligned32 ((UINT32*)Buffer, (UINT32)Value);
|
WriteUnaligned32 ((UINT32*)Buffer, (UINT32)Value);
|
||||||
WriteUnaligned32 ((UINT32*)Buffer + 1, (UINT32)RShiftU64 (Value, 32));
|
WriteUnaligned32 ((UINT32*)Buffer + 1, (UINT32)RShiftU64 (Value, 32));
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
|||||||
loaded into memory or is executing at it's linked address.
|
loaded into memory or is executing at it's linked address.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||||
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -256,8 +256,8 @@ PeCoffLoaderGetPdbPointer (
|
|||||||
return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY));
|
return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY));
|
||||||
case CODEVIEW_SIGNATURE_RSDS:
|
case CODEVIEW_SIGNATURE_RSDS:
|
||||||
return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY));
|
return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY));
|
||||||
case CODEVIEW_SIGNATURE_MTOC:
|
case CODEVIEW_SIGNATURE_MTOC:
|
||||||
return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY));
|
return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY));
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,90 +1,90 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Specific relocation fixups for ARM architecture.
|
Specific relocation fixups for ARM architecture.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "BasePeCoffLibInternals.h"
|
#include "BasePeCoffLibInternals.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs an ARM-based specific relocation fixup and is a no-op on other
|
Performs an ARM-based specific relocation fixup and is a no-op on other
|
||||||
instruction sets.
|
instruction sets.
|
||||||
|
|
||||||
@param Reloc Pointer to the relocation record.
|
@param Reloc Pointer to the relocation record.
|
||||||
@param Fixup Pointer to the address to fix up.
|
@param Fixup Pointer to the address to fix up.
|
||||||
@param FixupData Pointer to a buffer to log the fixups.
|
@param FixupData Pointer to a buffer to log the fixups.
|
||||||
@param Adjust The offset to adjust the fixup.
|
@param Adjust The offset to adjust the fixup.
|
||||||
|
|
||||||
@return Status code.
|
@return Status code.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
PeCoffLoaderRelocateImageEx (
|
PeCoffLoaderRelocateImageEx (
|
||||||
IN UINT16 *Reloc,
|
IN UINT16 *Reloc,
|
||||||
IN OUT CHAR8 *Fixup,
|
IN OUT CHAR8 *Fixup,
|
||||||
IN OUT CHAR8 **FixupData,
|
IN OUT CHAR8 **FixupData,
|
||||||
IN UINT64 Adjust
|
IN UINT64 Adjust
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return RETURN_UNSUPPORTED;
|
return RETURN_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns TRUE if the machine type of PE/COFF image is supported. Supported
|
Returns TRUE if the machine type of PE/COFF image is supported. Supported
|
||||||
does not mean the image can be executed it means the PE/COFF loader supports
|
does not mean the image can be executed it means the PE/COFF loader supports
|
||||||
loading and relocating of the image type. It's up to the caller to support
|
loading and relocating of the image type. It's up to the caller to support
|
||||||
the entry point.
|
the entry point.
|
||||||
|
|
||||||
The IA32/X64 version PE/COFF loader/relocater both support IA32, X64 and EBC images.
|
The IA32/X64 version PE/COFF loader/relocater both support IA32, X64 and EBC images.
|
||||||
|
|
||||||
@param Machine Machine type from the PE Header.
|
@param Machine Machine type from the PE Header.
|
||||||
|
|
||||||
@return TRUE if this PE/COFF loader can load the image
|
@return TRUE if this PE/COFF loader can load the image
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
PeCoffLoaderImageFormatSupported (
|
PeCoffLoaderImageFormatSupported (
|
||||||
IN UINT16 Machine
|
IN UINT16 Machine
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ((Machine == IMAGE_FILE_MACHINE_ARMTHUMB_MIXED) || (Machine == IMAGE_FILE_MACHINE_EBC)) {
|
if ((Machine == IMAGE_FILE_MACHINE_ARMTHUMB_MIXED) || (Machine == IMAGE_FILE_MACHINE_EBC)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs an ARM-based specific re-relocation fixup and is a no-op on other
|
Performs an ARM-based specific re-relocation fixup and is a no-op on other
|
||||||
instruction sets. This is used to re-relocated the image into the EFI virtual
|
instruction sets. This is used to re-relocated the image into the EFI virtual
|
||||||
space for runtime calls.
|
space for runtime calls.
|
||||||
|
|
||||||
@param Reloc Pointer to the relocation record.
|
@param Reloc Pointer to the relocation record.
|
||||||
@param Fixup Pointer to the address to fix up.
|
@param Fixup Pointer to the address to fix up.
|
||||||
@param FixupData Pointer to a buffer to log the fixups.
|
@param FixupData Pointer to a buffer to log the fixups.
|
||||||
@param Adjust The offset to adjust the fixup.
|
@param Adjust The offset to adjust the fixup.
|
||||||
|
|
||||||
@return Status code.
|
@return Status code.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
PeHotRelocateImageEx (
|
PeHotRelocateImageEx (
|
||||||
IN UINT16 *Reloc,
|
IN UINT16 *Reloc,
|
||||||
IN OUT CHAR8 *Fixup,
|
IN OUT CHAR8 *Fixup,
|
||||||
IN OUT CHAR8 **FixupData,
|
IN OUT CHAR8 **FixupData,
|
||||||
IN UINT64 Adjust
|
IN UINT64 Adjust
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return RETURN_UNSUPPORTED;
|
return RETURN_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
only supports relocating IA32, x64, IPF, and EBC images.
|
only supports relocating IA32, x64, IPF, and EBC images.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||||
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -1153,10 +1153,10 @@ PeCoffLoaderLoadImage (
|
|||||||
ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY);
|
ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CODEVIEW_SIGNATURE_MTOC:
|
case CODEVIEW_SIGNATURE_MTOC:
|
||||||
ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY);
|
ImageContext->PdbPointer = (CHAR8 *)ImageContext->CodeView + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_MTOC_ENTRY);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# The X64 version library support loading IA32, X64 and EBC PE/COFF images.
|
# The X64 version library support loading IA32, X64 and EBC PE/COFF images.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2009, Intel Corporation.<BR>
|
# Copyright (c) 2006 - 2009, Intel Corporation.<BR>
|
||||||
# Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
# Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
#
|
#
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -40,9 +40,9 @@
|
|||||||
[Sources.IPF]
|
[Sources.IPF]
|
||||||
Ipf/PeCoffLoaderEx.c
|
Ipf/PeCoffLoaderEx.c
|
||||||
|
|
||||||
[Sources.ARM]
|
[Sources.ARM]
|
||||||
Arm/PeCoffLoaderEx.c
|
Arm/PeCoffLoaderEx.c
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Base Print Library instance implementation.
|
Base Print Library instance implementation.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||||
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -15,14 +15,14 @@
|
|||||||
|
|
||||||
#include "PrintLibInternal.h"
|
#include "PrintLibInternal.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Declare a VA_LIST global variable that is used in calls to BasePrintLibSPrintMarker()
|
// Declare a VA_LIST global variable that is used in calls to BasePrintLibSPrintMarker()
|
||||||
// when the BASE_LIST parameter is valid and the VA_LIST parameter is ignored.
|
// when the BASE_LIST parameter is valid and the VA_LIST parameter is ignored.
|
||||||
// A NULL VA_LIST can not be passed into BasePrintLibSPrintMarker() because some
|
// A NULL VA_LIST can not be passed into BasePrintLibSPrintMarker() because some
|
||||||
// compilers define VA_LIST to be a structure.
|
// compilers define VA_LIST to be a structure.
|
||||||
//
|
//
|
||||||
VA_LIST gNullVaList;
|
VA_LIST gNullVaList;
|
||||||
|
|
||||||
#define ASSERT_UNICODE_BUFFER(Buffer) ASSERT ((((UINTN) (Buffer)) & 0x01) == 0)
|
#define ASSERT_UNICODE_BUFFER(Buffer) ASSERT ((((UINTN) (Buffer)) & 0x01) == 0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -118,7 +118,7 @@ UnicodeBSPrint (
|
|||||||
{
|
{
|
||||||
ASSERT_UNICODE_BUFFER (StartOfBuffer);
|
ASSERT_UNICODE_BUFFER (StartOfBuffer);
|
||||||
ASSERT_UNICODE_BUFFER (FormatString);
|
ASSERT_UNICODE_BUFFER (FormatString);
|
||||||
return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, gNullVaList, Marker);
|
return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, gNullVaList, Marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -259,7 +259,7 @@ UnicodeBSPrintAsciiFormat (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT_UNICODE_BUFFER (StartOfBuffer);
|
ASSERT_UNICODE_BUFFER (StartOfBuffer);
|
||||||
return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE, FormatString, gNullVaList, Marker);
|
return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, OUTPUT_UNICODE, FormatString, gNullVaList, Marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -450,7 +450,7 @@ AsciiBSPrint (
|
|||||||
IN BASE_LIST Marker
|
IN BASE_LIST Marker
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, gNullVaList, Marker);
|
return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, 0, FormatString, gNullVaList, Marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -590,7 +590,7 @@ AsciiBSPrintUnicodeFormat (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
ASSERT_UNICODE_BUFFER (FormatString);
|
ASSERT_UNICODE_BUFFER (FormatString);
|
||||||
return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, gNullVaList, Marker);
|
return BasePrintLibSPrintMarker (StartOfBuffer, BufferSize, FORMAT_UNICODE, (CHAR8 *)FormatString, gNullVaList, Marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,98 +1,98 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Implementation of synchronization functions. Still needs to be ported
|
Implementation of synchronization functions. Still needs to be ported
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSyncCompareExchange32 (
|
InternalSyncCompareExchange32 (
|
||||||
IN volatile UINT32 *Value,
|
IN volatile UINT32 *Value,
|
||||||
IN UINT32 CompareValue,
|
IN UINT32 CompareValue,
|
||||||
IN UINT32 ExchangeValue
|
IN UINT32 ExchangeValue
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return *Value != CompareValue ? *Value :
|
return *Value != CompareValue ? *Value :
|
||||||
((*Value = ExchangeValue), CompareValue);
|
((*Value = ExchangeValue), CompareValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs an atomic compare exchange operation on a 64-bit unsigned integer.
|
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
|
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
|
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.
|
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.
|
The compare exchange operation must be performed using MP safe mechanisms.
|
||||||
|
|
||||||
@param Value A pointer to the 64-bit value for the compare exchange
|
@param Value A pointer to the 64-bit value for the compare exchange
|
||||||
operation.
|
operation.
|
||||||
@param CompareValue 64-bit value used in compare operation.
|
@param CompareValue 64-bit value used in compare operation.
|
||||||
@param ExchangeValue 64-bit value used in exchange operation.
|
@param ExchangeValue 64-bit value used in exchange operation.
|
||||||
|
|
||||||
@return The original *Value before exchange.
|
@return The original *Value before exchange.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSyncCompareExchange64 (
|
InternalSyncCompareExchange64 (
|
||||||
IN volatile UINT64 *Value,
|
IN volatile UINT64 *Value,
|
||||||
IN UINT64 CompareValue,
|
IN UINT64 CompareValue,
|
||||||
IN UINT64 ExchangeValue
|
IN UINT64 ExchangeValue
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return *Value != CompareValue ? *Value :
|
return *Value != CompareValue ? *Value :
|
||||||
((*Value = ExchangeValue), CompareValue);
|
((*Value = ExchangeValue), CompareValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs an atomic increment of an 32-bit unsigned integer.
|
Performs an atomic increment of an 32-bit unsigned integer.
|
||||||
|
|
||||||
Performs an atomic increment of the 32-bit unsigned integer specified by
|
Performs an atomic increment of the 32-bit unsigned integer specified by
|
||||||
Value and returns the incremented value. The increment operation must be
|
Value and returns the incremented value. The increment operation must be
|
||||||
performed using MP safe mechanisms. The state of the return value is not
|
performed using MP safe mechanisms. The state of the return value is not
|
||||||
guaranteed to be MP safe.
|
guaranteed to be MP safe.
|
||||||
|
|
||||||
@param Value A pointer to the 32-bit value to increment.
|
@param Value A pointer to the 32-bit value to increment.
|
||||||
|
|
||||||
@return The incremented value.
|
@return The incremented value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSyncIncrement (
|
InternalSyncIncrement (
|
||||||
IN volatile UINT32 *Value
|
IN volatile UINT32 *Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return ++*Value;
|
return ++*Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs an atomic decrement of an 32-bit unsigned integer.
|
Performs an atomic decrement of an 32-bit unsigned integer.
|
||||||
|
|
||||||
Performs an atomic decrement of the 32-bit unsigned integer specified by
|
Performs an atomic decrement of the 32-bit unsigned integer specified by
|
||||||
Value and returns the decrement value. The decrement operation must be
|
Value and returns the decrement value. The decrement operation must be
|
||||||
performed using MP safe mechanisms. The state of the return value is not
|
performed using MP safe mechanisms. The state of the return value is not
|
||||||
guaranteed to be MP safe.
|
guaranteed to be MP safe.
|
||||||
|
|
||||||
@param Value A pointer to the 32-bit value to decrement.
|
@param Value A pointer to the 32-bit value to decrement.
|
||||||
|
|
||||||
@return The decrement value.
|
@return The decrement value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSyncDecrement (
|
InternalSyncDecrement (
|
||||||
IN volatile UINT32 *Value
|
IN volatile UINT32 *Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return --*Value;
|
return --*Value;
|
||||||
}
|
}
|
||||||
|
@ -1,193 +1,193 @@
|
|||||||
/** @file
|
/** @file
|
||||||
GCC inline implementation of BaseSynchronizationLib processor specific functions.
|
GCC inline implementation of BaseSynchronizationLib processor specific functions.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs an atomic increment of an 32-bit unsigned integer.
|
Performs an atomic increment of an 32-bit unsigned integer.
|
||||||
|
|
||||||
Performs an atomic increment of the 32-bit unsigned integer specified by
|
Performs an atomic increment of the 32-bit unsigned integer specified by
|
||||||
Value and returns the incremented value. The increment operation must be
|
Value and returns the incremented value. The increment operation must be
|
||||||
performed using MP safe mechanisms. The state of the return value is not
|
performed using MP safe mechanisms. The state of the return value is not
|
||||||
guaranteed to be MP safe.
|
guaranteed to be MP safe.
|
||||||
|
|
||||||
@param Value A pointer to the 32-bit value to increment.
|
@param Value A pointer to the 32-bit value to increment.
|
||||||
|
|
||||||
@return The incremented value.
|
@return The incremented value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSyncIncrement (
|
InternalSyncIncrement (
|
||||||
IN volatile UINT32 *Value
|
IN volatile UINT32 *Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 Result;
|
UINT32 Result;
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"lock \n\t"
|
"lock \n\t"
|
||||||
"incl %2 \n\t"
|
"incl %2 \n\t"
|
||||||
"movl %2, %%eax "
|
"movl %2, %%eax "
|
||||||
: "=a" (Result), // %0
|
: "=a" (Result), // %0
|
||||||
"=m" (*Value) // %1
|
"=m" (*Value) // %1
|
||||||
: "m" (*Value) // %2
|
: "m" (*Value) // %2
|
||||||
: "memory",
|
: "memory",
|
||||||
"cc"
|
"cc"
|
||||||
);
|
);
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs an atomic decrement of an 32-bit unsigned integer.
|
Performs an atomic decrement of an 32-bit unsigned integer.
|
||||||
|
|
||||||
Performs an atomic decrement of the 32-bit unsigned integer specified by
|
Performs an atomic decrement of the 32-bit unsigned integer specified by
|
||||||
Value and returns the decremented value. The decrement operation must be
|
Value and returns the decremented value. The decrement operation must be
|
||||||
performed using MP safe mechanisms. The state of the return value is not
|
performed using MP safe mechanisms. The state of the return value is not
|
||||||
guaranteed to be MP safe.
|
guaranteed to be MP safe.
|
||||||
|
|
||||||
@param Value A pointer to the 32-bit value to decrement.
|
@param Value A pointer to the 32-bit value to decrement.
|
||||||
|
|
||||||
@return The decremented value.
|
@return The decremented value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSyncDecrement (
|
InternalSyncDecrement (
|
||||||
IN volatile UINT32 *Value
|
IN volatile UINT32 *Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 Result;
|
UINT32 Result;
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"lock \n\t"
|
"lock \n\t"
|
||||||
"decl %2 \n\t"
|
"decl %2 \n\t"
|
||||||
"movl %2, %%eax "
|
"movl %2, %%eax "
|
||||||
: "=a" (Result), // %0
|
: "=a" (Result), // %0
|
||||||
"=m" (*Value) // %1
|
"=m" (*Value) // %1
|
||||||
: "m" (*Value) // %2
|
: "m" (*Value) // %2
|
||||||
: "memory",
|
: "memory",
|
||||||
"cc"
|
"cc"
|
||||||
);
|
);
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs an atomic compare exchange operation on a 32-bit unsigned integer.
|
Performs an atomic compare exchange operation on a 32-bit unsigned integer.
|
||||||
|
|
||||||
Performs an atomic compare exchange operation on the 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
|
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,
|
ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
|
||||||
then Value is returned. The compare exchange operation must be performed using
|
then Value is returned. The compare exchange operation must be performed using
|
||||||
MP safe mechanisms.
|
MP safe mechanisms.
|
||||||
|
|
||||||
|
|
||||||
@param Value A pointer to the 32-bit value for the compare exchange
|
@param Value A pointer to the 32-bit value for the compare exchange
|
||||||
operation.
|
operation.
|
||||||
@param CompareValue 32-bit value used in compare operation.
|
@param CompareValue 32-bit value used in compare operation.
|
||||||
@param ExchangeValue 32-bit value used in exchange operation.
|
@param ExchangeValue 32-bit value used in exchange operation.
|
||||||
|
|
||||||
@return The original *Value before exchange.
|
@return The original *Value before exchange.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSyncCompareExchange32 (
|
InternalSyncCompareExchange32 (
|
||||||
IN OUT volatile UINT32 *Value,
|
IN OUT volatile UINT32 *Value,
|
||||||
IN UINT32 CompareValue,
|
IN UINT32 CompareValue,
|
||||||
IN UINT32 ExchangeValue
|
IN UINT32 ExchangeValue
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
// GCC 4.1 and forward supports atomic builtins
|
// GCC 4.1 and forward supports atomic builtins
|
||||||
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)))
|
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)))
|
||||||
|
|
||||||
return __sync_val_compare_and_swap (Value, CompareValue, ExchangeValue);
|
return __sync_val_compare_and_swap (Value, CompareValue, ExchangeValue);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
" \n\t"
|
" \n\t"
|
||||||
"lock \n\t"
|
"lock \n\t"
|
||||||
"cmpxchgl %1, %2 \n\t"
|
"cmpxchgl %1, %2 \n\t"
|
||||||
: "=a" (CompareValue) // %0
|
: "=a" (CompareValue) // %0
|
||||||
: "q" (ExchangeValue), // %1
|
: "q" (ExchangeValue), // %1
|
||||||
"m" (*Value),m // %2
|
"m" (*Value),m // %2
|
||||||
"0" (CompareValue) // %4
|
"0" (CompareValue) // %4
|
||||||
: "memory",
|
: "memory",
|
||||||
"cc"
|
"cc"
|
||||||
);
|
);
|
||||||
|
|
||||||
return CompareValue;
|
return CompareValue;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs an atomic compare exchange operation on a 64-bit unsigned integer.
|
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
|
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
|
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.
|
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.
|
The compare exchange operation must be performed using MP safe mechanisms.
|
||||||
|
|
||||||
|
|
||||||
@param Value A pointer to the 64-bit value for the compare exchange
|
@param Value A pointer to the 64-bit value for the compare exchange
|
||||||
operation.
|
operation.
|
||||||
@param CompareValue 64-bit value used in compare operation.
|
@param CompareValue 64-bit value used in compare operation.
|
||||||
@param ExchangeValue 64-bit value used in exchange operation.
|
@param ExchangeValue 64-bit value used in exchange operation.
|
||||||
|
|
||||||
@return The original *Value before exchange.
|
@return The original *Value before exchange.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSyncCompareExchange64 (
|
InternalSyncCompareExchange64 (
|
||||||
IN OUT volatile UINT64 *Value,
|
IN OUT volatile UINT64 *Value,
|
||||||
IN UINT64 CompareValue,
|
IN UINT64 CompareValue,
|
||||||
IN UINT64 ExchangeValue
|
IN UINT64 ExchangeValue
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// GCC 4.1 and forward supports atomic builtins
|
// GCC 4.1 and forward supports atomic builtins
|
||||||
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)))
|
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)))
|
||||||
|
|
||||||
return __sync_val_compare_and_swap (Value, CompareValue, ExchangeValue);
|
return __sync_val_compare_and_swap (Value, CompareValue, ExchangeValue);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
" \n\t"
|
" \n\t"
|
||||||
"push %%ebx \n\t"
|
"push %%ebx \n\t"
|
||||||
"movl %2,%%ebx \n\t"
|
"movl %2,%%ebx \n\t"
|
||||||
"lock \n\t"
|
"lock \n\t"
|
||||||
"cmpxchg8b (%1) \n\t"
|
"cmpxchg8b (%1) \n\t"
|
||||||
"pop %%ebx \n\t"
|
"pop %%ebx \n\t"
|
||||||
: "+A" (CompareValue) // %0
|
: "+A" (CompareValue) // %0
|
||||||
: "S" (Value), // %1
|
: "S" (Value), // %1
|
||||||
"r" ((UINT32) ExchangeValue), // %2
|
"r" ((UINT32) ExchangeValue), // %2
|
||||||
"c" ((UINT32) (ExchangeValue >> 32)) // %3
|
"c" ((UINT32) (ExchangeValue >> 32)) // %3
|
||||||
: "memory",
|
: "memory",
|
||||||
"cc"
|
"cc"
|
||||||
);
|
);
|
||||||
|
|
||||||
return CompareValue;
|
return CompareValue;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Implementation of synchronization functions.
|
Implementation of synchronization functions.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||||
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -18,7 +18,7 @@
|
|||||||
//
|
//
|
||||||
// GCC inline assembly for Read Write Barrier
|
// GCC inline assembly for Read Write Barrier
|
||||||
//
|
//
|
||||||
#define _ReadWriteBarrier() do { __asm__ __volatile__ ("": : : "memory"); } while(0)
|
#define _ReadWriteBarrier() do { __asm__ __volatile__ ("": : : "memory"); } while(0)
|
||||||
|
|
||||||
#define SPIN_LOCK_RELEASED ((UINTN) 1)
|
#define SPIN_LOCK_RELEASED ((UINTN) 1)
|
||||||
#define SPIN_LOCK_ACQUIRED ((UINTN) 2)
|
#define SPIN_LOCK_ACQUIRED ((UINTN) 2)
|
||||||
|
@ -1,192 +1,192 @@
|
|||||||
/** @file
|
/** @file
|
||||||
GCC inline implementation of BaseSynchronizationLib processor specific functions.
|
GCC inline implementation of BaseSynchronizationLib processor specific functions.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
Copyright (c) 2006 - 2009, Intel Corporation<BR>
|
||||||
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php
|
http://opensource.org/licenses/bsd-license.php
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs an atomic increment of an 32-bit unsigned integer.
|
Performs an atomic increment of an 32-bit unsigned integer.
|
||||||
|
|
||||||
Performs an atomic increment of the 32-bit unsigned integer specified by
|
Performs an atomic increment of the 32-bit unsigned integer specified by
|
||||||
Value and returns the incremented value. The increment operation must be
|
Value and returns the incremented value. The increment operation must be
|
||||||
performed using MP safe mechanisms. The state of the return value is not
|
performed using MP safe mechanisms. The state of the return value is not
|
||||||
guaranteed to be MP safe.
|
guaranteed to be MP safe.
|
||||||
|
|
||||||
@param Value A pointer to the 32-bit value to increment.
|
@param Value A pointer to the 32-bit value to increment.
|
||||||
|
|
||||||
@return The incremented value.
|
@return The incremented value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSyncIncrement (
|
InternalSyncIncrement (
|
||||||
IN volatile UINT32 *Value
|
IN volatile UINT32 *Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 Result;
|
UINT32 Result;
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"lock \n\t"
|
"lock \n\t"
|
||||||
"incl %2 \n\t"
|
"incl %2 \n\t"
|
||||||
"mov %2, %%eax "
|
"mov %2, %%eax "
|
||||||
: "=a" (Result), // %0
|
: "=a" (Result), // %0
|
||||||
"=m" (*Value) // %1
|
"=m" (*Value) // %1
|
||||||
: "m" (*Value) // %2
|
: "m" (*Value) // %2
|
||||||
: "memory",
|
: "memory",
|
||||||
"cc"
|
"cc"
|
||||||
);
|
);
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs an atomic decrement of an 32-bit unsigned integer.
|
Performs an atomic decrement of an 32-bit unsigned integer.
|
||||||
|
|
||||||
Performs an atomic decrement of the 32-bit unsigned integer specified by
|
Performs an atomic decrement of the 32-bit unsigned integer specified by
|
||||||
Value and returns the decremented value. The decrement operation must be
|
Value and returns the decremented value. The decrement operation must be
|
||||||
performed using MP safe mechanisms. The state of the return value is not
|
performed using MP safe mechanisms. The state of the return value is not
|
||||||
guaranteed to be MP safe.
|
guaranteed to be MP safe.
|
||||||
|
|
||||||
@param Value A pointer to the 32-bit value to decrement.
|
@param Value A pointer to the 32-bit value to decrement.
|
||||||
|
|
||||||
@return The decremented value.
|
@return The decremented value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSyncDecrement (
|
InternalSyncDecrement (
|
||||||
IN volatile UINT32 *Value
|
IN volatile UINT32 *Value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 Result;
|
UINT32 Result;
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"lock \n\t"
|
"lock \n\t"
|
||||||
"decl %2 \n\t"
|
"decl %2 \n\t"
|
||||||
"mov %2, %%eax "
|
"mov %2, %%eax "
|
||||||
: "=a" (Result), // %0
|
: "=a" (Result), // %0
|
||||||
"=m" (*Value) // %1
|
"=m" (*Value) // %1
|
||||||
: "m" (*Value) // %2
|
: "m" (*Value) // %2
|
||||||
: "memory",
|
: "memory",
|
||||||
"cc"
|
"cc"
|
||||||
);
|
);
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs an atomic compare exchange operation on a 32-bit unsigned integer.
|
Performs an atomic compare exchange operation on a 32-bit unsigned integer.
|
||||||
|
|
||||||
Performs an atomic compare exchange operation on the 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
|
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,
|
ExchangeValue and CompareValue is returned. If Value is not equal to CompareValue,
|
||||||
then Value is returned. The compare exchange operation must be performed using
|
then Value is returned. The compare exchange operation must be performed using
|
||||||
MP safe mechanisms.
|
MP safe mechanisms.
|
||||||
|
|
||||||
|
|
||||||
@param Value A pointer to the 32-bit value for the compare exchange
|
@param Value A pointer to the 32-bit value for the compare exchange
|
||||||
operation.
|
operation.
|
||||||
@param CompareValue 32-bit value used in compare operation.
|
@param CompareValue 32-bit value used in compare operation.
|
||||||
@param ExchangeValue 32-bit value used in exchange operation.
|
@param ExchangeValue 32-bit value used in exchange operation.
|
||||||
|
|
||||||
@return The original *Value before exchange.
|
@return The original *Value before exchange.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT32
|
UINT32
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSyncCompareExchange32 (
|
InternalSyncCompareExchange32 (
|
||||||
IN OUT volatile UINT32 *Value,
|
IN OUT volatile UINT32 *Value,
|
||||||
IN UINT32 CompareValue,
|
IN UINT32 CompareValue,
|
||||||
IN UINT32 ExchangeValue
|
IN UINT32 ExchangeValue
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// GCC 4.1 and forward supports atomic builtins
|
// GCC 4.1 and forward supports atomic builtins
|
||||||
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)))
|
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)))
|
||||||
|
|
||||||
return __sync_val_compare_and_swap (Value, CompareValue, ExchangeValue);
|
return __sync_val_compare_and_swap (Value, CompareValue, ExchangeValue);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"lock \n\t"
|
"lock \n\t"
|
||||||
"cmpxchgl %3, %1 "
|
"cmpxchgl %3, %1 "
|
||||||
: "=a" (CompareValue), // %0
|
: "=a" (CompareValue), // %0
|
||||||
"=m" (*Value) // %1
|
"=m" (*Value) // %1
|
||||||
: "a" (CompareValue), // %2
|
: "a" (CompareValue), // %2
|
||||||
"r" (ExchangeValue), // %3
|
"r" (ExchangeValue), // %3
|
||||||
"m" (*Value)
|
"m" (*Value)
|
||||||
: "memory",
|
: "memory",
|
||||||
"cc"
|
"cc"
|
||||||
);
|
);
|
||||||
|
|
||||||
return CompareValue;
|
return CompareValue;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performs an atomic compare exchange operation on a 64-bit unsigned integer.
|
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
|
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
|
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.
|
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.
|
The compare exchange operation must be performed using MP safe mechanisms.
|
||||||
|
|
||||||
|
|
||||||
@param Value A pointer to the 64-bit value for the compare exchange
|
@param Value A pointer to the 64-bit value for the compare exchange
|
||||||
operation.
|
operation.
|
||||||
@param CompareValue 64-bit value used in compare operation.
|
@param CompareValue 64-bit value used in compare operation.
|
||||||
@param ExchangeValue 64-bit value used in exchange operation.
|
@param ExchangeValue 64-bit value used in exchange operation.
|
||||||
|
|
||||||
@return The original *Value before exchange.
|
@return The original *Value before exchange.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InternalSyncCompareExchange64 (
|
InternalSyncCompareExchange64 (
|
||||||
IN OUT volatile UINT64 *Value,
|
IN OUT volatile UINT64 *Value,
|
||||||
IN UINT64 CompareValue,
|
IN UINT64 CompareValue,
|
||||||
IN UINT64 ExchangeValue
|
IN UINT64 ExchangeValue
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// GCC 4.1 and forward supports atomic builtins
|
// GCC 4.1 and forward supports atomic builtins
|
||||||
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)))
|
#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)))
|
||||||
|
|
||||||
return __sync_val_compare_and_swap (Value, CompareValue, ExchangeValue);
|
return __sync_val_compare_and_swap (Value, CompareValue, ExchangeValue);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
__asm__ __volatile__ (
|
__asm__ __volatile__ (
|
||||||
"lock \n\t"
|
"lock \n\t"
|
||||||
"cmpxchgq %3, %1 "
|
"cmpxchgq %3, %1 "
|
||||||
: "=a" (CompareValue), // %0
|
: "=a" (CompareValue), // %0
|
||||||
"=m" (*Value) // %1
|
"=m" (*Value) // %1
|
||||||
: "a" (CompareValue), // %2
|
: "a" (CompareValue), // %2
|
||||||
"r" (ExchangeValue), // %3
|
"r" (ExchangeValue), // %3
|
||||||
"m" (*Value)
|
"m" (*Value)
|
||||||
: "memory",
|
: "memory",
|
||||||
"cc"
|
"cc"
|
||||||
);
|
);
|
||||||
|
|
||||||
return CompareValue;
|
return CompareValue;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
UEFI Decompress Library implementation refer to UEFI specification.
|
UEFI Decompress Library implementation refer to UEFI specification.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
Copyright (c) 2006 - 2008, Intel Corporation<BR>
|
||||||
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -338,7 +338,7 @@ ReadPTLen (
|
|||||||
//
|
//
|
||||||
CharC = (UINT16) GetBits (Sd, nbit);
|
CharC = (UINT16) GetBits (Sd, nbit);
|
||||||
|
|
||||||
SetMem16 (&Sd->mPTTable[0] , sizeof (Sd->mPTTable), CharC);
|
SetMem16 (&Sd->mPTTable[0] , sizeof (Sd->mPTTable), CharC);
|
||||||
|
|
||||||
SetMem (Sd->mPTLen, nn, 0);
|
SetMem (Sd->mPTLen, nn, 0);
|
||||||
|
|
||||||
@ -417,7 +417,7 @@ ReadCLen (
|
|||||||
CharC = (UINT16) GetBits (Sd, CBIT);
|
CharC = (UINT16) GetBits (Sd, CBIT);
|
||||||
|
|
||||||
SetMem (Sd->mCLen, NC, 0);
|
SetMem (Sd->mCLen, NC, 0);
|
||||||
SetMem16 (&Sd->mCTable[0], sizeof (Sd->mCTable), CharC);
|
SetMem16 (&Sd->mCTable[0], sizeof (Sd->mCTable), CharC);
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# EFI/PI MdePkg Package
|
# EFI/PI MdePkg Package
|
||||||
#
|
#
|
||||||
# Copyright (c) 2007 - 2009, Intel Corporation<BR>
|
# Copyright (c) 2007 - 2009, Intel Corporation<BR>
|
||||||
# Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
# Portions Copyright (c) 2008-2009 Apple Inc.<BR>
|
||||||
#
|
#
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -20,7 +20,7 @@
|
|||||||
PLATFORM_VERSION = 1.01
|
PLATFORM_VERSION = 1.01
|
||||||
DSC_SPECIFICATION = 0x00010005
|
DSC_SPECIFICATION = 0x00010005
|
||||||
OUTPUT_DIRECTORY = Build/Mde
|
OUTPUT_DIRECTORY = Build/Mde
|
||||||
SUPPORTED_ARCHITECTURES = IA32|IPF|X64|EBC|ARM
|
SUPPORTED_ARCHITECTURES = IA32|IPF|X64|EBC|ARM
|
||||||
BUILD_TARGETS = DEBUG|RELEASE
|
BUILD_TARGETS = DEBUG|RELEASE
|
||||||
SKUID_IDENTIFIER = DEFAULT
|
SKUID_IDENTIFIER = DEFAULT
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user