--- qemu/linux-user/arm/nwfpe/fpa11_cpdt.c 2018/04/24 16:52:09 1.1
+++ qemu/linux-user/arm/nwfpe/fpa11_cpdt.c 2018/04/24 18:58:06 1.1.1.5
@@ -16,8 +16,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program; if not, see .
*/
#include "fpa11.h"
@@ -29,24 +28,22 @@
//#include
static inline
-void loadSingle(const unsigned int Fn,const unsigned int *pMem)
+void loadSingle(const unsigned int Fn, target_ulong addr)
{
- target_ulong addr = (target_ulong)(long)pMem;
FPA11 *fpa11 = GET_FPA11();
fpa11->fType[Fn] = typeSingle;
/* FIXME - handle failure of get_user() */
- get_user_u32(fpa11->fpreg[Fn].fSingle, addr);
+ get_user_u32(float32_val(fpa11->fpreg[Fn].fSingle), addr);
}
static inline
-void loadDouble(const unsigned int Fn,const unsigned int *pMem)
+void loadDouble(const unsigned int Fn, target_ulong addr)
{
- target_ulong addr = (target_ulong)(long)pMem;
FPA11 *fpa11 = GET_FPA11();
unsigned int *p;
p = (unsigned int*)&fpa11->fpreg[Fn].fDouble;
fpa11->fType[Fn] = typeDouble;
-#ifdef WORDS_BIGENDIAN
+#ifdef HOST_WORDS_BIGENDIAN
/* FIXME - handle failure of get_user() */
get_user_u32(p[0], addr); /* sign & exponent */
get_user_u32(p[1], addr + 4);
@@ -58,9 +55,8 @@ void loadDouble(const unsigned int Fn,co
}
static inline
-void loadExtended(const unsigned int Fn,const unsigned int *pMem)
+void loadExtended(const unsigned int Fn, target_ulong addr)
{
- target_ulong addr = (target_ulong)(long)pMem;
FPA11 *fpa11 = GET_FPA11();
unsigned int *p;
p = (unsigned int*)&fpa11->fpreg[Fn].fExtended;
@@ -72,9 +68,8 @@ void loadExtended(const unsigned int Fn,
}
static inline
-void loadMultiple(const unsigned int Fn,const unsigned int *pMem)
+void loadMultiple(const unsigned int Fn, target_ulong addr)
{
- target_ulong addr = (target_ulong)(long)pMem;
FPA11 *fpa11 = GET_FPA11();
register unsigned int *p;
unsigned long x;
@@ -108,9 +103,8 @@ void loadMultiple(const unsigned int Fn,
}
static inline
-void storeSingle(const unsigned int Fn,unsigned int *pMem)
+void storeSingle(const unsigned int Fn, target_ulong addr)
{
- target_ulong addr = (target_ulong)(long)pMem;
FPA11 *fpa11 = GET_FPA11();
float32 val;
register unsigned int *p = (unsigned int*)&val;
@@ -133,9 +127,8 @@ void storeSingle(const unsigned int Fn,u
}
static inline
-void storeDouble(const unsigned int Fn,unsigned int *pMem)
+void storeDouble(const unsigned int Fn, target_ulong addr)
{
- target_ulong addr = (target_ulong)(long)pMem;
FPA11 *fpa11 = GET_FPA11();
float64 val;
register unsigned int *p = (unsigned int*)&val;
@@ -153,7 +146,7 @@ void storeDouble(const unsigned int Fn,u
default: val = fpa11->fpreg[Fn].fDouble;
}
/* FIXME - handle put_user() failures */
-#ifdef WORDS_BIGENDIAN
+#ifdef HOST_WORDS_BIGENDIAN
put_user_u32(p[0], addr); /* msw */
put_user_u32(p[1], addr + 4); /* lsw */
#else
@@ -163,9 +156,8 @@ void storeDouble(const unsigned int Fn,u
}
static inline
-void storeExtended(const unsigned int Fn,unsigned int *pMem)
+void storeExtended(const unsigned int Fn, target_ulong addr)
{
- target_ulong addr = (target_ulong)(long)pMem;
FPA11 *fpa11 = GET_FPA11();
floatx80 val;
register unsigned int *p = (unsigned int*)&val;
@@ -190,9 +182,8 @@ void storeExtended(const unsigned int Fn
}
static inline
-void storeMultiple(const unsigned int Fn,unsigned int *pMem)
+void storeMultiple(const unsigned int Fn, target_ulong addr)
{
- target_ulong addr = (target_ulong)(long)pMem;
FPA11 *fpa11 = GET_FPA11();
register unsigned int nType, *p;
@@ -220,25 +211,26 @@ void storeMultiple(const unsigned int Fn
}
}
-unsigned int PerformLDF(const unsigned int opcode)
+static unsigned int PerformLDF(const unsigned int opcode)
{
- unsigned int *pBase, *pAddress, *pFinal, nRc = 1,
+ target_ulong pBase, pAddress, pFinal;
+ unsigned int nRc = 1,
write_back = WRITE_BACK(opcode);
//printk("PerformLDF(0x%08x), Fd = 0x%08x\n",opcode,getFd(opcode));
- pBase = (unsigned int*)readRegister(getRn(opcode));
- if (REG_PC == getRn(opcode))
+ pBase = readRegister(getRn(opcode));
+ if (ARM_REG_PC == getRn(opcode))
{
- pBase += 2;
+ pBase += 8;
write_back = 0;
}
pFinal = pBase;
if (BIT_UP_SET(opcode))
- pFinal += getOffset(opcode);
+ pFinal += getOffset(opcode) * 4;
else
- pFinal -= getOffset(opcode);
+ pFinal -= getOffset(opcode) * 4;
if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase;
@@ -254,26 +246,27 @@ unsigned int PerformLDF(const unsigned i
return nRc;
}
-unsigned int PerformSTF(const unsigned int opcode)
+static unsigned int PerformSTF(const unsigned int opcode)
{
- unsigned int *pBase, *pAddress, *pFinal, nRc = 1,
+ target_ulong pBase, pAddress, pFinal;
+ unsigned int nRc = 1,
write_back = WRITE_BACK(opcode);
//printk("PerformSTF(0x%08x), Fd = 0x%08x\n",opcode,getFd(opcode));
SetRoundingMode(ROUND_TO_NEAREST);
- pBase = (unsigned int*)readRegister(getRn(opcode));
- if (REG_PC == getRn(opcode))
+ pBase = readRegister(getRn(opcode));
+ if (ARM_REG_PC == getRn(opcode))
{
- pBase += 2;
+ pBase += 8;
write_back = 0;
}
pFinal = pBase;
if (BIT_UP_SET(opcode))
- pFinal += getOffset(opcode);
+ pFinal += getOffset(opcode) * 4;
else
- pFinal -= getOffset(opcode);
+ pFinal -= getOffset(opcode) * 4;
if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase;
@@ -289,23 +282,24 @@ unsigned int PerformSTF(const unsigned i
return nRc;
}
-unsigned int PerformLFM(const unsigned int opcode)
+static unsigned int PerformLFM(const unsigned int opcode)
{
- unsigned int i, Fd, *pBase, *pAddress, *pFinal,
+ unsigned int i, Fd,
write_back = WRITE_BACK(opcode);
+ target_ulong pBase, pAddress, pFinal;
- pBase = (unsigned int*)readRegister(getRn(opcode));
- if (REG_PC == getRn(opcode))
+ pBase = readRegister(getRn(opcode));
+ if (ARM_REG_PC == getRn(opcode))
{
- pBase += 2;
+ pBase += 8;
write_back = 0;
}
pFinal = pBase;
if (BIT_UP_SET(opcode))
- pFinal += getOffset(opcode);
+ pFinal += getOffset(opcode) * 4;
else
- pFinal -= getOffset(opcode);
+ pFinal -= getOffset(opcode) * 4;
if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase;
@@ -313,7 +307,7 @@ unsigned int PerformLFM(const unsigned i
for (i=getRegisterCount(opcode);i>0;i--)
{
loadMultiple(Fd,pAddress);
- pAddress += 3; Fd++;
+ pAddress += 12; Fd++;
if (Fd == 8) Fd = 0;
}
@@ -321,23 +315,24 @@ unsigned int PerformLFM(const unsigned i
return 1;
}
-unsigned int PerformSFM(const unsigned int opcode)
+static unsigned int PerformSFM(const unsigned int opcode)
{
- unsigned int i, Fd, *pBase, *pAddress, *pFinal,
+ unsigned int i, Fd,
write_back = WRITE_BACK(opcode);
+ target_ulong pBase, pAddress, pFinal;
- pBase = (unsigned int*)readRegister(getRn(opcode));
- if (REG_PC == getRn(opcode))
+ pBase = readRegister(getRn(opcode));
+ if (ARM_REG_PC == getRn(opcode))
{
- pBase += 2;
+ pBase += 8;
write_back = 0;
}
pFinal = pBase;
if (BIT_UP_SET(opcode))
- pFinal += getOffset(opcode);
+ pFinal += getOffset(opcode) * 4;
else
- pFinal -= getOffset(opcode);
+ pFinal -= getOffset(opcode) * 4;
if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase;
@@ -345,7 +340,7 @@ unsigned int PerformSFM(const unsigned i
for (i=getRegisterCount(opcode);i>0;i--)
{
storeMultiple(Fd,pAddress);
- pAddress += 3; Fd++;
+ pAddress += 12; Fd++;
if (Fd == 8) Fd = 0;
}