target-s390x: implement TRANSLATE AND TEST instruction

It is part of the basic zArchitecture instructions. Allow it to be call
from EXECUTE.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
Aurelien Jarno 2015-06-03 23:09:47 +02:00 committed by Alexander Graf
parent ed0bcecec1
commit 54f0077509
4 changed files with 37 additions and 0 deletions

View file

@ -509,6 +509,9 @@ uint32_t HELPER(ex)(CPUS390XState *env, uint32_t cc, uint64_t v1,
case 0xc00:
helper_tr(env, l, get_address(env, 0, b1, d1),
get_address(env, 0, b2, d2));
case 0xd00:
cc = helper_trt(env, l, get_address(env, 0, b1, d1),
get_address(env, 0, b2, d2));
break;
default:
goto abort;
@ -801,6 +804,27 @@ void HELPER(tr)(CPUS390XState *env, uint32_t len, uint64_t array,
}
}
uint32_t HELPER(trt)(CPUS390XState *env, uint32_t len, uint64_t array,
uint64_t trans)
{
uint32_t cc = 0;
int i;
for (i = 0; i <= len; i++) {
uint8_t byte = cpu_ldub_data(env, array + i);
uint8_t sbyte = cpu_ldub_data(env, trans + byte);
if (sbyte != 0) {
env->regs[1] = array + i;
env->regs[2] = (env->regs[2] & ~0xff) | sbyte;
cc = (i == len) ? 2 : 1;
break;
}
}
return cc;
}
#if !defined(CONFIG_USER_ONLY)
void HELPER(lctlg)(CPUS390XState *env, uint32_t r1, uint64_t a2, uint32_t r3)
{