Commit 65a650c2a5ed2f33357ba9d29d0f56f6b131333a
1 parent
6bb72b18
Fix compiler warnings in nwfpe code.
Signed-off-by: Paul Brook <paul@codesourcery.com>
Showing
5 changed files
with
47 additions
and
86 deletions
linux-user/arm/nwfpe/fpa11.c
| @@ -30,11 +30,6 @@ | @@ -30,11 +30,6 @@ | ||
| 30 | 30 | ||
| 31 | #include <stdio.h> | 31 | #include <stdio.h> |
| 32 | 32 | ||
| 33 | -/* forward declarations */ | ||
| 34 | -unsigned int EmulateCPDO(const unsigned int); | ||
| 35 | -unsigned int EmulateCPDT(const unsigned int); | ||
| 36 | -unsigned int EmulateCPRT(const unsigned int); | ||
| 37 | - | ||
| 38 | FPA11* qemufpa=0; | 33 | FPA11* qemufpa=0; |
| 39 | CPUARMState* user_registers; | 34 | CPUARMState* user_registers; |
| 40 | 35 |
linux-user/arm/nwfpe/fpa11.h
| @@ -116,6 +116,15 @@ static inline void writeConditionCodes(unsigned int x) | @@ -116,6 +116,15 @@ static inline void writeConditionCodes(unsigned int x) | ||
| 116 | 116 | ||
| 117 | unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs); | 117 | unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs); |
| 118 | 118 | ||
| 119 | +unsigned int EmulateCPDO(const unsigned int); | ||
| 120 | +unsigned int EmulateCPDT(const unsigned int); | ||
| 121 | +unsigned int EmulateCPRT(const unsigned int); | ||
| 122 | + | ||
| 123 | +unsigned int SingleCPDO(const unsigned int opcode); | ||
| 124 | +unsigned int DoubleCPDO(const unsigned int opcode); | ||
| 125 | +unsigned int ExtendedCPDO(const unsigned int opcode); | ||
| 126 | + | ||
| 127 | + | ||
| 119 | /* included only for get_user/put_user macros */ | 128 | /* included only for get_user/put_user macros */ |
| 120 | #include "qemu.h" | 129 | #include "qemu.h" |
| 121 | 130 |
linux-user/arm/nwfpe/fpa11_cpdo.c
| @@ -22,10 +22,6 @@ | @@ -22,10 +22,6 @@ | ||
| 22 | #include "fpa11.h" | 22 | #include "fpa11.h" |
| 23 | #include "fpopcode.h" | 23 | #include "fpopcode.h" |
| 24 | 24 | ||
| 25 | -unsigned int SingleCPDO(const unsigned int opcode); | ||
| 26 | -unsigned int DoubleCPDO(const unsigned int opcode); | ||
| 27 | -unsigned int ExtendedCPDO(const unsigned int opcode); | ||
| 28 | - | ||
| 29 | unsigned int EmulateCPDO(const unsigned int opcode) | 25 | unsigned int EmulateCPDO(const unsigned int opcode) |
| 30 | { | 26 | { |
| 31 | FPA11 *fpa11 = GET_FPA11(); | 27 | FPA11 *fpa11 = GET_FPA11(); |
linux-user/arm/nwfpe/fpa11_cpdt.c
| @@ -29,9 +29,8 @@ | @@ -29,9 +29,8 @@ | ||
| 29 | //#include <asm/uaccess.h> | 29 | //#include <asm/uaccess.h> |
| 30 | 30 | ||
| 31 | static inline | 31 | static inline |
| 32 | -void loadSingle(const unsigned int Fn,const unsigned int *pMem) | 32 | +void loadSingle(const unsigned int Fn, target_ulong addr) |
| 33 | { | 33 | { |
| 34 | - target_ulong addr = (target_ulong)(long)pMem; | ||
| 35 | FPA11 *fpa11 = GET_FPA11(); | 34 | FPA11 *fpa11 = GET_FPA11(); |
| 36 | fpa11->fType[Fn] = typeSingle; | 35 | fpa11->fType[Fn] = typeSingle; |
| 37 | /* FIXME - handle failure of get_user() */ | 36 | /* FIXME - handle failure of get_user() */ |
| @@ -39,9 +38,8 @@ void loadSingle(const unsigned int Fn,const unsigned int *pMem) | @@ -39,9 +38,8 @@ void loadSingle(const unsigned int Fn,const unsigned int *pMem) | ||
| 39 | } | 38 | } |
| 40 | 39 | ||
| 41 | static inline | 40 | static inline |
| 42 | -void loadDouble(const unsigned int Fn,const unsigned int *pMem) | 41 | +void loadDouble(const unsigned int Fn, target_ulong addr) |
| 43 | { | 42 | { |
| 44 | - target_ulong addr = (target_ulong)(long)pMem; | ||
| 45 | FPA11 *fpa11 = GET_FPA11(); | 43 | FPA11 *fpa11 = GET_FPA11(); |
| 46 | unsigned int *p; | 44 | unsigned int *p; |
| 47 | p = (unsigned int*)&fpa11->fpreg[Fn].fDouble; | 45 | p = (unsigned int*)&fpa11->fpreg[Fn].fDouble; |
| @@ -58,9 +56,8 @@ void loadDouble(const unsigned int Fn,const unsigned int *pMem) | @@ -58,9 +56,8 @@ void loadDouble(const unsigned int Fn,const unsigned int *pMem) | ||
| 58 | } | 56 | } |
| 59 | 57 | ||
| 60 | static inline | 58 | static inline |
| 61 | -void loadExtended(const unsigned int Fn,const unsigned int *pMem) | 59 | +void loadExtended(const unsigned int Fn, target_ulong addr) |
| 62 | { | 60 | { |
| 63 | - target_ulong addr = (target_ulong)(long)pMem; | ||
| 64 | FPA11 *fpa11 = GET_FPA11(); | 61 | FPA11 *fpa11 = GET_FPA11(); |
| 65 | unsigned int *p; | 62 | unsigned int *p; |
| 66 | p = (unsigned int*)&fpa11->fpreg[Fn].fExtended; | 63 | p = (unsigned int*)&fpa11->fpreg[Fn].fExtended; |
| @@ -72,9 +69,8 @@ void loadExtended(const unsigned int Fn,const unsigned int *pMem) | @@ -72,9 +69,8 @@ void loadExtended(const unsigned int Fn,const unsigned int *pMem) | ||
| 72 | } | 69 | } |
| 73 | 70 | ||
| 74 | static inline | 71 | static inline |
| 75 | -void loadMultiple(const unsigned int Fn,const unsigned int *pMem) | 72 | +void loadMultiple(const unsigned int Fn, target_ulong addr) |
| 76 | { | 73 | { |
| 77 | - target_ulong addr = (target_ulong)(long)pMem; | ||
| 78 | FPA11 *fpa11 = GET_FPA11(); | 74 | FPA11 *fpa11 = GET_FPA11(); |
| 79 | register unsigned int *p; | 75 | register unsigned int *p; |
| 80 | unsigned long x; | 76 | unsigned long x; |
| @@ -108,9 +104,8 @@ void loadMultiple(const unsigned int Fn,const unsigned int *pMem) | @@ -108,9 +104,8 @@ void loadMultiple(const unsigned int Fn,const unsigned int *pMem) | ||
| 108 | } | 104 | } |
| 109 | 105 | ||
| 110 | static inline | 106 | static inline |
| 111 | -void storeSingle(const unsigned int Fn,unsigned int *pMem) | 107 | +void storeSingle(const unsigned int Fn, target_ulong addr) |
| 112 | { | 108 | { |
| 113 | - target_ulong addr = (target_ulong)(long)pMem; | ||
| 114 | FPA11 *fpa11 = GET_FPA11(); | 109 | FPA11 *fpa11 = GET_FPA11(); |
| 115 | float32 val; | 110 | float32 val; |
| 116 | register unsigned int *p = (unsigned int*)&val; | 111 | register unsigned int *p = (unsigned int*)&val; |
| @@ -133,9 +128,8 @@ void storeSingle(const unsigned int Fn,unsigned int *pMem) | @@ -133,9 +128,8 @@ void storeSingle(const unsigned int Fn,unsigned int *pMem) | ||
| 133 | } | 128 | } |
| 134 | 129 | ||
| 135 | static inline | 130 | static inline |
| 136 | -void storeDouble(const unsigned int Fn,unsigned int *pMem) | 131 | +void storeDouble(const unsigned int Fn, target_ulong addr) |
| 137 | { | 132 | { |
| 138 | - target_ulong addr = (target_ulong)(long)pMem; | ||
| 139 | FPA11 *fpa11 = GET_FPA11(); | 133 | FPA11 *fpa11 = GET_FPA11(); |
| 140 | float64 val; | 134 | float64 val; |
| 141 | register unsigned int *p = (unsigned int*)&val; | 135 | register unsigned int *p = (unsigned int*)&val; |
| @@ -163,9 +157,8 @@ void storeDouble(const unsigned int Fn,unsigned int *pMem) | @@ -163,9 +157,8 @@ void storeDouble(const unsigned int Fn,unsigned int *pMem) | ||
| 163 | } | 157 | } |
| 164 | 158 | ||
| 165 | static inline | 159 | static inline |
| 166 | -void storeExtended(const unsigned int Fn,unsigned int *pMem) | 160 | +void storeExtended(const unsigned int Fn, target_ulong addr) |
| 167 | { | 161 | { |
| 168 | - target_ulong addr = (target_ulong)(long)pMem; | ||
| 169 | FPA11 *fpa11 = GET_FPA11(); | 162 | FPA11 *fpa11 = GET_FPA11(); |
| 170 | floatx80 val; | 163 | floatx80 val; |
| 171 | register unsigned int *p = (unsigned int*)&val; | 164 | register unsigned int *p = (unsigned int*)&val; |
| @@ -190,9 +183,8 @@ void storeExtended(const unsigned int Fn,unsigned int *pMem) | @@ -190,9 +183,8 @@ void storeExtended(const unsigned int Fn,unsigned int *pMem) | ||
| 190 | } | 183 | } |
| 191 | 184 | ||
| 192 | static inline | 185 | static inline |
| 193 | -void storeMultiple(const unsigned int Fn,unsigned int *pMem) | 186 | +void storeMultiple(const unsigned int Fn, target_ulong addr) |
| 194 | { | 187 | { |
| 195 | - target_ulong addr = (target_ulong)(long)pMem; | ||
| 196 | FPA11 *fpa11 = GET_FPA11(); | 188 | FPA11 *fpa11 = GET_FPA11(); |
| 197 | register unsigned int nType, *p; | 189 | register unsigned int nType, *p; |
| 198 | 190 | ||
| @@ -220,25 +212,26 @@ void storeMultiple(const unsigned int Fn,unsigned int *pMem) | @@ -220,25 +212,26 @@ void storeMultiple(const unsigned int Fn,unsigned int *pMem) | ||
| 220 | } | 212 | } |
| 221 | } | 213 | } |
| 222 | 214 | ||
| 223 | -unsigned int PerformLDF(const unsigned int opcode) | 215 | +static unsigned int PerformLDF(const unsigned int opcode) |
| 224 | { | 216 | { |
| 225 | - unsigned int *pBase, *pAddress, *pFinal, nRc = 1, | 217 | + target_ulong pBase, pAddress, pFinal; |
| 218 | + unsigned int nRc = 1, | ||
| 226 | write_back = WRITE_BACK(opcode); | 219 | write_back = WRITE_BACK(opcode); |
| 227 | 220 | ||
| 228 | //printk("PerformLDF(0x%08x), Fd = 0x%08x\n",opcode,getFd(opcode)); | 221 | //printk("PerformLDF(0x%08x), Fd = 0x%08x\n",opcode,getFd(opcode)); |
| 229 | 222 | ||
| 230 | - pBase = (unsigned int*)readRegister(getRn(opcode)); | 223 | + pBase = readRegister(getRn(opcode)); |
| 231 | if (REG_PC == getRn(opcode)) | 224 | if (REG_PC == getRn(opcode)) |
| 232 | { | 225 | { |
| 233 | - pBase += 2; | 226 | + pBase += 8; |
| 234 | write_back = 0; | 227 | write_back = 0; |
| 235 | } | 228 | } |
| 236 | 229 | ||
| 237 | pFinal = pBase; | 230 | pFinal = pBase; |
| 238 | if (BIT_UP_SET(opcode)) | 231 | if (BIT_UP_SET(opcode)) |
| 239 | - pFinal += getOffset(opcode); | 232 | + pFinal += getOffset(opcode) * 4; |
| 240 | else | 233 | else |
| 241 | - pFinal -= getOffset(opcode); | 234 | + pFinal -= getOffset(opcode) * 4; |
| 242 | 235 | ||
| 243 | if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase; | 236 | if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase; |
| 244 | 237 | ||
| @@ -254,26 +247,27 @@ unsigned int PerformLDF(const unsigned int opcode) | @@ -254,26 +247,27 @@ unsigned int PerformLDF(const unsigned int opcode) | ||
| 254 | return nRc; | 247 | return nRc; |
| 255 | } | 248 | } |
| 256 | 249 | ||
| 257 | -unsigned int PerformSTF(const unsigned int opcode) | 250 | +static unsigned int PerformSTF(const unsigned int opcode) |
| 258 | { | 251 | { |
| 259 | - unsigned int *pBase, *pAddress, *pFinal, nRc = 1, | 252 | + target_ulong pBase, pAddress, pFinal; |
| 253 | + unsigned int nRc = 1, | ||
| 260 | write_back = WRITE_BACK(opcode); | 254 | write_back = WRITE_BACK(opcode); |
| 261 | 255 | ||
| 262 | //printk("PerformSTF(0x%08x), Fd = 0x%08x\n",opcode,getFd(opcode)); | 256 | //printk("PerformSTF(0x%08x), Fd = 0x%08x\n",opcode,getFd(opcode)); |
| 263 | SetRoundingMode(ROUND_TO_NEAREST); | 257 | SetRoundingMode(ROUND_TO_NEAREST); |
| 264 | 258 | ||
| 265 | - pBase = (unsigned int*)readRegister(getRn(opcode)); | 259 | + pBase = readRegister(getRn(opcode)); |
| 266 | if (REG_PC == getRn(opcode)) | 260 | if (REG_PC == getRn(opcode)) |
| 267 | { | 261 | { |
| 268 | - pBase += 2; | 262 | + pBase += 8; |
| 269 | write_back = 0; | 263 | write_back = 0; |
| 270 | } | 264 | } |
| 271 | 265 | ||
| 272 | pFinal = pBase; | 266 | pFinal = pBase; |
| 273 | if (BIT_UP_SET(opcode)) | 267 | if (BIT_UP_SET(opcode)) |
| 274 | - pFinal += getOffset(opcode); | 268 | + pFinal += getOffset(opcode) * 4; |
| 275 | else | 269 | else |
| 276 | - pFinal -= getOffset(opcode); | 270 | + pFinal -= getOffset(opcode) * 4; |
| 277 | 271 | ||
| 278 | if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase; | 272 | if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase; |
| 279 | 273 | ||
| @@ -289,23 +283,24 @@ unsigned int PerformSTF(const unsigned int opcode) | @@ -289,23 +283,24 @@ unsigned int PerformSTF(const unsigned int opcode) | ||
| 289 | return nRc; | 283 | return nRc; |
| 290 | } | 284 | } |
| 291 | 285 | ||
| 292 | -unsigned int PerformLFM(const unsigned int opcode) | 286 | +static unsigned int PerformLFM(const unsigned int opcode) |
| 293 | { | 287 | { |
| 294 | - unsigned int i, Fd, *pBase, *pAddress, *pFinal, | 288 | + unsigned int i, Fd, |
| 295 | write_back = WRITE_BACK(opcode); | 289 | write_back = WRITE_BACK(opcode); |
| 290 | + target_ulong pBase, pAddress, pFinal; | ||
| 296 | 291 | ||
| 297 | - pBase = (unsigned int*)readRegister(getRn(opcode)); | 292 | + pBase = readRegister(getRn(opcode)); |
| 298 | if (REG_PC == getRn(opcode)) | 293 | if (REG_PC == getRn(opcode)) |
| 299 | { | 294 | { |
| 300 | - pBase += 2; | 295 | + pBase += 8; |
| 301 | write_back = 0; | 296 | write_back = 0; |
| 302 | } | 297 | } |
| 303 | 298 | ||
| 304 | pFinal = pBase; | 299 | pFinal = pBase; |
| 305 | if (BIT_UP_SET(opcode)) | 300 | if (BIT_UP_SET(opcode)) |
| 306 | - pFinal += getOffset(opcode); | 301 | + pFinal += getOffset(opcode) * 4; |
| 307 | else | 302 | else |
| 308 | - pFinal -= getOffset(opcode); | 303 | + pFinal -= getOffset(opcode) * 4; |
| 309 | 304 | ||
| 310 | if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase; | 305 | if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase; |
| 311 | 306 | ||
| @@ -313,7 +308,7 @@ unsigned int PerformLFM(const unsigned int opcode) | @@ -313,7 +308,7 @@ unsigned int PerformLFM(const unsigned int opcode) | ||
| 313 | for (i=getRegisterCount(opcode);i>0;i--) | 308 | for (i=getRegisterCount(opcode);i>0;i--) |
| 314 | { | 309 | { |
| 315 | loadMultiple(Fd,pAddress); | 310 | loadMultiple(Fd,pAddress); |
| 316 | - pAddress += 3; Fd++; | 311 | + pAddress += 12; Fd++; |
| 317 | if (Fd == 8) Fd = 0; | 312 | if (Fd == 8) Fd = 0; |
| 318 | } | 313 | } |
| 319 | 314 | ||
| @@ -321,23 +316,24 @@ unsigned int PerformLFM(const unsigned int opcode) | @@ -321,23 +316,24 @@ unsigned int PerformLFM(const unsigned int opcode) | ||
| 321 | return 1; | 316 | return 1; |
| 322 | } | 317 | } |
| 323 | 318 | ||
| 324 | -unsigned int PerformSFM(const unsigned int opcode) | 319 | +static unsigned int PerformSFM(const unsigned int opcode) |
| 325 | { | 320 | { |
| 326 | - unsigned int i, Fd, *pBase, *pAddress, *pFinal, | 321 | + unsigned int i, Fd, |
| 327 | write_back = WRITE_BACK(opcode); | 322 | write_back = WRITE_BACK(opcode); |
| 323 | + target_ulong pBase, pAddress, pFinal; | ||
| 328 | 324 | ||
| 329 | - pBase = (unsigned int*)readRegister(getRn(opcode)); | 325 | + pBase = readRegister(getRn(opcode)); |
| 330 | if (REG_PC == getRn(opcode)) | 326 | if (REG_PC == getRn(opcode)) |
| 331 | { | 327 | { |
| 332 | - pBase += 2; | 328 | + pBase += 8; |
| 333 | write_back = 0; | 329 | write_back = 0; |
| 334 | } | 330 | } |
| 335 | 331 | ||
| 336 | pFinal = pBase; | 332 | pFinal = pBase; |
| 337 | if (BIT_UP_SET(opcode)) | 333 | if (BIT_UP_SET(opcode)) |
| 338 | - pFinal += getOffset(opcode); | 334 | + pFinal += getOffset(opcode) * 4; |
| 339 | else | 335 | else |
| 340 | - pFinal -= getOffset(opcode); | 336 | + pFinal -= getOffset(opcode) * 4; |
| 341 | 337 | ||
| 342 | if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase; | 338 | if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase; |
| 343 | 339 | ||
| @@ -345,7 +341,7 @@ unsigned int PerformSFM(const unsigned int opcode) | @@ -345,7 +341,7 @@ unsigned int PerformSFM(const unsigned int opcode) | ||
| 345 | for (i=getRegisterCount(opcode);i>0;i--) | 341 | for (i=getRegisterCount(opcode);i>0;i--) |
| 346 | { | 342 | { |
| 347 | storeMultiple(Fd,pAddress); | 343 | storeMultiple(Fd,pAddress); |
| 348 | - pAddress += 3; Fd++; | 344 | + pAddress += 12; Fd++; |
| 349 | if (Fd == 8) Fd = 0; | 345 | if (Fd == 8) Fd = 0; |
| 350 | } | 346 | } |
| 351 | 347 |
linux-user/arm/nwfpe/fpopcode.c
| @@ -59,21 +59,6 @@ const float32 float32Constant[] = { | @@ -59,21 +59,6 @@ const float32 float32Constant[] = { | ||
| 59 | 0x41200000 /* single 10.0 */ | 59 | 0x41200000 /* single 10.0 */ |
| 60 | }; | 60 | }; |
| 61 | 61 | ||
| 62 | -unsigned int getTransferLength(const unsigned int opcode) | ||
| 63 | -{ | ||
| 64 | - unsigned int nRc; | ||
| 65 | - | ||
| 66 | - switch (opcode & MASK_TRANSFER_LENGTH) | ||
| 67 | - { | ||
| 68 | - case 0x00000000: nRc = 1; break; /* single precision */ | ||
| 69 | - case 0x00008000: nRc = 2; break; /* double precision */ | ||
| 70 | - case 0x00400000: nRc = 3; break; /* extended precision */ | ||
| 71 | - default: nRc = 0; | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - return(nRc); | ||
| 75 | -} | ||
| 76 | - | ||
| 77 | unsigned int getRegisterCount(const unsigned int opcode) | 62 | unsigned int getRegisterCount(const unsigned int opcode) |
| 78 | { | 63 | { |
| 79 | unsigned int nRc; | 64 | unsigned int nRc; |
| @@ -90,21 +75,6 @@ unsigned int getRegisterCount(const unsigned int opcode) | @@ -90,21 +75,6 @@ unsigned int getRegisterCount(const unsigned int opcode) | ||
| 90 | return(nRc); | 75 | return(nRc); |
| 91 | } | 76 | } |
| 92 | 77 | ||
| 93 | -unsigned int getRoundingPrecision(const unsigned int opcode) | ||
| 94 | -{ | ||
| 95 | - unsigned int nRc; | ||
| 96 | - | ||
| 97 | - switch (opcode & MASK_ROUNDING_PRECISION) | ||
| 98 | - { | ||
| 99 | - case 0x00000000: nRc = 1; break; | ||
| 100 | - case 0x00000080: nRc = 2; break; | ||
| 101 | - case 0x00080000: nRc = 3; break; | ||
| 102 | - default: nRc = 0; | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - return(nRc); | ||
| 106 | -} | ||
| 107 | - | ||
| 108 | unsigned int getDestinationSize(const unsigned int opcode) | 78 | unsigned int getDestinationSize(const unsigned int opcode) |
| 109 | { | 79 | { |
| 110 | unsigned int nRc; | 80 | unsigned int nRc; |
| @@ -141,8 +111,3 @@ static const unsigned short aCC[16] = { | @@ -141,8 +111,3 @@ static const unsigned short aCC[16] = { | ||
| 141 | 0xFFFF, // AL always | 111 | 0xFFFF, // AL always |
| 142 | 0 // NV | 112 | 0 // NV |
| 143 | }; | 113 | }; |
| 144 | - | ||
| 145 | -unsigned int checkCondition(const unsigned int opcode, const unsigned int ccodes) | ||
| 146 | -{ | ||
| 147 | - return (aCC[opcode>>28] >> (ccodes>>28)) & 1; | ||
| 148 | -} |