+++ /dev/null
-/// @file\r
-/// IPF specific control register reading functions\r
-///\r
-/// Copyright (c) 2008, Intel Corporation. All rights reserved.<BR>\r
-/// This program and the accompanying materials\r
-/// are licensed and made available under the terms and conditions of the BSD License\r
-/// which accompanies this distribution. The full text of the license may be found at\r
-/// http://opensource.org/licenses/bsd-license.php.\r
-///\r
-/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-///\r
-///\r
-///\r
-\r
-\r
-\r
-//---------------------------------------------------------------------------------\r
-//++\r
-// AsmReadControlRegister\r
-//\r
-// Reads a 64-bit control register.\r
-//\r
-// Reads and returns the control register specified by Index.\r
-// If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only available on IPF.\r
-//\r
-// Arguments :\r
-//\r
-// On Entry : The index of the control register to read.\r
-//\r
-// Return Value: The control register specified by Index.\r
-//\r
-//--\r
-//----------------------------------------------------------------------------------\r
-.text\r
-.type AsmReadControlRegister, @function\r
-.proc AsmReadControlRegister\r
-.regstk 1, 0, 0, 0\r
-\r
-AsmReadControlRegister::\r
- //\r
- // CRs are defined in the ranges 0-25 and 64-81 (with some holes).\r
- // Compact this list by subtracting 32 from the top range.\r
- // 0-25, 64-81 -> 0-25, 32-49\r
- //\r
- mov r15=2\r
- mov r14=pr // save predicates\r
- cmp.leu p6,p7=64,in0 // p6 = CR# >= 64\r
- ;;\r
- (p7) cmp.leu p7,p0=32,in0 // p7 = 32 <= CR# < 64\r
- (p6) add in0=-32,in0 // if (CR >= 64) CR# -= 32\r
- ;;\r
- (p7) mov r15=0 // if bad range (32-63)\r
- ;;\r
- mov ret0=-1 // in case of illegal CR #\r
- shl r15=r15,in0 // r15 = 0x2 << CR#\r
- ;;\r
- mov pr=r15,-1\r
- ;;\r
-\r
- //\r
- // At this point the predicates contain a bit field of the\r
- // CR desired. (The bit is the CR+1, since pr0 is always 1.)\r
- //\r
- .pred.rel "mutex",p1,p2,p3,p9,p17,p18,p20,p21,p22,p23,p24,p25,p26,\\r
- p33,p34,p35,p36,p37,p38,p39,p40,p41,p42,p43,p49,p50\r
- (p1) mov ret0=cr.dcr // cr0\r
- (p2) mov ret0=cr.itm // cr1\r
- (p3) mov ret0=cr.iva // cr2\r
- (p9) mov ret0=cr.pta // cr8\r
- (p17) mov ret0=cr.ipsr // cr16\r
- (p18) mov ret0=cr.isr // cr17\r
- (p20) mov ret0=cr.iip // cr19\r
- (p21) mov ret0=cr.ifa // cr20\r
- (p22) mov ret0=cr.itir // cr21\r
- (p23) mov ret0=cr.iipa // cr22\r
- (p24) mov ret0=cr.ifs // cr23\r
- (p25) mov ret0=cr.iim // cr24\r
- (p26) mov ret0=cr.iha // cr25\r
-\r
- // This is the translated (-32) range.\r
-\r
- (p33) mov ret0=cr.lid // cr64\r
- (p34) mov ret0=cr.ivr // cr65\r
- (p35) mov ret0=cr.tpr // cr66\r
- (p36) mov ret0=cr.eoi // cr67\r
- (p37) mov ret0=cr.irr0 // cr68\r
- (p38) mov ret0=cr.irr1 // cr69\r
- (p39) mov ret0=cr.irr2 // cr70\r
- (p40) mov ret0=cr.irr3 // cr71\r
- (p41) mov ret0=cr.itv // cr72\r
- (p42) mov ret0=cr.pmv // cr73\r
- (p43) mov ret0=cr.cmcv // cr74\r
- (p49) mov ret0=cr.lrr0 // cr80\r
- (p50) mov ret0=cr.lrr1 // cr81\r
- \r
- //\r
- // Restore predicates and return.\r
- //\r
- mov pr=r14,-1\r
- br.ret.sptk b0\r
- .endp\r