/// @file\r
/// IPF specific application register reading functions\r
///\r
-/// Copyright (c) 2008, Intel Corporation\r
-/// All rights reserved. This program and the accompanying materials\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
\r
\r
-.text\r
-.type AsmReadApplicationRegisterK0, @function\r
-.proc AsmReadApplicationRegisterK0\r
-//\r
-// Reads appplication register K0.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_K0\r
-//\r
-// @return The 64-bit application register K0.\r
-//\r
-AsmReadApplicationRegisterK0::\r
- mov r8 = ar.k0;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterK0\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterK1, @function\r
-.proc AsmReadApplicationRegisterK1\r
-//\r
-// Reads appplication register K1.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_K1\r
-//\r
-// @return The 64-bit application register K1.\r
-//\r
-AsmReadApplicationRegisterK1::\r
- mov r8 = ar.k1;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterK1\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterK2, @function\r
-.proc AsmReadApplicationRegisterK2\r
-//\r
-// Reads appplication register K2.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_K2\r
-//\r
-// @return The 64-bit application register K2.\r
-//\r
-AsmReadApplicationRegisterK2::\r
- mov r8 = ar.k2;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterK2\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterK3, @function\r
-.proc AsmReadApplicationRegisterK3\r
-//\r
-// Reads appplication register K3.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_K3\r
-//\r
-// @return The 64-bit application register K3.\r
-//\r
-AsmReadApplicationRegisterK3::\r
- mov r8 = ar.k3;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterK3\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterK4, @function\r
-.proc AsmReadApplicationRegisterK4\r
-//\r
-// Reads appplication register K4.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_K4\r
-//\r
-// @return The 64-bit application register K4.\r
-//\r
-AsmReadApplicationRegisterK4::\r
- mov r8 = ar.k4;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterK4\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterK5, @function\r
-.proc AsmReadApplicationRegisterK5\r
-//\r
-// Reads appplication register K5.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_K5\r
-//\r
-// @return The 64-bit application register K5.\r
-//\r
-AsmReadApplicationRegisterK5::\r
- mov r8 = ar.k5;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterK5\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterK6, @function\r
-.proc AsmReadApplicationRegisterK6\r
-//\r
-// Reads appplication register K6.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_K6\r
-//\r
-// @return The 64-bit application register K6.\r
-//\r
-AsmReadApplicationRegisterK6::\r
- mov r8 = ar.k6;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterK6\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterK7, @function\r
-.proc AsmReadApplicationRegisterK7\r
-//\r
-// Reads appplication register K7.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_K7\r
-//\r
-// @return The 64-bit application register K7.\r
-//\r
-AsmReadApplicationRegisterK7::\r
- mov r8 = ar.k7;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterK7\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterRsc, @function\r
-.proc AsmReadApplicationRegisterRsc\r
-//\r
-// Reads appplication register RSC.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_RSC\r
-//\r
-// @return The 64-bit application register RSC.\r
-//\r
-AsmReadApplicationRegisterRsc::\r
- mov r8 = ar.rsc;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterRsc\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterBsp, @function\r
-.proc AsmReadApplicationRegisterBsp\r
-//\r
-// Reads appplication register BSP.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_BSP\r
-//\r
-// @return The 64-bit application register BSP.\r
-//\r
-AsmReadApplicationRegisterBsp::\r
- mov r8 = ar.bsp;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterBsp\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterBspstore, @function\r
-.proc AsmReadApplicationRegisterBspstore\r
-//\r
-// Reads appplication register BSPSTORE.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_BSPSTORE\r
-//\r
-// @return The 64-bit application register BSPSTORE.\r
-//\r
-AsmReadApplicationRegisterBspstore::\r
- mov r8 = ar.bspstore;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterBspstore\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterRnat, @function\r
-.proc AsmReadApplicationRegisterRnat\r
-//\r
-// Reads appplication register RNAT.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_RNAT\r
-//\r
-// @return The 64-bit application register RNAT.\r
-//\r
-AsmReadApplicationRegisterRnat::\r
- mov r8 = ar.rnat;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterRnat\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterFcr, @function\r
-.proc AsmReadApplicationRegisterFcr\r
-//\r
-// Reads appplication register FCR.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_FCR\r
-//\r
-// @return The 64-bit application register FCR.\r
-//\r
-AsmReadApplicationRegisterFcr::\r
- mov r8 = ar.fcr;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterFcr\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterEflag, @function\r
-.proc AsmReadApplicationRegisterEflag\r
-//\r
-// Reads appplication register EFLAG.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_EFLAG\r
-//\r
-// @return The 64-bit application register EFLAG.\r
-//\r
-AsmReadApplicationRegisterEflag::\r
- mov r8 = ar.eflag;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterEflag\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterCsd, @function\r
-.proc AsmReadApplicationRegisterCsd\r
-//\r
-// Reads appplication register CSD.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_CSD\r
-//\r
-// @return The 64-bit application register CSD.\r
-//\r
-AsmReadApplicationRegisterCsd::\r
- mov r8 = ar.csd;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterCsd\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterSsd, @function\r
-.proc AsmReadApplicationRegisterSsd\r
-//\r
-// Reads appplication register SSD.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_SSD\r
-//\r
-// @return The 64-bit application register SSD.\r
-//\r
-AsmReadApplicationRegisterSsd::\r
- mov r8 = ar.ssd;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterSsd\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterCflg, @function\r
-.proc AsmReadApplicationRegisterCflg\r
-//\r
-// Reads appplication register CFLG.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_CFLG\r
-//\r
-// @return The 64-bit application register CFLG.\r
-//\r
-AsmReadApplicationRegisterCflg::\r
- mov r8 = ar.cflg;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterCflg\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterFsr, @function\r
-.proc AsmReadApplicationRegisterFsr\r
-//\r
-// Reads appplication register FSR.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_FSR\r
-//\r
-// @return The 64-bit application register FSR.\r
-//\r
-AsmReadApplicationRegisterFsr::\r
- mov r8 = ar.fsr;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterFsr\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterFir, @function\r
-.proc AsmReadApplicationRegisterFir\r
-//\r
-// Reads appplication register FIR.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_FIR\r
-//\r
-// @return The 64-bit application register FIR.\r
-//\r
-AsmReadApplicationRegisterFir::\r
- mov r8 = ar.fir;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterFir\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterFdr, @function\r
-.proc AsmReadApplicationRegisterFdr\r
-//\r
-// Reads appplication register FDR.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_FDR\r
-//\r
-// @return The 64-bit application register FDR.\r
-//\r
-AsmReadApplicationRegisterFdr::\r
- mov r8 = ar.fdr;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterFdr\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterCcv, @function\r
-.proc AsmReadApplicationRegisterCcv\r
-//\r
-// Reads appplication register CCV.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_CCV\r
-//\r
-// @return The 64-bit application register CCV.\r
-//\r
-AsmReadApplicationRegisterCcv::\r
- mov r8 = ar.ccv;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterCcv\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterUnat, @function\r
-.proc AsmReadApplicationRegisterUnat\r
-//\r
-// Reads appplication register UNAT.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_UNAT\r
-//\r
-// @return The 64-bit application register UNAT.\r
-//\r
-AsmReadApplicationRegisterUnat::\r
- mov r8 = ar.unat;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterUnat\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterFpsr, @function\r
-.proc AsmReadApplicationRegisterFpsr\r
-//\r
-// Reads appplication register FPSR.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_FPSR\r
-//\r
-// @return The 64-bit application register FPSR.\r
-//\r
-AsmReadApplicationRegisterFpsr::\r
- mov r8 = ar.fpsr;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterFpsr\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterItc, @function\r
-.proc AsmReadApplicationRegisterItc\r
-//\r
-// Reads appplication register ITC.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_ITC\r
-//\r
-// @return The 64-bit application register ITC.\r
-//\r
-AsmReadApplicationRegisterItc::\r
- mov r8 = ar.itc;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterItc\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterPfs, @function\r
-.proc AsmReadApplicationRegisterPfs\r
-//\r
-// Reads appplication register PFS.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_PFS\r
-//\r
-// @return The 64-bit application register PFS.\r
-//\r
-AsmReadApplicationRegisterPfs::\r
- mov r8 = ar.pfs;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterPfs\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterLc, @function\r
-.proc AsmReadApplicationRegisterLc\r
-//\r
-// Reads appplication register LC.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_LC\r
-//\r
-// @return The 64-bit application register LC.\r
-//\r
-AsmReadApplicationRegisterLc::\r
- mov r8 = ar.lc;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterLc\r
-\r
-\r
-\r
-.text\r
-.type AsmReadApplicationRegisterEc, @function\r
-.proc AsmReadApplicationRegisterEc\r
-//\r
-// Reads appplication register EC.\r
-//\r
-// This is a worker function for AsmReadApplicationRegister()\r
-// when its parameter Index is IPF_APPLICATION_REGISTER_EC\r
-//\r
-// @return The 64-bit application register EC.\r
-//\r
-AsmReadApplicationRegisterEc::\r
- mov r8 = ar.ec;;\r
- br.ret.dpnt b0;;\r
-.endp AsmReadApplicationRegisterEc\r
-\r
+//---------------------------------------------------------------------------------\r
+//++\r
+// AsmReadApplicationRegister\r
+//\r
+// Reads a 64-bit application register.\r
+//\r
+// Reads and returns the application 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 application register to read.\r
+//\r
+// Return Value: The application register specified by Index.\r
+//\r
+//--\r
+//----------------------------------------------------------------------------------\r
+.text\r
+.type AsmReadApplicationRegister, @function\r
+.proc AsmReadApplicationRegister\r
+.regstk 1, 0, 0, 0\r
+\r
+AsmReadApplicationRegister::\r
+ //\r
+ // ARs are defined in the ranges 0-44 and 64-66 (with some holes).\r
+ // Compact this list by subtracting 16 from the top range.\r
+ // 0-44, 64-66 -> 0-44, 48-50\r
+ //\r
+ mov r15=2\r
+ mov r14=pr // save predicates\r
+ cmp.leu p6,p7=64,in0 // p6 = AR# >= 64\r
+ ;;\r
+ (p7) cmp.leu p7,p0=48,in0 // p7 = 32 <= AR# < 64\r
+ (p6) add in0=-16,in0 // if (AR >= 64) AR# -= 16\r
+ ;;\r
+ (p7) mov r15=0 // if bad range (48-63)\r
+ ;;\r
+ mov ret0=-1 // in case of illegal AR #\r
+ shl r15=r15,in0 // r15 = 0x2 << AR#\r
+ ;;\r
+ mov pr=r15,-1\r
+ ;;\r
+ //\r
+ // At this point the predicates contain a bit field of the\r
+ // AR desired. (The bit is the AR+1, since pr0 is always 1.)\r
+ //\r
+ .pred.rel "mutex",p1,p2,p3,p4,p5,p6,p7,p8,p17,p18,p19,p20,p22,p25,\\r
+ p26,p27,p28,p29,p30,p31,p33,p37,p41,p45,p49,p50,p51\r
+ (p1) mov ret0=ar.k0 // ar0\r
+ (p2) mov ret0=ar.k1 // ar1\r
+ (p3) mov ret0=ar.k2 // ar2\r
+ (p4) mov ret0=ar.k3 // ar3\r
+ (p5) mov ret0=ar.k4 // ar4\r
+ (p6) mov ret0=ar.k5 // ar5\r
+ (p7) mov ret0=ar.k6 // ar6\r
+ (p8) mov ret0=ar.k7 // ar7\r
+\r
+ (p17) mov ret0=ar.rsc // ar16\r
+ (p18) mov ret0=ar.bsp // ar17\r
+ (p19) mov ret0=ar.bspstore // ar18\r
+ (p20) mov ret0=ar.rnat // ar19\r
+\r
+ (p22) mov ret0=ar.fcr // ar21 [iA32]\r
+\r
+ (p25) mov ret0=ar.eflag // ar24 [iA32]\r
+ (p26) mov ret0=ar.csd // ar25 [iA32]\r
+ (p27) mov ret0=ar.ssd // ar26 [iA32]\r
+ (p28) mov ret0=ar.cflg // ar27 [iA32]\r
+ (p29) mov ret0=ar.fsr // ar28 [iA32]\r
+ (p30) mov ret0=ar.fir // ar29 [iA32]\r
+ (p31) mov ret0=ar.fdr // ar30 [iA32]\r
+\r
+ (p33) mov ret0=ar.ccv // ar32\r
+\r
+ (p37) mov ret0=ar.unat // ar36\r
+\r
+ (p41) mov ret0=ar.fpsr // ar40\r
+\r
+ (p45) mov ret0=ar.itc // ar44\r
+\r
+ //\r
+ // This is the translated (-16) range.\r
+ //\r
+ (p49) mov ret0=ar.pfs // ar64\r
+ (p50) mov ret0=ar.lc // ar65\r
+ (p51) mov ret0=ar.ec // ar66\r
+\r
+ // Restore predicates and return.\r
+\r
+ mov pr=r14,-1\r
+ br.ret.sptk b0\r
+ .endp\r