diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-11-30 16:24:30 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-11-30 16:24:30 +0000 |
commit | bdb4b68907a88090148c5ab9aea17b67f9ef2542 (patch) | |
tree | 7bf16c7549abe5d73495817581befc3755b26f3a /target-ppc/op_helper.c | |
parent | dfbc799d8e94d26ab2e6ad4a65dc97fd8fb6ece6 (diff) |
target-ppc: convert lscbx instruction to TCG
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5829 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-ppc/op_helper.c')
-rw-r--r-- | target-ppc/op_helper.c | 54 |
1 files changed, 39 insertions, 15 deletions
diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c index 75fbefbb96..d0a78b98b0 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -24,21 +24,6 @@ #include "helper_regs.h" #include "op_helper.h" -#define MEMSUFFIX _raw -#include "op_helper.h" -#include "op_helper_mem.h" -#if !defined(CONFIG_USER_ONLY) -#define MEMSUFFIX _user -#include "op_helper.h" -#include "op_helper_mem.h" -#define MEMSUFFIX _kernel -#include "op_helper.h" -#include "op_helper_mem.h" -#define MEMSUFFIX _hypv -#include "op_helper.h" -#include "op_helper_mem.h" -#endif - //#define DEBUG_OP //#define DEBUG_EXCEPTIONS //#define DEBUG_SOFTWARE_TLB @@ -329,6 +314,45 @@ void helper_icbi(target_ulong addr) tb_invalidate_page_range(addr, addr + env->icache_line_size); } +// XXX: to be tested +target_ulong helper_lscbx (target_ulong addr, uint32_t reg, uint32_t ra, uint32_t rb) +{ + int i, c, d; +#ifdef CONFIG_USER_ONLY +#define ldfun ldub_raw +#else + int (*ldfun)(target_ulong); + + switch (env->mmu_idx) { + default: + case 0: ldfun = ldub_user; + break; + case 1: ldfun = ldub_kernel; + break; + case 2: ldfun = ldub_hypv; + break; + } +#endif + d = 24; + for (i = 0; i < xer_bc; i++) { + c = ldfun((uint32_t)addr++); + /* ra (if not 0) and rb are never modified */ + if (likely(reg != rb && (ra == 0 || reg != ra))) { + env->gpr[reg] = (env->gpr[reg] & ~(0xFF << d)) | (c << d); + } + if (unlikely(c == xer_cmp)) + break; + if (likely(d != 0)) { + d -= 8; + } else { + d = 24; + reg++; + reg = reg & 0x1F; + } + } + return i; +} + /*****************************************************************************/ /* Fixed point operations helpers */ #if defined(TARGET_PPC64) |