Commit 89fc88da4c8be493c978cf587fb5f4cc0114d23b

Authored by ths
1 parent ea6fd42f

Fix off-by-one in address check.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3382 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 8 additions and 11 deletions
target-mips/helper.c
... ... @@ -131,18 +131,14 @@ static int get_physical_address (CPUState *env, target_ulong *physical,
131 131 ret = env->tlb->map_address(env, physical, prot, address, rw, access_type);
132 132 }
133 133 #if defined(TARGET_MIPSN32) || defined(TARGET_MIPS64)
134   -/*
135   - XXX: Assuming :
136   - - PABITS = 36 (correct for MIPS64R1)
137   -*/
138   - } else if (address < 0x3FFFFFFFFFFFFFFFULL) {
  134 + } else if (address < 0x4000000000000000ULL) {
139 135 /* xuseg */
140 136 if (UX && address < (0x3FFFFFFFFFFFFFFFULL & env->SEGMask)) {
141 137 ret = env->tlb->map_address(env, physical, prot, address, rw, access_type);
142 138 } else {
143 139 ret = TLBRET_BADADDR;
144 140 }
145   - } else if (address < 0x7FFFFFFFFFFFFFFFULL) {
  141 + } else if (address < 0x8000000000000000ULL) {
146 142 /* xsseg */
147 143 if ((supervisor_mode || kernel_mode) &&
148 144 SX && address < (0x7FFFFFFFFFFFFFFFULL & env->SEGMask)) {
... ... @@ -150,16 +146,17 @@ static int get_physical_address (CPUState *env, target_ulong *physical,
150 146 } else {
151 147 ret = TLBRET_BADADDR;
152 148 }
153   - } else if (address < 0xBFFFFFFFFFFFFFFFULL) {
  149 + } else if (address < 0xC000000000000000ULL) {
154 150 /* xkphys */
  151 + /* XXX: Assumes PABITS = 36 (correct for MIPS64R1) */
155 152 if (kernel_mode && KX &&
156   - (address & 0x07FFFFFFFFFFFFFFULL) < 0X0000000FFFFFFFFFULL) {
157   - *physical = address & 0X0000000FFFFFFFFFULL;
  153 + (address & 0x07FFFFFFFFFFFFFFULL) < 0x0000000FFFFFFFFFULL) {
  154 + *physical = address & 0x0000000FFFFFFFFFULL;
158 155 *prot = PAGE_READ | PAGE_WRITE;
159 156 } else {
160 157 ret = TLBRET_BADADDR;
161 158 }
162   - } else if (address < 0xFFFFFFFF7FFFFFFFULL) {
  159 + } else if (address < 0xFFFFFFFF80000000ULL) {
163 160 /* xkseg */
164 161 if (kernel_mode && KX &&
165 162 address < (0xFFFFFFFF7FFFFFFFULL & env->SEGMask)) {
... ... @@ -185,7 +182,7 @@ static int get_physical_address (CPUState *env, target_ulong *physical,
185 182 ret = TLBRET_BADADDR;
186 183 }
187 184 } else if (address < (int32_t)0xE0000000UL) {
188   - /* sseg */
  185 + /* sseg (kseg2) */
189 186 if (supervisor_mode || kernel_mode) {
190 187 ret = env->tlb->map_address(env, physical, prot, address, rw, access_type);
191 188 } else {
... ...