Changeset 345 for soft/giet_vm/giet_common/vmem.c
- Timestamp:
- Jun 25, 2014, 2:19:37 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_common/vmem.c
r295 r345 95 95 unsigned long long pte2_paddr; 96 96 97 registerunsigned int pte2_msb;98 registerunsigned int pte2_lsb;99 registerunsigned int flags_value;100 registerunsigned int ppn_value;97 volatile unsigned int pte2_msb; 98 volatile unsigned int pte2_lsb; 99 unsigned int flags_value; 100 unsigned int ppn_value; 101 101 102 102 unsigned int ix1 = vpn >> 9; 103 103 unsigned int ix2 = vpn & 0x1FF; 104 105 unsigned int save_sr; 104 106 105 107 // get PTE1 … … 110 112 111 113 // get physical addresses of pte2 (two 32 bits words) 112 ptba = (unsigned long long) (pt ->pt1[ix1]& 0x0FFFFFFF) << 12;114 ptba = (unsigned long long) (pte1 & 0x0FFFFFFF) << 12; 113 115 pte2_paddr = ptba + 8*ix2; 114 116 pte2_lsb = (unsigned int) pte2_paddr; 115 117 pte2_msb = (unsigned int) (pte2_paddr >> 32); 116 118 119 // disable interrupts and save status register 120 _it_disable( &save_sr ); 121 117 122 // gets ppn_value and flags_value, after temporary DTLB desactivation 118 123 asm volatile ( 119 "li $2, 0xFFFFFFFE \n" /* Mask for IE bits */ 120 "mfc0 $4, $12 \n" /* $4 <= SR */ 121 "and $2, $2, $4 \n" 122 "mtc0 $2, $12 \n" /* disable Interrupts */ 123 124 "li $3, 0xB \n" 125 "mtc2 $3, $1 \n" /* DTLB unactivated */ 124 "mfc2 $2, $1 \n" /* $2 <= MMU_MODE */ 125 "andi $3, $2, 0xb \n" 126 "mtc2 $3, $1 \n" /* DTLB off */ 126 127 127 128 "mtc2 %2, $24 \n" /* PADDR_EXT <= msb */ … … 130 131 "mtc2 $0, $24 \n" /* PADDR_EXT <= 0 */ 131 132 132 "li $3, 0xF \n" 133 "mtc2 $3, $1 \n" /* DTLB activated */ 133 "mtc2 $2, $1 \n" /* restore MMU_MODE */ 134 : "=r" (flags_value), "=r" (ppn_value) 135 : "r" (pte2_msb) , "r" (pte2_lsb) 136 : "$2", "$3"); 134 137 135 "mtc0 $4, $12 \n" /* restore SR */ 136 : "=r" (flags_value), "=r" (ppn_value) 137 : "r" (pte2_msb), "r" (pte2_lsb) 138 : "$2","$3","$4"); 138 // restore saved status register 139 _it_restore( &save_sr ); 139 140 140 141 // check PTE2 mapping … … 142 143 143 144 // set return values 144 *ppn = ppn_value;145 *ppn = ppn_value; 145 146 *flags = flags_value; 147 146 148 return 0; 147 149 } // end _v2p_translate()
Note: See TracChangeset
for help on using the changeset viewer.