From 4b26f75d23da5f2110667f75713c4b376d758f43 Mon Sep 17 00:00:00 2001 From: David Given Date: Wed, 6 Jun 2018 12:49:21 +0900 Subject: [PATCH] Hang on, the 68k is big-endian --- I'm extracting words (and bytes) from longs incorrectly. --- plat/linux68k/emu/m68kconf.h | 4 ++-- plat/linux68k/emu/sim.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plat/linux68k/emu/m68kconf.h b/plat/linux68k/emu/m68kconf.h index c5c9b1aef..e714292b1 100755 --- a/plat/linux68k/emu/m68kconf.h +++ b/plat/linux68k/emu/m68kconf.h @@ -56,8 +56,8 @@ /* ======================================================================== */ /* Turn ON if you want to use the following M68K variants */ -#define M68K_EMULATE_010 OPT_ON -#define M68K_EMULATE_EC020 OPT_ON +#define M68K_EMULATE_010 OPT_OFF +#define M68K_EMULATE_EC020 OPT_OFF #define M68K_EMULATE_020 OPT_ON diff --git a/plat/linux68k/emu/sim.c b/plat/linux68k/emu/sim.c index d15ca1ed9..2fd81bfe4 100755 --- a/plat/linux68k/emu/sim.c +++ b/plat/linux68k/emu/sim.c @@ -84,7 +84,7 @@ unsigned int cpu_read_long(unsigned int address) case 0x00: return INIT_SP; case 0x04: return INIT_PC; case 0x80: syscall(); return 0x10000; - case 0x10000: return 0x4e73; /* rte */ + case 0x10000: return 0x4e734e73; /* rte; rte */ case 0x10004: return 0; default: return READ_LONG(g_ram, transform_address(address)); } @@ -94,14 +94,14 @@ unsigned int cpu_read_long(unsigned int address) unsigned int cpu_read_word(unsigned int address) { unsigned int l = cpu_read_long(address & ~3); - l >>= (address & 2) * 8; + l >>= 16 - (address & 2)*8; return l & 0xffff; } unsigned int cpu_read_byte(unsigned int address) { unsigned int l = cpu_read_long(address & ~3); - l >>= (address & 3) * 8; + l >>= 24 - (address & 3)*8; return l & 0xff; }