More PowerPC target cleanups:

- remove unuseful historical macros and definitions
- fix comments (bugs and cosmetics)


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3185 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
j_mayer 2007-09-19 04:34:09 +00:00
parent 7ec93196fa
commit 8b67546f65
2 changed files with 35 additions and 38 deletions

View File

@ -30,7 +30,7 @@ typedef uint64_t ppc_gpr_t;
#define REGX "%016" PRIx64 #define REGX "%016" PRIx64
#define TARGET_PAGE_BITS 12 #define TARGET_PAGE_BITS 12
#elif defined(TARGET_PPCEMB) #elif defined(TARGET_PPCEMB)
/* e500v2 have 36 bits physical address space */ /* BookE have 36 bits physical address space */
#define TARGET_PHYS_ADDR_BITS 64 #define TARGET_PHYS_ADDR_BITS 64
/* GPR are 64 bits: used by vector extension */ /* GPR are 64 bits: used by vector extension */
typedef uint64_t ppc_gpr_t; typedef uint64_t ppc_gpr_t;
@ -917,8 +917,6 @@ int ppc_dcr_write (ppc_dcr_t *dcr_env, int dcrn, target_ulong val);
/*****************************************************************************/ /*****************************************************************************/
/* Registers definitions */ /* Registers definitions */
#define ugpr(n) (env->gpr[n])
#define XER_SO 31 #define XER_SO 31
#define XER_OV 30 #define XER_OV 30
#define XER_CA 29 #define XER_CA 29
@ -1315,7 +1313,6 @@ enum {
/* may change privilege level */ /* may change privilege level */
#define EXCP_BRANCH 0x11001 /* branch instruction */ #define EXCP_BRANCH 0x11001 /* branch instruction */
#define EXCP_SYSCALL_USER 0x12000 /* System call in user mode only */ #define EXCP_SYSCALL_USER 0x12000 /* System call in user mode only */
#define EXCP_INTERRUPT_CRITICAL 0x13000 /* critical IRQ */
/* Error codes */ /* Error codes */
enum { enum {
@ -1350,8 +1347,8 @@ enum {
EXCP_INVAL_FP = 0x04, /* Unimplemented mandatory fp instr */ EXCP_INVAL_FP = 0x04, /* Unimplemented mandatory fp instr */
/* Privileged instruction */ /* Privileged instruction */
EXCP_PRIV = 0x30, EXCP_PRIV = 0x30,
EXCP_PRIV_OPC = 0x01, EXCP_PRIV_OPC = 0x01, /* Privileged operation exception */
EXCP_PRIV_REG = 0x02, EXCP_PRIV_REG = 0x02, /* Privileged register exception */
/* Trap */ /* Trap */
EXCP_TRAP = 0x40, EXCP_TRAP = 0x40,
}; };

View File

@ -37,7 +37,7 @@ static inline void glue(st32r, MEMSUFFIX) (target_ulong EA, target_ulong data)
void glue(do_lmw, MEMSUFFIX) (int dst) void glue(do_lmw, MEMSUFFIX) (int dst)
{ {
for (; dst < 32; dst++, T0 += 4) { for (; dst < 32; dst++, T0 += 4) {
ugpr(dst) = glue(ldl, MEMSUFFIX)((uint32_t)T0); env->gpr[dst] = glue(ldl, MEMSUFFIX)((uint32_t)T0);
} }
} }
@ -45,7 +45,7 @@ void glue(do_lmw, MEMSUFFIX) (int dst)
void glue(do_lmw_64, MEMSUFFIX) (int dst) void glue(do_lmw_64, MEMSUFFIX) (int dst)
{ {
for (; dst < 32; dst++, T0 += 4) { for (; dst < 32; dst++, T0 += 4) {
ugpr(dst) = glue(ldl, MEMSUFFIX)((uint64_t)T0); env->gpr[dst] = glue(ldl, MEMSUFFIX)((uint64_t)T0);
} }
} }
#endif #endif
@ -53,7 +53,7 @@ void glue(do_lmw_64, MEMSUFFIX) (int dst)
void glue(do_stmw, MEMSUFFIX) (int src) void glue(do_stmw, MEMSUFFIX) (int src)
{ {
for (; src < 32; src++, T0 += 4) { for (; src < 32; src++, T0 += 4) {
glue(stl, MEMSUFFIX)((uint32_t)T0, ugpr(src)); glue(stl, MEMSUFFIX)((uint32_t)T0, env->gpr[src]);
} }
} }
@ -61,7 +61,7 @@ void glue(do_stmw, MEMSUFFIX) (int src)
void glue(do_stmw_64, MEMSUFFIX) (int src) void glue(do_stmw_64, MEMSUFFIX) (int src)
{ {
for (; src < 32; src++, T0 += 4) { for (; src < 32; src++, T0 += 4) {
glue(stl, MEMSUFFIX)((uint64_t)T0, ugpr(src)); glue(stl, MEMSUFFIX)((uint64_t)T0, env->gpr[src]);
} }
} }
#endif #endif
@ -69,7 +69,7 @@ void glue(do_stmw_64, MEMSUFFIX) (int src)
void glue(do_lmw_le, MEMSUFFIX) (int dst) void glue(do_lmw_le, MEMSUFFIX) (int dst)
{ {
for (; dst < 32; dst++, T0 += 4) { for (; dst < 32; dst++, T0 += 4) {
ugpr(dst) = glue(ld32r, MEMSUFFIX)((uint32_t)T0); env->gpr[dst] = glue(ld32r, MEMSUFFIX)((uint32_t)T0);
} }
} }
@ -77,7 +77,7 @@ void glue(do_lmw_le, MEMSUFFIX) (int dst)
void glue(do_lmw_le_64, MEMSUFFIX) (int dst) void glue(do_lmw_le_64, MEMSUFFIX) (int dst)
{ {
for (; dst < 32; dst++, T0 += 4) { for (; dst < 32; dst++, T0 += 4) {
ugpr(dst) = glue(ld32r, MEMSUFFIX)((uint64_t)T0); env->gpr[dst] = glue(ld32r, MEMSUFFIX)((uint64_t)T0);
} }
} }
#endif #endif
@ -85,7 +85,7 @@ void glue(do_lmw_le_64, MEMSUFFIX) (int dst)
void glue(do_stmw_le, MEMSUFFIX) (int src) void glue(do_stmw_le, MEMSUFFIX) (int src)
{ {
for (; src < 32; src++, T0 += 4) { for (; src < 32; src++, T0 += 4) {
glue(st32r, MEMSUFFIX)((uint32_t)T0, ugpr(src)); glue(st32r, MEMSUFFIX)((uint32_t)T0, env->gpr[src]);
} }
} }
@ -93,7 +93,7 @@ void glue(do_stmw_le, MEMSUFFIX) (int src)
void glue(do_stmw_le_64, MEMSUFFIX) (int src) void glue(do_stmw_le_64, MEMSUFFIX) (int src)
{ {
for (; src < 32; src++, T0 += 4) { for (; src < 32; src++, T0 += 4) {
glue(st32r, MEMSUFFIX)((uint64_t)T0, ugpr(src)); glue(st32r, MEMSUFFIX)((uint64_t)T0, env->gpr[src]);
} }
} }
#endif #endif
@ -104,7 +104,7 @@ void glue(do_lsw, MEMSUFFIX) (int dst)
int sh; int sh;
for (; T1 > 3; T1 -= 4, T0 += 4) { for (; T1 > 3; T1 -= 4, T0 += 4) {
ugpr(dst++) = glue(ldl, MEMSUFFIX)((uint32_t)T0); env->gpr[dst++] = glue(ldl, MEMSUFFIX)((uint32_t)T0);
if (unlikely(dst == 32)) if (unlikely(dst == 32))
dst = 0; dst = 0;
} }
@ -113,7 +113,7 @@ void glue(do_lsw, MEMSUFFIX) (int dst)
for (sh = 24; T1 > 0; T1--, T0++, sh -= 8) { for (sh = 24; T1 > 0; T1--, T0++, sh -= 8) {
tmp |= glue(ldub, MEMSUFFIX)((uint32_t)T0) << sh; tmp |= glue(ldub, MEMSUFFIX)((uint32_t)T0) << sh;
} }
ugpr(dst) = tmp; env->gpr[dst] = tmp;
} }
} }
@ -124,7 +124,7 @@ void glue(do_lsw_64, MEMSUFFIX) (int dst)
int sh; int sh;
for (; T1 > 3; T1 -= 4, T0 += 4) { for (; T1 > 3; T1 -= 4, T0 += 4) {
ugpr(dst++) = glue(ldl, MEMSUFFIX)((uint64_t)T0); env->gpr[dst++] = glue(ldl, MEMSUFFIX)((uint64_t)T0);
if (unlikely(dst == 32)) if (unlikely(dst == 32))
dst = 0; dst = 0;
} }
@ -133,7 +133,7 @@ void glue(do_lsw_64, MEMSUFFIX) (int dst)
for (sh = 24; T1 > 0; T1--, T0++, sh -= 8) { for (sh = 24; T1 > 0; T1--, T0++, sh -= 8) {
tmp |= glue(ldub, MEMSUFFIX)((uint64_t)T0) << sh; tmp |= glue(ldub, MEMSUFFIX)((uint64_t)T0) << sh;
} }
ugpr(dst) = tmp; env->gpr[dst] = tmp;
} }
} }
#endif #endif
@ -143,13 +143,13 @@ void glue(do_stsw, MEMSUFFIX) (int src)
int sh; int sh;
for (; T1 > 3; T1 -= 4, T0 += 4) { for (; T1 > 3; T1 -= 4, T0 += 4) {
glue(stl, MEMSUFFIX)((uint32_t)T0, ugpr(src++)); glue(stl, MEMSUFFIX)((uint32_t)T0, env->gpr[src++]);
if (unlikely(src == 32)) if (unlikely(src == 32))
src = 0; src = 0;
} }
if (unlikely(T1 != 0)) { if (unlikely(T1 != 0)) {
for (sh = 24; T1 > 0; T1--, T0++, sh -= 8) for (sh = 24; T1 > 0; T1--, T0++, sh -= 8)
glue(stb, MEMSUFFIX)((uint32_t)T0, (ugpr(src) >> sh) & 0xFF); glue(stb, MEMSUFFIX)((uint32_t)T0, (env->gpr[src] >> sh) & 0xFF);
} }
} }
@ -159,13 +159,13 @@ void glue(do_stsw_64, MEMSUFFIX) (int src)
int sh; int sh;
for (; T1 > 3; T1 -= 4, T0 += 4) { for (; T1 > 3; T1 -= 4, T0 += 4) {
glue(stl, MEMSUFFIX)((uint64_t)T0, ugpr(src++)); glue(stl, MEMSUFFIX)((uint64_t)T0, env->gpr[src++]);
if (unlikely(src == 32)) if (unlikely(src == 32))
src = 0; src = 0;
} }
if (unlikely(T1 != 0)) { if (unlikely(T1 != 0)) {
for (sh = 24; T1 > 0; T1--, T0++, sh -= 8) for (sh = 24; T1 > 0; T1--, T0++, sh -= 8)
glue(stb, MEMSUFFIX)((uint64_t)T0, (ugpr(src) >> sh) & 0xFF); glue(stb, MEMSUFFIX)((uint64_t)T0, (env->gpr[src] >> sh) & 0xFF);
} }
} }
#endif #endif
@ -176,7 +176,7 @@ void glue(do_lsw_le, MEMSUFFIX) (int dst)
int sh; int sh;
for (; T1 > 3; T1 -= 4, T0 += 4) { for (; T1 > 3; T1 -= 4, T0 += 4) {
ugpr(dst++) = glue(ld32r, MEMSUFFIX)((uint32_t)T0); env->gpr[dst++] = glue(ld32r, MEMSUFFIX)((uint32_t)T0);
if (unlikely(dst == 32)) if (unlikely(dst == 32))
dst = 0; dst = 0;
} }
@ -185,7 +185,7 @@ void glue(do_lsw_le, MEMSUFFIX) (int dst)
for (sh = 0; T1 > 0; T1--, T0++, sh += 8) { for (sh = 0; T1 > 0; T1--, T0++, sh += 8) {
tmp |= glue(ldub, MEMSUFFIX)((uint32_t)T0) << sh; tmp |= glue(ldub, MEMSUFFIX)((uint32_t)T0) << sh;
} }
ugpr(dst) = tmp; env->gpr[dst] = tmp;
} }
} }
@ -196,7 +196,7 @@ void glue(do_lsw_le_64, MEMSUFFIX) (int dst)
int sh; int sh;
for (; T1 > 3; T1 -= 4, T0 += 4) { for (; T1 > 3; T1 -= 4, T0 += 4) {
ugpr(dst++) = glue(ld32r, MEMSUFFIX)((uint64_t)T0); env->gpr[dst++] = glue(ld32r, MEMSUFFIX)((uint64_t)T0);
if (unlikely(dst == 32)) if (unlikely(dst == 32))
dst = 0; dst = 0;
} }
@ -205,7 +205,7 @@ void glue(do_lsw_le_64, MEMSUFFIX) (int dst)
for (sh = 0; T1 > 0; T1--, T0++, sh += 8) { for (sh = 0; T1 > 0; T1--, T0++, sh += 8) {
tmp |= glue(ldub, MEMSUFFIX)((uint64_t)T0) << sh; tmp |= glue(ldub, MEMSUFFIX)((uint64_t)T0) << sh;
} }
ugpr(dst) = tmp; env->gpr[dst] = tmp;
} }
} }
#endif #endif
@ -215,13 +215,13 @@ void glue(do_stsw_le, MEMSUFFIX) (int src)
int sh; int sh;
for (; T1 > 3; T1 -= 4, T0 += 4) { for (; T1 > 3; T1 -= 4, T0 += 4) {
glue(st32r, MEMSUFFIX)((uint32_t)T0, ugpr(src++)); glue(st32r, MEMSUFFIX)((uint32_t)T0, env->gpr[src++]);
if (unlikely(src == 32)) if (unlikely(src == 32))
src = 0; src = 0;
} }
if (unlikely(T1 != 0)) { if (unlikely(T1 != 0)) {
for (sh = 0; T1 > 0; T1--, T0++, sh += 8) for (sh = 0; T1 > 0; T1--, T0++, sh += 8)
glue(stb, MEMSUFFIX)((uint32_t)T0, (ugpr(src) >> sh) & 0xFF); glue(stb, MEMSUFFIX)((uint32_t)T0, (env->gpr[src] >> sh) & 0xFF);
} }
} }
@ -231,13 +231,13 @@ void glue(do_stsw_le_64, MEMSUFFIX) (int src)
int sh; int sh;
for (; T1 > 3; T1 -= 4, T0 += 4) { for (; T1 > 3; T1 -= 4, T0 += 4) {
glue(st32r, MEMSUFFIX)((uint64_t)T0, ugpr(src++)); glue(st32r, MEMSUFFIX)((uint64_t)T0, env->gpr[src++]);
if (unlikely(src == 32)) if (unlikely(src == 32))
src = 0; src = 0;
} }
if (unlikely(T1 != 0)) { if (unlikely(T1 != 0)) {
for (sh = 0; T1 > 0; T1--, T0++, sh += 8) for (sh = 0; T1 > 0; T1--, T0++, sh += 8)
glue(stb, MEMSUFFIX)((uint64_t)T0, (ugpr(src) >> sh) & 0xFF); glue(stb, MEMSUFFIX)((uint64_t)T0, (env->gpr[src] >> sh) & 0xFF);
} }
} }
#endif #endif
@ -283,7 +283,7 @@ void glue(do_POWER_lscbx, MEMSUFFIX) (int dest, int ra, int rb)
c = glue(ldub, MEMSUFFIX)((uint32_t)T0++); c = glue(ldub, MEMSUFFIX)((uint32_t)T0++);
/* ra (if not 0) and rb are never modified */ /* ra (if not 0) and rb are never modified */
if (likely(reg != rb && (ra == 0 || reg != ra))) { if (likely(reg != rb && (ra == 0 || reg != ra))) {
ugpr(reg) = (ugpr(reg) & ~(0xFF << d)) | (c << d); env->gpr[reg] = (env->gpr[reg] & ~(0xFF << d)) | (c << d);
} }
if (unlikely(c == T2)) if (unlikely(c == T2))
break; break;