From: gtian Date: Mon, 14 May 2007 06:36:58 +0000 (+0000) Subject: git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2589 6f19259b... X-Git-Tag: edk2-stable201903~23311 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=8e38ef0a9c97889807e40e2298728cfe0d6db3af git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2589 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdePkg/Library/BaseLib/Ipf/AccessDbr.s b/MdePkg/Library/BaseLib/Ipf/AccessDbr.s new file mode 100644 index 0000000000..49d1fecbbf --- /dev/null +++ b/MdePkg/Library/BaseLib/Ipf/AccessDbr.s @@ -0,0 +1,118 @@ +/// @file +/// IPF specific Debug Breakpoint Registers accessing functions +/// +/// 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: AccessDbr.s +/// +/// + +//--------------------------------------------------------------------------------- +//++ +// AsmReadDbr +// +// This routine is used to Reads the current value of Data Breakpoint Register (DBR). +// +// Arguments : +// +// On Entry : The 8-bit DBR index to read. +// +// Return Value: The current value of DBR by Index. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadDbr, @function +.proc AsmReadDbr +.regstk 1, 0, 0, 0 + +AsmReadDbr:: + mov r8 = dbr[in0];; + br.ret.dpnt b0;; +.endp AsmReadDbr + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteDbr +// +// This routine is used to write the current value to Data Breakpoint Register (DBR). +// +// Arguments : +// +// On Entry : The 8-bit DBR index to read. +// The value should be written to DBR +// +// Return Value: The value written to DBR. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteDbr, @function +.proc AsmWriteDbr +.regstk 2, 0, 0, 0 + +AsmWriteDbr:: + mov dbr[in0] = in1 + mov r8 = in1;; + srlz.d;; + br.ret.dpnt b0;; +.endp AsmWriteDbr + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadIbr +// +// This routine is used to Reads the current value of Instruction Breakpoint Register (IBR). +// +// Arguments : +// +// On Entry : The 8-bit IBR index. +// +// Return Value: The current value of IBR by Index. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadIbr, @function +.proc AsmReadIbr +.regstk 1, 0, 0, 0 + +AsmReadIbr:: + mov r8 = ibr[in0];; + br.ret.dpnt b0;; +.endp AsmReadIbr + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteIbr +// +// This routine is used to write the current value to Instruction Breakpoint Register (IBR). +// +// Arguments : +// +// On Entry : The 8-bit IBR index. +// The value should be written to IBR +// +// Return Value: The value written to IBR. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteIbr, @function +.proc AsmWriteIbr +.regstk 2, 0, 0, 0 + +AsmWriteIbr:: + mov ibr[in0] = in1 + mov r8 = in1;; + srlz.i;; + br.ret.dpnt b0;; +.endp AsmWriteIbr diff --git a/MdePkg/Library/BaseLib/Ipf/AccessEicr.s b/MdePkg/Library/BaseLib/Ipf/AccessEicr.s new file mode 100644 index 0000000000..03d7e034f8 --- /dev/null +++ b/MdePkg/Library/BaseLib/Ipf/AccessEicr.s @@ -0,0 +1,512 @@ +/// @file +/// IPF specific External Interrupt Control Registers accessing functions +/// +/// 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: AccessEicr.s +/// +/// + +//--------------------------------------------------------------------------------- +//++ +// AsmReadLid +// +// This routine is used to read the value of Local Interrupt ID Register (LID). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of LID. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadLid, @function +.proc AsmReadLid + +AsmReadLid:: + mov r8 = cr.lid;; + srlz.d;; + br.ret.dpnt b0;; +.endp AsmReadLid + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteLid +// +// This routine is used to write the value to Local Interrupt ID Register (LID). +// +// Arguments : +// +// On Entry : The value need to be written to LID. +// +// Return Value: The value written to LID. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteLid, @function +.proc AsmWriteLid +.regstk 1, 0, 0, 0 + +AsmWriteLid:: + mov cr.lid = in0 + mov r8 = in0;; + srlz.d;; + br.ret.dpnt b0;; +.endp AsmWriteLid + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadIvr +// +// This routine is used to read the value of External Interrupt Vector Register (IVR). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of IVR. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadIvr, @function +.proc AsmReadIvr + +AsmReadIvr:: + mov r8 = cr.ivr;; + srlz.d;; + br.ret.dpnt b0;; +.endp AsmReadIvr + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadTpr +// +// This routine is used to read the value of Task Priority Register (TPR). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of TPR. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadTpr, @function +.proc AsmReadTpr + +AsmReadTpr:: + mov r8 = cr.tpr;; + br.ret.dpnt b0;; +.endp AsmReadTpr + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteTpr +// +// This routine is used to write the value to Task Priority Register (TPR). +// +// Arguments : +// +// On Entry : The value need to be written to TPR. +// +// Return Value: The value written to TPR. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteTpr, @function +.proc AsmWriteTpr +.regstk 1, 0, 0, 0 + +AsmWriteTpr:: + mov cr.tpr = in0 + mov r8 = in0;; + srlz.d;; + br.ret.dpnt b0;; +.endp AsmWriteTpr + + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteEoi +// +// This routine is used to write the value to End of External Interrupt Register (EOI). +// +// Arguments : +// +// On Entry : The value need to be written to EOI. +// +// Return Value: The value written to EOI. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteEoi, @function +.proc AsmWriteEoi + +AsmWriteEoi:: + mov cr.eoi = r0;; + srlz.d;; + br.ret.dpnt b0;; +.endp AsmWriteEoi + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadIrr0 +// +// This routine is used to Read the value of External Interrupt Request Register 0 (IRR0). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of IRR0. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadIrr0, @function +.proc AsmReadIrr0 + +AsmReadIrr0:: + mov r8 = cr.irr0;; + br.ret.dpnt b0;; +.endp AsmReadIrr0 + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadIrr1 +// +// This routine is used to Read the value of External Interrupt Request Register 1 (IRR1). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of IRR1. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadIrr1, @function +.proc AsmReadIrr1 + +AsmReadIrr1:: + mov r8 = cr.irr1;; + br.ret.dpnt b0;; +.endp AsmReadIrr1 + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadIrr2 +// +// This routine is used to Read the value of External Interrupt Request Register 2 (IRR2). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of IRR2. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadIrr2, @function +.proc AsmReadIrr2 + +AsmReadIrr2:: + mov r8 = cr.irr2;; + br.ret.dpnt b0;; +.endp AsmReadIrr2 + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadIrr3 +// +// This routine is used to Read the value of External Interrupt Request Register 3 (IRR3). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of IRR3. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadIrr3, @function +.proc AsmReadIrr3 + +AsmReadIrr3:: + mov r8 = cr.irr3;; + br.ret.dpnt b0;; +.endp AsmReadIrr3 + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadItv +// +// This routine is used to Read the value of Interval Timer Vector Register (ITV). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of ITV. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadItv, @function +.proc AsmReadItv + +AsmReadItv:: + mov r8 = cr.itv;; + br.ret.dpnt b0;; +.endp AsmReadItv + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteItv +// +// This routine is used to write the value to Interval Timer Vector Register (ITV). +// +// Arguments : +// +// On Entry : The value need to be written to ITV +// +// Return Value: The value written to ITV. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteItv, @function +.proc AsmWriteItv +.regstk 1, 0, 0, 0 + +AsmWriteItv:: + mov cr.itv = in0 + mov r8 = in0;; + srlz.d;; + br.ret.dpnt b0;; +.endp AsmWriteItv + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadPmv +// +// This routine is used to Read the value of Performance Monitoring Vector Register (PMV). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of PMV. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadPmv, @function +.proc AsmReadPmv + +AsmReadPmv:: + mov r8 = cr.pmv;; + br.ret.dpnt b0;; +.endp AsmReadPmv + +//--------------------------------------------------------------------------------- +//++ +// AsmWritePmv +// +// This routine is used to write the value to Performance Monitoring Vector Register (PMV). +// +// Arguments : +// +// On Entry : The value need to be written to PMV +// +// Return Value: The value written to PMV. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWritePmv, @function +.proc AsmWritePmv +.regstk 1, 0, 0, 0 + +AsmWritePmv:: + mov cr.pmv = in0 + mov r8 = in0;; + srlz.d;; + br.ret.dpnt b0;; +.endp AsmWritePmv + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadCmcv +// +// This routine is used to Read the value of Corrected Machine Check Vector Register (CMCV). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of CMCV. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadCmcv, @function +.proc AsmReadCmcv + +AsmReadCmcv:: + mov r8 = cr.cmcv;; + br.ret.dpnt b0;; +.endp AsmReadCmcv + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteCmcv +// +// This routine is used to write the value to Corrected Machine Check Vector Register (CMCV). +// +// Arguments : +// +// On Entry : The value need to be written to CMCV +// +// Return Value: The value written to CMCV. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteCmcv, @function +.proc AsmWriteCmcv +.regstk 1, 0, 0, 0 + +AsmWriteCmcv:: + mov cr.cmcv = in0 + mov r8 = in0;; + srlz.d;; + br.ret.dpnt b0;; +.endp AsmWriteCmcv + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadLrr0 +// +// This routine is used to read the value of Local Redirection Register 0 (LRR0). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of LRR0. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadLrr0, @function +.proc AsmReadLrr0 + +AsmReadLrr0:: + mov r8 = cr.lrr0;; + br.ret.dpnt b0;; +.endp AsmReadLrr0 + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteLrr0 +// +// This routine is used to write the value to Local Redirection Register 0 (LRR0). +// +// Arguments : +// +// On Entry : The value need to be written to LRR0. +// +// Return Value: The value written to LRR0. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteLrr0, @function +.proc AsmWriteLrr0 +.regstk 1, 0, 0, 0 + +AsmWriteLrr0:: + mov cr.lrr0 = in0 + mov r8 = in0;; + srlz.d;; + br.ret.dpnt b0;; +.endp AsmWriteLrr0 + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadLrr1 +// +// This routine is used to read the value of Local Redirection Register 1 (LRR1). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of LRR1. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadLrr1, @function +.proc AsmReadLrr1 + +AsmReadLrr1:: + mov r8 = cr.lrr1;; + br.ret.dpnt b0;; +.endp AsmReadLrr1 + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteLrr1 +// +// This routine is used to write the value to Local Redirection Register 1 (LRR1). +// +// Arguments : +// +// On Entry : The value need to be written to LRR1. +// +// Return Value: The value written to LRR1. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteLrr1, @function +.proc AsmWriteLrr1 +.regstk 1, 0, 0, 0 + +AsmWriteLrr1:: + mov cr.lrr1 = in0 + mov r8 = in0;; + srlz.d;; + br.ret.dpnt b0;; +.endp AsmWriteLrr1 + diff --git a/MdePkg/Library/BaseLib/Ipf/AccessGcr.s b/MdePkg/Library/BaseLib/Ipf/AccessGcr.s new file mode 100644 index 0000000000..54b3a30a6d --- /dev/null +++ b/MdePkg/Library/BaseLib/Ipf/AccessGcr.s @@ -0,0 +1,264 @@ +/// @file +/// IPF specific Global Control Registers accessing functions +/// +/// 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: AccessGcr.s +/// +/// + +//--------------------------------------------------------------------------------- +//++ +// AsmReadDcr +// +// This routine is used to Read the value of Default Control Register (DCR). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of DCR. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadDcr, @function +.proc AsmReadDcr + +AsmReadDcr:: + mov r8 = cr.dcr;; + br.ret.dpnt b0;; +.endp AsmReadDcr + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteDcr +// +// This routine is used to write the value to Default Control Register (DCR). +// +// Arguments : +// +// On Entry : The value need to be written to DCR +// +// Return Value: The value written to DCR. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteDcr, @function +.proc AsmWriteDcr +.regstk 1, 0, 0, 0 + +AsmWriteDcr:: + mov cr.dcr = in0 + mov r8 = in0;; + srlz.i;; + srlz.d;; + br.ret.dpnt b0;; +.endp AsmWriteDcr + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadItc +// +// This routine is used to Read the value of Interval Timer Counter Register (ITC). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of ITC. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadItc, @function +.proc AsmReadItc + +AsmReadItc:: + mov r8 = ar.itc;; + br.ret.dpnt b0;; +.endp AsmReadItc + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteItc +// +// This routine is used to write the value to Interval Timer Counter Register (ITC). +// +// Arguments : +// +// On Entry : The value need to be written to the ITC +// +// Return Value: The value written to the ITC. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteItc, @function +.proc AsmWriteItc +.regstk 1, 0, 0, 0 + +AsmWriteItc:: + mov ar.itc = in0 + mov r8 = in0;; + br.ret.dpnt b0;; +.endp AsmWriteItc + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadItm +// +// This routine is used to Read the value of Interval Timer Match Register (ITM). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of ITM. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadItm, @function +.proc AsmReadItm + +AsmReadItm:: + mov r8 = cr.itm;; + br.ret.dpnt b0;; +.endp AsmReadItm + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteItm +// +// This routine is used to write the value to Interval Timer Match Register (ITM). +// +// Arguments : +// +// On Entry : The value need to be written to ITM +// +// Return Value: The value written to ITM. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteItm, @function +.proc AsmWriteItm +.regstk 1, 0, 0, 0 + +AsmWriteItm:: + mov cr.itm = in0 + mov r8 = in0;; + srlz.d; + br.ret.dpnt b0;; +.endp AsmWriteItm + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadIva +// +// This routine is used to read the value of Interruption Vector Address Register (IVA). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of IVA. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadIva, @function +.proc AsmReadIva + +AsmReadIva:: + mov r8 = cr.iva;; + br.ret.dpnt b0;; +.endp AsmReadIva + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteIva +// +// This routine is used to write the value to Interruption Vector Address Register (IVA). +// +// Arguments : +// +// On Entry : The value need to be written to IVA +// +// Return Value: The value written to IVA. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteIva, @function +.proc AsmWriteIva +.regstk 1, 0, 0, 0 + +AsmWriteIva:: + mov cr.iva = in0 + mov r8 = in0;; + br.ret.dpnt b0;; +.endp AsmWriteIva + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadPta +// +// This routine is used to read the value of Page Table Address Register (PTA). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current value of PTA. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadPta, @function +.proc AsmReadPta + +AsmReadPta:: + mov r8 = cr.pta;; + br.ret.dpnt b0;; +.endp AsmReadPta + +//--------------------------------------------------------------------------------- +//++ +// AsmWritePta +// +// This routine is used to write the value to Page Table Address Register (PTA)). +// +// Arguments : +// +// On Entry : The value need to be written to PTA +// +// Return Value: The value written to PTA. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWritePta, @function +.proc AsmWritePta +.regstk 1, 0, 0, 0 + +AsmWritePta:: + mov cr.pta = in0 + mov r8 = in0;; + srlz.i;; + srlz.d;; + br.ret.dpnt b0;; +.endp AsmWritePta \ No newline at end of file diff --git a/MdePkg/Library/BaseLib/Ipf/AccessGp.s b/MdePkg/Library/BaseLib/Ipf/AccessGp.s new file mode 100644 index 0000000000..5c5f20f584 --- /dev/null +++ b/MdePkg/Library/BaseLib/Ipf/AccessGp.s @@ -0,0 +1,86 @@ +/// @file +/// IPF specific Global Pointer and Stack Pointer accessing functions +/// +/// 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: AccessGp.s +/// +/// + +//--------------------------------------------------------------------------------- +//++ +// AsmReadGp +// +// This routine is used to read the current value of 64-bit Global Pointer (GP). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current GP value. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadGp, @function +.proc AsmReadGp + +AsmReadGp:: + mov r8 = gp;; + br.ret.dpnt b0;; +.endp AsmReadGp + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteGp +// +// This routine is used to write the current value of 64-bit Global Pointer (GP). +// +// Arguments : +// +// On Entry : The value need to be written. +// +// Return Value: The value have been written. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteGp, @function +.proc AsmWriteGp +.regstk 1, 0, 0, 0 + +AsmWriteGp:: + mov gp = in0 + mov r8 = in0;; + br.ret.dpnt b0;; +.endp AsmWriteGp + +//--------------------------------------------------------------------------------- +//++ +// AsmReadSp +// +// This routine is used to read the current value of 64-bit Stack Pointer (SP). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current SP value. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadSp, @function +.proc AsmReadSp + +AsmReadSp:: + mov r8 = sp;; + br.ret.dpnt b0;; +.endp AsmReadSp diff --git a/MdePkg/Library/BaseLib/Ipf/AccessKr.s b/MdePkg/Library/BaseLib/Ipf/AccessKr.s new file mode 100644 index 0000000000..5a38954292 --- /dev/null +++ b/MdePkg/Library/BaseLib/Ipf/AccessKr.s @@ -0,0 +1,400 @@ +/// @file +/// IPF specific AsmReadKrX() and AsmWriteKrX functions, 'X' is from '0' to '7' +/// +/// 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: AccessKr.s +/// +/// + +//--------------------------------------------------------------------------------- +//++ +// AsmReadKr0 +// +// This routine is used to get KR0. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value store in KR0. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadKr0, @function +.proc AsmReadKr0 + +AsmReadKr0:: + mov r8 = ar.k0;; + br.ret.dpnt b0;; +.endp AsmReadKr0 + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteKr0 +// +// This routine is used to Write KR0. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value written to the KR0. +// +//-- +//---------------------------------------------------------------------------------- + +.text +.type AsmWriteKr0, @function +.proc AsmWriteKr0 +.regstk 1, 0, 0, 0 + +AsmWriteKr0:: + mov ar.k0 = in0 + mov r8 = in0;; + br.ret.dpnt b0;; +.endp AsmWriteKr0 + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadKr1 +// +// This routine is used to get KR1. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value store in KR1. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadKr1, @function +.proc AsmReadKr1 + +AsmReadKr1:: + mov r8 = ar.k1;; + br.ret.dpnt b0;; +.endp AsmReadKr1 + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteKr1 +// +// This routine is used to Write KR1. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value written to the KR1. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteKr1, @function +.proc AsmWriteKr1 + +AsmWriteKr1:: + mov ar.k1 = in0 + mov r8 = in0;; + br.ret.dpnt b0;; +.endp AsmWriteKr1 + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadKr2 +// +// This routine is used to get KR2. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value store in KR2. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadKr2, @function +.proc AsmReadKr2 + +AsmReadKr2:: + mov r8 = ar.k2;; + br.ret.dpnt b0;; +.endp AsmReadKr2 + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteKr2 +// +// This routine is used to Write KR2. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value written to the KR2. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteKr2, @function +.proc AsmWriteKr2 + +AsmWriteKr2:: + mov ar.k2 = in0 + mov r8 = in0;; + br.ret.dpnt b0;; +.endp AsmWriteKr2 + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadKr3 +// +// This routine is used to get KR3. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value store in KR3. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadKr3, @function +.proc AsmReadKr3 + +AsmReadKr3:: + mov r8 = ar.k3;; + br.ret.dpnt b0;; +.endp AsmReadKr3 + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteKr3 +// +// This routine is used to Write KR3. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value written to the KR3. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteKr3, @function +.proc AsmWriteKr3 + +AsmWriteKr3:: + mov ar.k3 = in0 + mov r8 = in0;; + br.ret.dpnt b0;; +.endp AsmWriteKr3 + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadKr4 +// +// This routine is used to get KR4. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value store in KR4. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadKr4, @function +.proc AsmReadKr4 + +AsmReadKr4:: + mov r8 = ar.k4;; + br.ret.dpnt b0;; +.endp AsmReadKr4 + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteKr4 +// +// This routine is used to Write KR4. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value written to the KR4. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteKr4, @function +.proc AsmWriteKr4 + +AsmWriteKr4:: + mov ar.k4 = in0 + mov r8 = in0;; + br.ret.dpnt b0;; +.endp AsmWriteKr4 + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadKr5 +// +// This routine is used to get KR5. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value store in KR5. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadKr5, @function +.proc AsmReadKr5 + +AsmReadKr5:: + mov r8 = ar.k5;; + br.ret.dpnt b0;; +.endp AsmReadKr5 + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteKr5 +// +// This routine is used to Write KR5. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value written to the KR5. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteKr5, @function +.proc AsmWriteKr5 + +AsmWriteKr5:: + mov ar.k5 = in0 + mov r8 = in0;; + br.ret.dpnt b0;; +.endp AsmWriteKr5 + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadKr6 +// +// This routine is used to get KR6. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value store in KR6. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadKr6, @function +.proc AsmReadKr6 + +AsmReadKr6:: + mov r8 = ar.k6;; + br.ret.dpnt b0;; +.endp AsmReadKr6 + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteKr6 +// +// This routine is used to write KR6. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value written to the KR6. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteKr6, @function +.proc AsmWriteKr6 + +AsmWriteKr6:: + mov ar.k6 = in0 + mov r8 = in0;; + br.ret.dpnt b0;; +.endp AsmWriteKr6 + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadKr7 +// +// This routine is used to get KR7. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value store in KR7. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadKr7, @function +.proc AsmReadKr7 + +AsmReadKr7:: + mov r8 = ar.k7;; + br.ret.dpnt b0;; +.endp AsmReadKr7 + +//--------------------------------------------------------------------------------- +//++ +// AsmWriteKr7 +// +// This routine is used to write KR7. +// +// Arguments : +// +// On Entry : None. +// +// Return Value: The value written to the KR7. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWriteKr7, @function +.proc AsmWriteKr7 + +AsmWriteKr7:: + mov ar.k7 = in0 + mov r8 = in0;; + br.ret.dpnt b0;; +.endp AsmWriteKr7 diff --git a/MdePkg/Library/BaseLib/Ipf/AccessPmr.s b/MdePkg/Library/BaseLib/Ipf/AccessPmr.s new file mode 100644 index 0000000000..cea376c638 --- /dev/null +++ b/MdePkg/Library/BaseLib/Ipf/AccessPmr.s @@ -0,0 +1,124 @@ +/// @file +/// IPF specific Performance Monitor Configuration/Data Registers accessing functions +/// +/// 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: AccessPmr.s +/// +/// + +//--------------------------------------------------------------------------------- +//++ +// AsmReadPmc +// +// This routine is used to Reads the current value of Performance Monitor Configuration Register (PMC). +// +// Arguments : +// +// On Entry : The 8-bit PMC index. +// +// Return Value: The current value of PMC by Index. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadPmc, @function +.proc AsmReadPmc +.regstk 1, 0, 0, 0 + +AsmReadPmc:: + srlz.i;; + srlz.d;; + mov r8 = pmc[in0];; + br.ret.dpnt b0;; +.endp AsmReadPmc + +//--------------------------------------------------------------------------------- +//++ +// AsmWritePmc +// +// This routine is used to write the current value to a Performance Monitor Configuration Register (PMC). +// +// Arguments : +// +// On Entry : The 8-bit PMC index. +// The value should be written to PMC +// +// Return Value: The value written to PMC. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWritePmc, @function +.proc AsmWritePmc +.regstk 2, 0, 0, 0 + +AsmWritePmc:: + mov pmc[in0] = in1 + mov r8 = in1;; + srlz.i;; + srlz.d;; + br.ret.dpnt b0;; +.endp AsmWritePmc + + +//--------------------------------------------------------------------------------- +//++ +// AsmReadPmd +// +// This routine is used to Reads the current value of Performance Monitor Data Register (PMD). +// +// Arguments : +// +// On Entry : The 8-bit PMD index. +// +// Return Value: The current value of PMD by Index. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadPmd, @function +.proc AsmReadPmd +.regstk 1, 0, 0, 0 + +AsmReadPmd:: + srlz.i;; + srlz.d;; + mov r8 = pmd[in0];; + br.ret.dpnt b0;; +.endp AsmReadPmd + +//--------------------------------------------------------------------------------- +//++ +// AsmWritePmd +// +// This routine is used to write the current value to Performance Monitor Data Register (PMD). +// +// Arguments : +// +// On Entry : The 8-bit PMD index. +// The value should be written to PMD +// +// Return Value: The value written to PMD. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWritePmd, @function +.proc AsmWritePmd +.regstk 2, 0, 0, 0 + +AsmWritePmd:: + mov pmd[in0] = in1 + mov r8 = in1;; + srlz.i;; + srlz.d;; + br.ret.dpnt b0;; +.endp AsmWritePmd diff --git a/MdePkg/Library/BaseLib/Ipf/AccessPsr.s b/MdePkg/Library/BaseLib/Ipf/AccessPsr.s new file mode 100644 index 0000000000..9b4fe49ff1 --- /dev/null +++ b/MdePkg/Library/BaseLib/Ipf/AccessPsr.s @@ -0,0 +1,110 @@ +/// @file +/// IPF specific Processor Status Register accessing functions +/// +/// 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: AccessPsr.s +/// +/// + +#define CpuModeMask 0x0000001008020000 + +#define CpuInVirtualMode 0x1 +#define CpuInPhysicalMode 0x0 +#define CpuInMixMode (0x0 - 0x1) + +//--------------------------------------------------------------------------------- +//++ +// AsmReadPsr +// +// This routine is used to read the current value of Processor Status Register (PSR). +// +// Arguments : +// +// On Entry : +// +// Return Value: The current PSR value. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmReadPsr, @function +.proc AsmReadPsr + +AsmReadPsr:: + mov r8 = psr;; + br.ret.dpnt b0;; +.endp AsmReadPsr + +//--------------------------------------------------------------------------------- +//++ +// AsmWritePsr +// +// This routine is used to write the value of Processor Status Register (PSR). +// +// Arguments : +// +// On Entry : The value need to be written. +// +// Return Value: The value have been written. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmWritePsr, @function +.proc AsmWritePsr +.regstk 1, 0, 0, 0 + +AsmWritePsr:: + mov psr.l = in0 + mov r8 = in0;; + srlz.d;; + srlz.i;; + br.ret.dpnt b0;; +.endp AsmWritePsr + +//--------------------------------------------------------------------------------- +//++ +// AsmCpuVirtual +// +// This routine is used to determines if the CPU is currently executing +// in virtual, physical, or mixed mode. +// +// If the CPU is in virtual mode(PSR.RT=1, PSR.DT=1, PSR.IT=1), then 1 is returned. +// If the CPU is in physical mode(PSR.RT=0, PSR.DT=0, PSR.IT=0), then 0 is returned. +// If the CPU is not in physical mode or virtual mode, then it is in mixed mode, +// and -1 is returned. +// +// Arguments: +// +// On Entry: None +// +// Return Value: The CPU mode flag +// return 1 The CPU is in virtual mode. +// return 0 The CPU is in physical mode. +// return -1 The CPU is in mixed mode. +// +//-- +//---------------------------------------------------------------------------------- +.text +.type AsmCpuVirtual, @function +.proc AsmCpuVirtual + +AsmCpuVirtual:: + mov r29 = psr + movl r30 = CpuModeMask;; + and r28 = r30, r29;; + cmp.eq p6, p7 = r30, r28;; +(p6) mov r8 = CpuInVirtualMode;; +(p7) cmp.eq p6, p7 = 0x0, r28;; +(p6) mov r8 = CpuInPhysicalMode;; +(p7) mov r8 = CpuInMixMode;; + br.ret.dpnt b0;; +.endp AsmCpuVirtual \ No newline at end of file