summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2009-03-07 23:18:36 +0000
committer Aaron Giles <aaron@aarongiles.com>2009-03-07 23:18:36 +0000
commit43730cc591bff7c7514d06fdb3f12c767526b278 (patch)
treec1a051145bf7d8b5005fd0d421130adc9e6ba040
parenta97f308b83a900eff947d73f20a01bf8ec30eb8f (diff)
Fixed bug that caused 64-bit PowerPC systems to fetch opcodes in the wrong order.
-rw-r--r--src/emu/cpu/drcfe.c3
-rw-r--r--src/emu/cpu/powerpc/ppccom.c3
-rw-r--r--src/emu/cpu/powerpc/ppccom.h1
-rw-r--r--src/emu/cpu/powerpc/ppcfe.c2
4 files changed, 5 insertions, 4 deletions
diff --git a/src/emu/cpu/drcfe.c b/src/emu/cpu/drcfe.c
index d0a49c1d203..89ea426141a 100644
--- a/src/emu/cpu/drcfe.c
+++ b/src/emu/cpu/drcfe.c
@@ -60,7 +60,6 @@ struct _drcfe_state
const address_space *program; /* program address space for this CPU */
offs_t pageshift; /* shift to convert address to a page index */
cpu_translate_func translate; /* pointer to translation function */
- offs_t codexor; /* XOR to reach code */
/* opcode descriptor arrays */
opcode_desc * desc_live_list; /* head of list of live descriptions */
@@ -148,8 +147,6 @@ drcfe_state *drcfe_init(const device_config *cpu, const drcfe_config *config, vo
drcfe->program = memory_find_address_space(cpu, ADDRESS_SPACE_PROGRAM);
drcfe->pageshift = cpu_get_page_shift(cpu, ADDRESS_SPACE_PROGRAM);
drcfe->translate = (cpu_translate_func)device_get_info_fct(cpu, CPUINFO_FCT_TRANSLATE);
- if (cpu_get_endianness(cpu) != ENDIANNESS_NATIVE)
- drcfe->codexor = (cpu_get_databus_width(cpu, ADDRESS_SPACE_PROGRAM) / 8 / cpu_get_min_opcode_bytes(cpu) - 1) * cpu_get_min_opcode_bytes(cpu);
return drcfe;
}
diff --git a/src/emu/cpu/powerpc/ppccom.c b/src/emu/cpu/powerpc/ppccom.c
index b2f7b146a2c..def931e4ad5 100644
--- a/src/emu/cpu/powerpc/ppccom.c
+++ b/src/emu/cpu/powerpc/ppccom.c
@@ -200,6 +200,9 @@ void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT8 cap, int tb_di
ppc->program = memory_find_address_space(device, ADDRESS_SPACE_PROGRAM);
ppc->system_clock = (config != NULL) ? config->bus_frequency : device->clock;
ppc->tb_divisor = (ppc->tb_divisor * device->clock + ppc->system_clock / 2 - 1) / ppc->system_clock;
+ ppc->codexor = 0;
+ if (!(cap & PPCCAP_4XX) && cpu_get_endianness(device) != ENDIANNESS_NATIVE)
+ ppc->codexor = 4;
/* allocate the virtual TLB */
ppc->vtlb = vtlb_alloc(device, ADDRESS_SPACE_PROGRAM, (cap & PPCCAP_603_MMU) ? PPC603_FIXED_TLB_ENTRIES : 0, POWERPC_TLB_ENTRIES);
diff --git a/src/emu/cpu/powerpc/ppccom.h b/src/emu/cpu/powerpc/ppccom.h
index e1adca3af3a..e3ae41949ff 100644
--- a/src/emu/cpu/powerpc/ppccom.h
+++ b/src/emu/cpu/powerpc/ppccom.h
@@ -555,6 +555,7 @@ struct _powerpc_state
cpu_irq_callback irq_callback;
const device_config *device;
const address_space *program;
+ offs_t codexor;
UINT32 irq_pending;
UINT32 system_clock;
UINT32 cpu_clock;
diff --git a/src/emu/cpu/powerpc/ppcfe.c b/src/emu/cpu/powerpc/ppcfe.c
index 01acf7f1a4b..66176c1e618 100644
--- a/src/emu/cpu/powerpc/ppcfe.c
+++ b/src/emu/cpu/powerpc/ppcfe.c
@@ -143,7 +143,7 @@ int ppcfe_describe(void *param, opcode_desc *desc, const opcode_desc *prev)
}
/* fetch the opcode */
- op = desc->opptr.l[0] = memory_decrypted_read_dword(ppc->program, desc->physpc);
+ op = desc->opptr.l[0] = memory_decrypted_read_dword(ppc->program, desc->physpc ^ ppc->codexor);
/* all instructions are 4 bytes and default to a single cycle each */
desc->length = 4;