From: qhuang8 Date: Thu, 27 Nov 2008 06:48:03 +0000 (+0000) Subject: 1. Removal PalCallStatic API X-Git-Tag: edk2-stable201903~19488 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=aad6137d5cdd23e8f7678918d3ab2e2a99f216eb;p=mirror_edk2.git 1. Removal PalCallStatic API 2. Two two new ReadApplicationRegister.c(), ReadControlRegister.c() API together with its related definitions in BaseLib.h 3. Remove prototype of AsmSwitchStackAndBackingStore() in public BaseLib.h, it is supposed to be a worker function for AsmSwitchStack() git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6757 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h index 2ea6b6194e..5c569ce78a 100644 --- a/MdePkg/Include/Library/BaseLib.h +++ b/MdePkg/Include/Library/BaseLib.h @@ -4841,6 +4841,105 @@ AsmReadSp ( ); +/// +/// Valid Index value for AsmReadControlRegister() +/// +#define IPF_CONTROL_REGISTER_DCR 0 +#define IPF_CONTROL_REGISTER_ITM 1 +#define IPF_CONTROL_REGISTER_IVA 2 +#define IPF_CONTROL_REGISTER_PTA 8 +#define IPF_CONTROL_REGISTER_IPSR 16 +#define IPF_CONTROL_REGISTER_ISR 17 +#define IPF_CONTROL_REGISTER_IIP 19 +#define IPF_CONTROL_REGISTER_IFA 20 +#define IPF_CONTROL_REGISTER_ITIR 21 +#define IPF_CONTROL_REGISTER_IIPA 22 +#define IPF_CONTROL_REGISTER_IFS 23 +#define IPF_CONTROL_REGISTER_IIM 24 +#define IPF_CONTROL_REGISTER_IHA 25 +#define IPF_CONTROL_REGISTER_LID 64 +#define IPF_CONTROL_REGISTER_IVR 65 +#define IPF_CONTROL_REGISTER_TPR 66 +#define IPF_CONTROL_REGISTER_EOI 67 +#define IPF_CONTROL_REGISTER_IRR0 68 +#define IPF_CONTROL_REGISTER_IRR1 69 +#define IPF_CONTROL_REGISTER_IRR2 70 +#define IPF_CONTROL_REGISTER_IRR3 71 +#define IPF_CONTROL_REGISTER_ITV 72 +#define IPF_CONTROL_REGISTER_PMV 73 +#define IPF_CONTROL_REGISTER_CMCV 74 +#define IPF_CONTROL_REGISTER_LRR0 80 +#define IPF_CONTROL_REGISTER_LRR1 81 + +/** + Reads a 64-bit control register. + + Reads and returns the control register specified by Index. The valid Index valued are defined + above in "Related Definitions". + If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only available on IPF. + + @param Index The index of the control register to read. + + @return The control register specified by Index. + +**/ +UINT64 +EFIAPI +AsmReadControlRegister ( + IN UINT64 Index + ); + + +/// +/// Valid Index value for AsmReadApplicationRegister() +/// +#define IPF_APPLICATION_REGISTER_K0 0 +#define IPF_APPLICATION_REGISTER_K1 1 +#define IPF_APPLICATION_REGISTER_K2 2 +#define IPF_APPLICATION_REGISTER_K3 3 +#define IPF_APPLICATION_REGISTER_K4 4 +#define IPF_APPLICATION_REGISTER_K5 5 +#define IPF_APPLICATION_REGISTER_K6 6 +#define IPF_APPLICATION_REGISTER_K7 7 +#define IPF_APPLICATION_REGISTER_RSC 16 +#define IPF_APPLICATION_REGISTER_BSP 17 +#define IPF_APPLICATION_REGISTER_BSPSTORE 18 +#define IPF_APPLICATION_REGISTER_RNAT 19 +#define IPF_APPLICATION_REGISTER_FCR 21 +#define IPF_APPLICATION_REGISTER_EFLAG 24 +#define IPF_APPLICATION_REGISTER_CSD 25 +#define IPF_APPLICATION_REGISTER_SSD 26 +#define IPF_APPLICATION_REGISTER_CFLG 27 +#define IPF_APPLICATION_REGISTER_FSR 28 +#define IPF_APPLICATION_REGISTER_FIR 29 +#define IPF_APPLICATION_REGISTER_FDR 30 +#define IPF_APPLICATION_REGISTER_CCV 32 +#define IPF_APPLICATION_REGISTER_UNAT 36 +#define IPF_APPLICATION_REGISTER_FPSR 40 +#define IPF_APPLICATION_REGISTER_ITC 44 +#define IPF_APPLICATION_REGISTER_PFS 64 +#define IPF_APPLICATION_REGISTER_LC 65 +#define IPF_APPLICATION_REGISTER_EC 66 + +/** + Reads a 64-bit application register. + + Reads and returns the application register specified by Index. The valid Index valued are defined + above in "Related Definitions". + If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only available on IPF. + + @param Index The index of the application register to read. + + @return The application register specified by Index. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegister ( + IN UINT64 Index + ); + + /** Determines if the CPU is currently executing in virtual, physical, or mixed mode. @@ -4905,67 +5004,6 @@ AsmPalCall ( ); -/** - Transfers control to a function starting with a new stack. - - Transfers control to the function specified by EntryPoint using the new stack - specified by NewStack and passing in the parameters specified by Context1 and - Context2. Context1 and Context2 are optional and may be NULL. The function - EntryPoint must never return. - - If EntryPoint is NULL, then ASSERT(). - If NewStack is NULL, then ASSERT(). - - @param EntryPoint A pointer to function to call with the new stack. - @param Context1 A pointer to the context to pass into the EntryPoint - function. - @param Context2 A pointer to the context to pass into the EntryPoint - function. - @param NewStack A pointer to the new stack to use for the EntryPoint - function. - @param NewBsp A pointer to the new memory location for RSE backing - store. - -**/ -VOID -EFIAPI -AsmSwitchStackAndBackingStore ( - IN SWITCH_STACK_ENTRY_POINT EntryPoint, - IN VOID *Context1, OPTIONAL - IN VOID *Context2, OPTIONAL - IN VOID *NewStack, - IN VOID *NewBsp - ); - -/** - @todo This call should be removed after the PalCall - Instance issue has been fixed. - - Performs a PAL call using static calling convention. - - An internal function to perform a PAL call using static calling convention. - - @param PalEntryPoint The entry point address of PAL. The address in ar.kr5 - would be used if this parameter were NULL on input. - @param Arg1 The first argument of a PAL call. - @param Arg2 The second argument of a PAL call. - @param Arg3 The third argument of a PAL call. - @param Arg4 The fourth argument of a PAL call. - - @return The values returned in r8, r9, r10 and r11. - -**/ -PAL_CALL_RETURN -PalCallStatic ( - IN CONST VOID *PalEntryPoint, - IN UINT64 Arg1, - IN UINT64 Arg2, - IN UINT64 Arg3, - IN UINT64 Arg4 - ); - - - #elif defined (MDE_CPU_IA32) || defined (MDE_CPU_X64) /// /// IA32 and X64 Specific Functions diff --git a/MdePkg/Library/BaseLib/BaseLib.inf b/MdePkg/Library/BaseLib/BaseLib.inf index 85b7433aff..3a38f2ba1c 100644 --- a/MdePkg/Library/BaseLib/BaseLib.inf +++ b/MdePkg/Library/BaseLib/BaseLib.inf @@ -599,7 +599,10 @@ Ipf/SwitchStack.s Ipf/LongJmp.s Ipf/SetJmp.s - Ipf/PalCallStatic.s + Ipf/ReadCr.s + Ipf/ReadControlRegister.c + Ipf/ReadAr.s + Ipf/ReadApplicationRegister.c Ipf/Ia64gen.h Ipf/Asm.h Math64.c diff --git a/MdePkg/Library/BaseLib/BaseLibInternals.h b/MdePkg/Library/BaseLib/BaseLibInternals.h index b39f2df927..431c1e3533 100644 --- a/MdePkg/Library/BaseLib/BaseLibInternals.h +++ b/MdePkg/Library/BaseLib/BaseLibInternals.h @@ -828,6 +828,865 @@ InternalX86DisablePaging64 ( // IPF specific functions // +// +// Structure definition for look up table. +// +typedef struct { + UINT64 Index; + UINT64 (*Function) (VOID); +} REGISTER_ENTRY; + + +/** + Reads control register DCR. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_DCR + + @return The 64-bit control register DCR. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterDcr ( + VOID + ); + + +/** + Reads control register ITM. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_ITM + + @return The 64-bit control register ITM. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterItm ( + VOID + ); + + +/** + Reads control register IVA. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_IVA + + @return The 64-bit control register IVA. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterIva ( + VOID + ); + + +/** + Reads control register PTA. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_PTA + + @return The 64-bit control register PTA. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterPta ( + VOID + ); + + +/** + Reads control register IPSR. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_IPSR + + @return The 64-bit control register IPSR. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterIpsr ( + VOID + ); + + +/** + Reads control register ISR. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_ISR + + @return The 64-bit control register ISR. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterIsr ( + VOID + ); + + +/** + Reads control register IIP. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_IIP + + @return The 64-bit control register IIP. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterIip ( + VOID + ); + + +/** + Reads control register IFA. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_IFA + + @return The 64-bit control register IFA. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterIfa ( + VOID + ); + + +/** + Reads control register ITIR. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_ITIR + + @return The 64-bit control register ITIR. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterItir ( + VOID + ); + + +/** + Reads control register IIPA. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_IIPA + + @return The 64-bit control register IIPA. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterIipa ( + VOID + ); + + +/** + Reads control register IFS. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_IFS + + @return The 64-bit control register IFS. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterIfs ( + VOID + ); + + +/** + Reads control register IIM. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_IIM + + @return The 64-bit control register IIM. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterIim ( + VOID + ); + + +/** + Reads control register IHA. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_IHA + + @return The 64-bit control register IHA. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterIha ( + VOID + ); + + +/** + Reads control register LID. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_LID + + @return The 64-bit control register LID. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterLid ( + VOID + ); + + +/** + Reads control register IVR. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_IVR + + @return The 64-bit control register IVR. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterIvr ( + VOID + ); + + +/** + Reads control register TPR. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_TPR + + @return The 64-bit control register TPR. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterTpr ( + VOID + ); + + +/** + Reads control register EOI. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_EOI + + @return The 64-bit control register EOI. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterEoi ( + VOID + ); + + +/** + Reads control register IRR0. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_IRR0 + + @return The 64-bit control register IRR0. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterIrr0 ( + VOID + ); + + +/** + Reads control register IRR1. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_IRR1 + + @return The 64-bit control register IRR1. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterIrr1 ( + VOID + ); + + +/** + Reads control register IRR2. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_IRR2 + + @return The 64-bit control register IRR2. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterIrr2 ( + VOID + ); + + +/** + Reads control register IRR3. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_IRR3 + + @return The 64-bit control register IRR3. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterIrr3 ( + VOID + ); + + +/** + Reads control register ITV. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_ITV + + @return The 64-bit control register ITV. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterItv ( + VOID + ); + + +/** + Reads control register PMV. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_PMV + + @return The 64-bit control register PMV. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterPmv ( + VOID + ); + + +/** + Reads control register CMCV. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_CMCV + + @return The 64-bit control register CMCV. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterCmcv ( + VOID + ); + + +/** + Reads control register LRR0. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_LRR0 + + @return The 64-bit control register LRR0. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterLrr0 ( + VOID + ); + + +/** + Reads control register LRR1. + + This is a worker function for AsmReadControlRegister() + when its parameter Index is IPF_CONTROL_REGISTER_LRR1 + + @return The 64-bit control register LRR1. + +**/ +UINT64 +EFIAPI +AsmReadControlRegisterLrr1 ( + VOID + ); + + +/** + Reads application register K0. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_K0 + + @return The 64-bit application register K0. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterK0 ( + VOID + ); + + + +/** + Reads application register K1. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_K1 + + @return The 64-bit application register K1. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterK1 ( + VOID + ); + + +/** + Reads application register K2. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_K2 + + @return The 64-bit application register K2. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterK2 ( + VOID + ); + + +/** + Reads application register K3. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_K3 + + @return The 64-bit application register K3. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterK3 ( + VOID + ); + + +/** + Reads application register K4. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_K4 + + @return The 64-bit application register K4. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterK4 ( + VOID + ); + + +/** + Reads application register K5. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_K5 + + @return The 64-bit application register K5. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterK5 ( + VOID + ); + + +/** + Reads application register K6. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_K6 + + @return The 64-bit application register K6. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterK6 ( + VOID + ); + + +/** + Reads application register K7. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_K7 + + @return The 64-bit application register K7. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterK7 ( + VOID + ); + + +/** + Reads application register RSC. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_RSC + + @return The 64-bit application register RSC. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterRsc ( + VOID + ); + + +/** + Reads application register BSP. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_BSP + + @return The 64-bit application register BSP. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterBsp ( + VOID + ); + + +/** + Reads application register BSPSTORE. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_BSPSTORE + + @return The 64-bit application register BSPSTORE. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterBspstore ( + VOID + ); + + +/** + Reads application register RNAT. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_RNAT + + @return The 64-bit application register RNAT. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterRnat ( + VOID + ); + + +/** + Reads application register FCR. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_FCR + + @return The 64-bit application register FCR. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterFcr ( + VOID + ); + + +/** + Reads application register EFLAG. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_EFLAG + + @return The 64-bit application register EFLAG. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterEflag ( + VOID + ); + + +/** + Reads application register CSD. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_CSD + + @return The 64-bit application register CSD. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterCsd ( + VOID + ); + + +/** + Reads application register SSD. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_SSD + + @return The 64-bit application register SSD. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterSsd ( + VOID + ); + + +/** + Reads application register CFLG. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_CFLG + + @return The 64-bit application register CFLG. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterCflg ( + VOID + ); + + +/** + Reads application register FSR. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_FSR + + @return The 64-bit application register FSR. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterFsr ( + VOID + ); + + +/** + Reads application register FIR. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_FIR + + @return The 64-bit application register FIR. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterFir ( + VOID + ); + + +/** + Reads application register FDR. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_FDR + + @return The 64-bit application register FDR. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterFdr ( + VOID + ); + + +/** + Reads application register CCV. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_CCV + + @return The 64-bit application register CCV. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterCcv ( + VOID + ); + + +/** + Reads application register UNAT. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_UNAT + + @return The 64-bit application register UNAT. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterUnat ( + VOID + ); + + +/** + Reads application register FPSR. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_FPSR + + @return The 64-bit application register FPSR. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterFpsr ( + VOID + ); + + +/** + Reads application register ITC. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_ITC + + @return The 64-bit application register ITC. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterItc ( + VOID + ); + + +/** + Reads application register PFS. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_PFS + + @return The 64-bit application register PFS. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterPfs ( + VOID + ); + + +/** + Reads application register LC. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_LC + + @return The 64-bit application register LC. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterLc ( + VOID + ); + + +/** + Reads application register EC. + + This is a worker function for AsmReadApplicationRegister() + when its parameter Index is IPF_APPLICATION_REGISTER_EC + + @return The 64-bit application register EC. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegisterEc ( + VOID + ); + + + /** Transfers control to a function starting with a new stack. diff --git a/MdePkg/Library/BaseLib/Ipf/PalCallStatic.s b/MdePkg/Library/BaseLib/Ipf/PalCallStatic.s deleted file mode 100644 index c21d7427f9..0000000000 --- a/MdePkg/Library/BaseLib/Ipf/PalCallStatic.s +++ /dev/null @@ -1,48 +0,0 @@ -/// @file -/// Contains an implementation of CallPalProcStatic on Itanium-based -/// architecture. -/// -/// Copyright (c) 2006, Intel Corporation -/// All rights reserved. This program and the accompanying materials -/// are licensed and made available under the terms and conditions of the BSD License -/// which accompanies this distribution. The full text of the license may be found at -/// http://opensource.org/licenses/bsd-license.php -/// -/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -/// -/// Module Name: PalCallStatic.s -/// -/// - -.auto -.text - -.proc PalCallStatic -.type PalCallStatic, @function -.regstk 5, 0, 0, 0 -PalCallStatic:: - cmp.eq p15 = in0, r0 - mov r31 = in4 - mov r8 = ip - -(p15) mov in0 = ar.k5 - add r8 = (_PalProcReturn - PalCallStatic), r8 - mov r30 = in3 - - mov in4 = psr - mov in3 = b0 - mov b7 = in0 - - rsm 1 << 14 // Disable interrupts - mov r29 = in2 - mov r28 = in1 - - mov b0 = r8 - br.cond.sptk.many b7 - -_PalProcReturn: - mov psr.l = in4 - mov b0 = in3 - br.ret.sptk.many b0 -.endp PalCallStatic diff --git a/MdePkg/Library/BaseLib/Ipf/ReadApplicationRegister.c b/MdePkg/Library/BaseLib/Ipf/ReadApplicationRegister.c new file mode 100644 index 0000000000..818e6ac404 --- /dev/null +++ b/MdePkg/Library/BaseLib/Ipf/ReadApplicationRegister.c @@ -0,0 +1,79 @@ +/** @file + Implementation of Application Register reading functions on Itanium platform. + + Copyright (c) 2008, Intel Corporation
+ All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include "BaseLibInternals.h" + + +// +// Loop up table for Index and corresponding application register access routines. +// +GLOBAL_REMOVE_IF_UNREFERENCED REGISTER_ENTRY mApplicationRegisterAccessEntries[] = { + {IPF_APPLICATION_REGISTER_K0, AsmReadApplicationRegisterK0}, + {IPF_APPLICATION_REGISTER_K1, AsmReadApplicationRegisterK1}, + {IPF_APPLICATION_REGISTER_K2, AsmReadApplicationRegisterK2}, + {IPF_APPLICATION_REGISTER_K3, AsmReadApplicationRegisterK3}, + {IPF_APPLICATION_REGISTER_K4, AsmReadApplicationRegisterK4}, + {IPF_APPLICATION_REGISTER_K5, AsmReadApplicationRegisterK5}, + {IPF_APPLICATION_REGISTER_K6, AsmReadApplicationRegisterK6}, + {IPF_APPLICATION_REGISTER_K7, AsmReadApplicationRegisterK7}, + {IPF_APPLICATION_REGISTER_RSC, AsmReadApplicationRegisterRsc}, + {IPF_APPLICATION_REGISTER_BSP, AsmReadApplicationRegisterBsp}, + {IPF_APPLICATION_REGISTER_BSPSTORE, AsmReadApplicationRegisterBspstore}, + {IPF_APPLICATION_REGISTER_RNAT, AsmReadApplicationRegisterRnat}, + {IPF_APPLICATION_REGISTER_FCR, AsmReadApplicationRegisterFcr}, + {IPF_APPLICATION_REGISTER_EFLAG, AsmReadApplicationRegisterEflag}, + {IPF_APPLICATION_REGISTER_CSD, AsmReadApplicationRegisterCsd}, + {IPF_APPLICATION_REGISTER_SSD, AsmReadApplicationRegisterSsd}, + {IPF_APPLICATION_REGISTER_CFLG, AsmReadApplicationRegisterCflg}, + {IPF_APPLICATION_REGISTER_FSR, AsmReadApplicationRegisterFsr}, + {IPF_APPLICATION_REGISTER_FIR, AsmReadApplicationRegisterFir}, + {IPF_APPLICATION_REGISTER_FDR, AsmReadApplicationRegisterFdr}, + {IPF_APPLICATION_REGISTER_CCV, AsmReadApplicationRegisterCcv}, + {IPF_APPLICATION_REGISTER_UNAT, AsmReadApplicationRegisterUnat}, + {IPF_APPLICATION_REGISTER_FPSR, AsmReadApplicationRegisterFpsr}, + {IPF_APPLICATION_REGISTER_ITC, AsmReadApplicationRegisterItc}, + {IPF_APPLICATION_REGISTER_PFS, AsmReadApplicationRegisterPfs}, + {IPF_APPLICATION_REGISTER_LC, AsmReadApplicationRegisterLc}, + {IPF_APPLICATION_REGISTER_EC, AsmReadApplicationRegisterEc} +}; + + +/** + Reads a 64-bit application register. + + Reads and returns the application register specified by Index. The valid Index valued are defined + above in "Related Definitions". + If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only available on IPF. + + @param Index The index of the application register to read. + + @return The application register specified by Index. + +**/ +UINT64 +EFIAPI +AsmReadApplicationRegister ( + IN UINT64 Index + ) +{ + UINTN Item; + + for (Item = 0; Item < sizeof (mApplicationRegisterAccessEntries) / sizeof (mApplicationRegisterAccessEntries[0]); Item++) { + if (mApplicationRegisterAccessEntries[Item].Index == Index) { + return mApplicationRegisterAccessEntries[Item].Function (); + } + } + + return 0xFFFFFFFFFFFFFFFF; +} diff --git a/MdePkg/Library/BaseLib/Ipf/ReadAr.s b/MdePkg/Library/BaseLib/Ipf/ReadAr.s new file mode 100644 index 0000000000..56225269ad --- /dev/null +++ b/MdePkg/Library/BaseLib/Ipf/ReadAr.s @@ -0,0 +1,501 @@ +/// @file +/// IPF specific application register reading functions +/// +/// Copyright (c) 2008, Intel Corporation +/// All rights reserved. This program and the accompanying materials +/// are licensed and made available under the terms and conditions of the BSD License +/// which accompanies this distribution. The full text of the license may be found at +/// http://opensource.org/licenses/bsd-license.php +/// +/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +/// +/// +/// + + + +.text +.type AsmReadApplicationRegisterK0, @function +.proc AsmReadApplicationRegisterK0 +// +// Reads appplication register K0. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_K0 +// +// @return The 64-bit application register K0. +// +AsmReadApplicationRegisterK0:: + mov r8 = ar.k0;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterK0 + + + +.text +.type AsmReadApplicationRegisterK1, @function +.proc AsmReadApplicationRegisterK1 +// +// Reads appplication register K1. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_K1 +// +// @return The 64-bit application register K1. +// +AsmReadApplicationRegisterK1:: + mov r8 = ar.k1;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterK1 + + + +.text +.type AsmReadApplicationRegisterK2, @function +.proc AsmReadApplicationRegisterK2 +// +// Reads appplication register K2. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_K2 +// +// @return The 64-bit application register K2. +// +AsmReadApplicationRegisterK2:: + mov r8 = ar.k2;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterK2 + + + +.text +.type AsmReadApplicationRegisterK3, @function +.proc AsmReadApplicationRegisterK3 +// +// Reads appplication register K3. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_K3 +// +// @return The 64-bit application register K3. +// +AsmReadApplicationRegisterK3:: + mov r8 = ar.k3;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterK3 + + + +.text +.type AsmReadApplicationRegisterK4, @function +.proc AsmReadApplicationRegisterK4 +// +// Reads appplication register K4. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_K4 +// +// @return The 64-bit application register K4. +// +AsmReadApplicationRegisterK4:: + mov r8 = ar.k4;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterK4 + + + +.text +.type AsmReadApplicationRegisterK5, @function +.proc AsmReadApplicationRegisterK5 +// +// Reads appplication register K5. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_K5 +// +// @return The 64-bit application register K5. +// +AsmReadApplicationRegisterK5:: + mov r8 = ar.k5;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterK5 + + + +.text +.type AsmReadApplicationRegisterK6, @function +.proc AsmReadApplicationRegisterK6 +// +// Reads appplication register K6. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_K6 +// +// @return The 64-bit application register K6. +// +AsmReadApplicationRegisterK6:: + mov r8 = ar.k6;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterK6 + + + +.text +.type AsmReadApplicationRegisterK7, @function +.proc AsmReadApplicationRegisterK7 +// +// Reads appplication register K7. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_K7 +// +// @return The 64-bit application register K7. +// +AsmReadApplicationRegisterK7:: + mov r8 = ar.k7;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterK7 + + + +.text +.type AsmReadApplicationRegisterRsc, @function +.proc AsmReadApplicationRegisterRsc +// +// Reads appplication register RSC. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_RSC +// +// @return The 64-bit application register RSC. +// +AsmReadApplicationRegisterRsc:: + mov r8 = ar.rsc;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterRsc + + + +.text +.type AsmReadApplicationRegisterBsp, @function +.proc AsmReadApplicationRegisterBsp +// +// Reads appplication register BSP. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_BSP +// +// @return The 64-bit application register BSP. +// +AsmReadApplicationRegisterBsp:: + mov r8 = ar.bsp;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterBsp + + + +.text +.type AsmReadApplicationRegisterBspstore, @function +.proc AsmReadApplicationRegisterBspstore +// +// Reads appplication register BSPSTORE. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_BSPSTORE +// +// @return The 64-bit application register BSPSTORE. +// +AsmReadApplicationRegisterBspstore:: + mov r8 = ar.bspstore;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterBspstore + + + +.text +.type AsmReadApplicationRegisterRnat, @function +.proc AsmReadApplicationRegisterRnat +// +// Reads appplication register RNAT. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_RNAT +// +// @return The 64-bit application register RNAT. +// +AsmReadApplicationRegisterRnat:: + mov r8 = ar.rnat;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterRnat + + + +.text +.type AsmReadApplicationRegisterFcr, @function +.proc AsmReadApplicationRegisterFcr +// +// Reads appplication register FCR. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_FCR +// +// @return The 64-bit application register FCR. +// +AsmReadApplicationRegisterFcr:: + mov r8 = ar.fcr;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterFcr + + + +.text +.type AsmReadApplicationRegisterEflag, @function +.proc AsmReadApplicationRegisterEflag +// +// Reads appplication register EFLAG. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_EFLAG +// +// @return The 64-bit application register EFLAG. +// +AsmReadApplicationRegisterEflag:: + mov r8 = ar.eflag;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterEflag + + + +.text +.type AsmReadApplicationRegisterCsd, @function +.proc AsmReadApplicationRegisterCsd +// +// Reads appplication register CSD. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_CSD +// +// @return The 64-bit application register CSD. +// +AsmReadApplicationRegisterCsd:: + mov r8 = ar.csd;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterCsd + + + +.text +.type AsmReadApplicationRegisterSsd, @function +.proc AsmReadApplicationRegisterSsd +// +// Reads appplication register SSD. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_SSD +// +// @return The 64-bit application register SSD. +// +AsmReadApplicationRegisterSsd:: + mov r8 = ar.ssd;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterSsd + + + +.text +.type AsmReadApplicationRegisterCflg, @function +.proc AsmReadApplicationRegisterCflg +// +// Reads appplication register CFLG. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_CFLG +// +// @return The 64-bit application register CFLG. +// +AsmReadApplicationRegisterCflg:: + mov r8 = ar.cflg;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterCflg + + + +.text +.type AsmReadApplicationRegisterFsr, @function +.proc AsmReadApplicationRegisterFsr +// +// Reads appplication register FSR. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_FSR +// +// @return The 64-bit application register FSR. +// +AsmReadApplicationRegisterFsr:: + mov r8 = ar.fsr;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterFsr + + + +.text +.type AsmReadApplicationRegisterFir, @function +.proc AsmReadApplicationRegisterFir +// +// Reads appplication register FIR. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_FIR +// +// @return The 64-bit application register FIR. +// +AsmReadApplicationRegisterFir:: + mov r8 = ar.fir;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterFir + + + +.text +.type AsmReadApplicationRegisterFdr, @function +.proc AsmReadApplicationRegisterFdr +// +// Reads appplication register FDR. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_FDR +// +// @return The 64-bit application register FDR. +// +AsmReadApplicationRegisterFdr:: + mov r8 = ar.fdr;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterFdr + + + +.text +.type AsmReadApplicationRegisterCcv, @function +.proc AsmReadApplicationRegisterCcv +// +// Reads appplication register CCV. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_CCV +// +// @return The 64-bit application register CCV. +// +AsmReadApplicationRegisterCcv:: + mov r8 = ar.ccv;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterCcv + + + +.text +.type AsmReadApplicationRegisterUnat, @function +.proc AsmReadApplicationRegisterUnat +// +// Reads appplication register UNAT. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_UNAT +// +// @return The 64-bit application register UNAT. +// +AsmReadApplicationRegisterUnat:: + mov r8 = ar.unat;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterUnat + + + +.text +.type AsmReadApplicationRegisterFpsr, @function +.proc AsmReadApplicationRegisterFpsr +// +// Reads appplication register FPSR. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_FPSR +// +// @return The 64-bit application register FPSR. +// +AsmReadApplicationRegisterFpsr:: + mov r8 = ar.fpsr;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterFpsr + + + +.text +.type AsmReadApplicationRegisterItc, @function +.proc AsmReadApplicationRegisterItc +// +// Reads appplication register ITC. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_ITC +// +// @return The 64-bit application register ITC. +// +AsmReadApplicationRegisterItc:: + mov r8 = ar.itc;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterItc + + + +.text +.type AsmReadApplicationRegisterPfs, @function +.proc AsmReadApplicationRegisterPfs +// +// Reads appplication register PFS. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_PFS +// +// @return The 64-bit application register PFS. +// +AsmReadApplicationRegisterPfs:: + mov r8 = ar.pfs;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterPfs + + + +.text +.type AsmReadApplicationRegisterLc, @function +.proc AsmReadApplicationRegisterLc +// +// Reads appplication register LC. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_LC +// +// @return The 64-bit application register LC. +// +AsmReadApplicationRegisterLc:: + mov r8 = ar.lc;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterLc + + + +.text +.type AsmReadApplicationRegisterEc, @function +.proc AsmReadApplicationRegisterEc +// +// Reads appplication register EC. +// +// This is a worker function for AsmReadApplicationRegister() +// when its parameter Index is IPF_APPLICATION_REGISTER_EC +// +// @return The 64-bit application register EC. +// +AsmReadApplicationRegisterEc:: + mov r8 = ar.ec;; + br.ret.dpnt b0;; +.endp AsmReadApplicationRegisterEc + diff --git a/MdePkg/Library/BaseLib/Ipf/ReadControlRegister.c b/MdePkg/Library/BaseLib/Ipf/ReadControlRegister.c new file mode 100644 index 0000000000..a3a8e11157 --- /dev/null +++ b/MdePkg/Library/BaseLib/Ipf/ReadControlRegister.c @@ -0,0 +1,78 @@ +/** @file + Implementation of Control Register reading functions on Itanium platform. + + Copyright (c) 2008, Intel Corporation
+ All rights reserved. This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include "BaseLibInternals.h" + + +// +// Loop up table for Index and corresponding control register access routines. +// +GLOBAL_REMOVE_IF_UNREFERENCED REGISTER_ENTRY mControlRegisterAccessEntries[] = { + {IPF_CONTROL_REGISTER_DCR, AsmReadControlRegisterDcr}, + {IPF_CONTROL_REGISTER_ITM, AsmReadControlRegisterItm}, + {IPF_CONTROL_REGISTER_IVA, AsmReadControlRegisterIva}, + {IPF_CONTROL_REGISTER_PTA, AsmReadControlRegisterPta}, + {IPF_CONTROL_REGISTER_IPSR, AsmReadControlRegisterIpsr}, + {IPF_CONTROL_REGISTER_ISR, AsmReadControlRegisterIsr}, + {IPF_CONTROL_REGISTER_IIP, AsmReadControlRegisterIip}, + {IPF_CONTROL_REGISTER_IFA, AsmReadControlRegisterIfa}, + {IPF_CONTROL_REGISTER_ITIR, AsmReadControlRegisterItir}, + {IPF_CONTROL_REGISTER_IIPA, AsmReadControlRegisterIipa}, + {IPF_CONTROL_REGISTER_IFS, AsmReadControlRegisterIfs}, + {IPF_CONTROL_REGISTER_IIM, AsmReadControlRegisterIim}, + {IPF_CONTROL_REGISTER_IHA, AsmReadControlRegisterIha}, + {IPF_CONTROL_REGISTER_LID, AsmReadControlRegisterLid}, + {IPF_CONTROL_REGISTER_IVR, AsmReadControlRegisterIvr}, + {IPF_CONTROL_REGISTER_TPR, AsmReadControlRegisterTpr}, + {IPF_CONTROL_REGISTER_EOI, AsmReadControlRegisterEoi}, + {IPF_CONTROL_REGISTER_IRR0, AsmReadControlRegisterIrr0}, + {IPF_CONTROL_REGISTER_IRR1, AsmReadControlRegisterIrr1}, + {IPF_CONTROL_REGISTER_IRR2, AsmReadControlRegisterIrr2}, + {IPF_CONTROL_REGISTER_IRR3, AsmReadControlRegisterIrr3}, + {IPF_CONTROL_REGISTER_ITV, AsmReadControlRegisterItv}, + {IPF_CONTROL_REGISTER_PMV, AsmReadControlRegisterPmv}, + {IPF_CONTROL_REGISTER_CMCV, AsmReadControlRegisterCmcv}, + {IPF_CONTROL_REGISTER_LRR0, AsmReadControlRegisterLrr0}, + {IPF_CONTROL_REGISTER_LRR1, AsmReadControlRegisterLrr1} +}; + + +/** + Reads a 64-bit control register. + + Reads and returns the control register specified by Index. The valid Index valued are defined + above in "Related Definitions". + If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only available on IPF. + + @param Index The index of the control register to read. + + @return The control register specified by Index. + +**/ +UINT64 +EFIAPI +AsmReadControlRegister ( + IN UINT64 Index + ) +{ + UINTN Item; + + for (Item = 0; Item < sizeof (mControlRegisterAccessEntries) / sizeof (mControlRegisterAccessEntries[0]); Item++) { + if (mControlRegisterAccessEntries[Item].Index == Index) { + return mControlRegisterAccessEntries[Item].Function (); + } + } + + return 0xFFFFFFFFFFFFFFFF; +} diff --git a/MdePkg/Library/BaseLib/Ipf/ReadCr.s b/MdePkg/Library/BaseLib/Ipf/ReadCr.s new file mode 100644 index 0000000000..839ea6fb34 --- /dev/null +++ b/MdePkg/Library/BaseLib/Ipf/ReadCr.s @@ -0,0 +1,482 @@ +/// @file +/// IPF specific control register reading functions +/// +/// Copyright (c) 2008, Intel Corporation +/// All rights reserved. This program and the accompanying materials +/// are licensed and made available under the terms and conditions of the BSD License +/// which accompanies this distribution. The full text of the license may be found at +/// http://opensource.org/licenses/bsd-license.php +/// +/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +/// +/// +/// + + +.text +.type AsmReadControlRegisterDcr, @function +.proc AsmReadControlRegisterDcr +// +// Reads control register DCR. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_DCR +// +// @return The 64-bit control register DCR. +// +AsmReadControlRegisterDcr:: + mov r8 = cr.dcr;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterDcr + + + +.text +.type AsmReadControlRegisterItm, @function +.proc AsmReadControlRegisterItm +// +// Reads control register ITM. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_ITM +// +// @return The 64-bit control register ITM. +// +AsmReadControlRegisterItm:: + mov r8 = cr.itm;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterItm + + + +.text +.type AsmReadControlRegisterIva, @function +.proc AsmReadControlRegisterIva +// +// Reads control register IVA. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_IVA +// +// @return The 64-bit control register IVA. +// +AsmReadControlRegisterIva:: + mov r8 = cr.iva;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterIva + + + +.text +.type AsmReadControlRegisterPta, @function +.proc AsmReadControlRegisterPta +// +// Reads control register PTA. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_PTA +// +// @return The 64-bit control register PTA. +// +AsmReadControlRegisterPta:: + mov r8 = cr.pta;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterPta + + + +.text +.type AsmReadControlRegisterIpsr, @function +.proc AsmReadControlRegisterIpsr +// +// Reads control register IPSR. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_IPSR +// +// @return The 64-bit control register IPSR. +// +AsmReadControlRegisterIpsr:: + mov r8 = cr.ipsr;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterIpsr + + + +.text +.type AsmReadControlRegisterIsr, @function +.proc AsmReadControlRegisterIsr +// +// Reads control register ISR. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_ISR +// +// @return The 64-bit control register ISR. +// +AsmReadControlRegisterIsr:: + mov r8 = cr.isr;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterIsr + + + +.text +.type AsmReadControlRegisterIip, @function +.proc AsmReadControlRegisterIip +// +// Reads control register IIP. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_IIP +// +// @return The 64-bit control register IIP. +// +AsmReadControlRegisterIip:: + mov r8 = cr.iip;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterIip + + + +.text +.type AsmReadControlRegisterIfa, @function +.proc AsmReadControlRegisterIfa +// +// Reads control register IFA. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_IFA +// +// @return The 64-bit control register IFA. +// +AsmReadControlRegisterIfa:: + mov r8 = cr.ifa;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterIfa + + + +.text +.type AsmReadControlRegisterItir, @function +.proc AsmReadControlRegisterItir +// +// Reads control register ITIR. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_ITIR +// +// @return The 64-bit control register ITIR. +// +AsmReadControlRegisterItir:: + mov r8 = cr.itir;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterItir + + + +.text +.type AsmReadControlRegisterIipa, @function +.proc AsmReadControlRegisterIipa +// +// Reads control register IIPA. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_IIPA +// +// @return The 64-bit control register IIPA. +// +AsmReadControlRegisterIipa:: + mov r8 = cr.iipa;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterIipa + + + +.text +.type AsmReadControlRegisterIfs, @function +.proc AsmReadControlRegisterIfs +// +// Reads control register IFS. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_IFS +// +// @return The 64-bit control register IFS. +// +AsmReadControlRegisterIfs:: + mov r8 = cr.ifs;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterIfs + + + +.text +.type AsmReadControlRegisterIim, @function +.proc AsmReadControlRegisterIim +// +// Reads control register IIM. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_IIM +// +// @return The 64-bit control register IIM. +// +AsmReadControlRegisterIim:: + mov r8 = cr.iim;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterIim + + + +.text +.type AsmReadControlRegisterIha, @function +.proc AsmReadControlRegisterIha +// +// Reads control register IHA. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_IHA +// +// @return The 64-bit control register IHA. +// +AsmReadControlRegisterIha:: + mov r8 = cr.iha;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterIha + + + +.text +.type AsmReadControlRegisterLid, @function +.proc AsmReadControlRegisterLid +// +// Reads control register LID. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_LID +// +// @return The 64-bit control register LID. +// +AsmReadControlRegisterLid:: + mov r8 = cr.lid;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterLid + + + +.text +.type AsmReadControlRegisterIvr, @function +.proc AsmReadControlRegisterIvr +// +// Reads control register IVR. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_IVR +// +// @return The 64-bit control register IVR. +// +AsmReadControlRegisterIvr:: + mov r8 = cr.ivr;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterIvr + + + +.text +.type AsmReadControlRegisterTpr, @function +.proc AsmReadControlRegisterTpr +// +// Reads control register TPR. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_TPR +// +// @return The 64-bit control register TPR. +// +AsmReadControlRegisterTpr:: + mov r8 = cr.tpr;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterTpr + + + +.text +.type AsmReadControlRegisterEoi, @function +.proc AsmReadControlRegisterEoi +// +// Reads control register EOI. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_EOI +// +// @return The 64-bit control register EOI. +// +AsmReadControlRegisterEoi:: + mov r8 = cr.eoi;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterEoi + + + +.text +.type AsmReadControlRegisterIrr0, @function +.proc AsmReadControlRegisterIrr0 +// +// Reads control register IRR0. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_IRR0 +// +// @return The 64-bit control register IRR0. +// +AsmReadControlRegisterIrr0:: + mov r8 = cr.irr0;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterIrr0 + + + +.text +.type AsmReadControlRegisterIrr1, @function +.proc AsmReadControlRegisterIrr1 +// +// Reads control register IRR1. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_IRR1 +// +// @return The 64-bit control register IRR1. +// +AsmReadControlRegisterIrr1:: + mov r8 = cr.irr1;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterIrr1 + + + +.text +.type AsmReadControlRegisterIrr2, @function +.proc AsmReadControlRegisterIrr2 +// +// Reads control register IRR2. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_IRR2 +// +// @return The 64-bit control register IRR2. +// +AsmReadControlRegisterIrr2:: + mov r8 = cr.irr2;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterIrr2 + + + +.text +.type AsmReadControlRegisterIrr3, @function +.proc AsmReadControlRegisterIrr3 +// +// Reads control register IRR3. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_IRR3 +// +// @return The 64-bit control register IRR3. +// +AsmReadControlRegisterIrr3:: + mov r8 = cr.irr3;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterIrr3 + + + +.text +.type AsmReadControlRegisterItv, @function +.proc AsmReadControlRegisterItv +// +// Reads control register ITV. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_ITV +// +// @return The 64-bit control register ITV. +// +AsmReadControlRegisterItv:: + mov r8 = cr.itv;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterItv + + + +.text +.type AsmReadControlRegisterPmv, @function +.proc AsmReadControlRegisterPmv +// +// Reads control register PMV. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_PMV +// +// @return The 64-bit control register PMV. +// +AsmReadControlRegisterPmv:: + mov r8 = cr.pmv;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterPmv + + + +.text +.type AsmReadControlRegisterCmcv, @function +.proc AsmReadControlRegisterCmcv +// +// Reads control register CMCV. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_CMCV +// +// @return The 64-bit control register CMCV. +// +AsmReadControlRegisterCmcv:: + mov r8 = cr.cmcv;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterCmcv + + + +.text +.type AsmReadControlRegisterLrr0, @function +.proc AsmReadControlRegisterLrr0 +// +// Reads control register LRR0. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_LRR0 +// +// @return The 64-bit control register LRR0. +// +AsmReadControlRegisterLrr0:: + mov r8 = cr.lrr0;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterLrr0 + + + +.text +.type AsmReadControlRegisterLrr1, @function +.proc AsmReadControlRegisterLrr1 +// +// Reads control register LRR1. +// +// This is a worker function for AsmReadControlRegister() +// when its parameter Index is IPF_CONTROL_REGISTER_LRR1 +// +// @return The 64-bit control register LRR1. +// +AsmReadControlRegisterLrr1:: + mov r8 = cr.lrr1;; + br.ret.dpnt b0;; +.endp AsmReadControlRegisterLrr1 +