From 44dd33ba8f60b5f513399f673351127af16bd304 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Wed, 15 Oct 2014 18:06:07 +0200 Subject: s390x: Implement SAM{24,31,64} The SAM instructions simply change 2 bits in PSW.MASK to advertise the current memory mode. While we can't fully guarantee that 31 bit mode (or even remotely 24 bit mode) actually work correctly, we don't check whether lpswe modifies these bits, so we shouldn't keep the guest from executing SAM instructions either. This patch implements all SAM instrutions with their actual PSW changing semantics, making more recent Linux kernels boot properly which do issue a SAM31 call during early boot. Signed-off-by: Alexander Graf Reviewed-by: Bastian Koppelmann Reviewed-by: Richard Henderson --- target-s390x/translate.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'target-s390x/translate.c') diff --git a/target-s390x/translate.c b/target-s390x/translate.c index 0cb036f..dbf1993 100644 --- a/target-s390x/translate.c +++ b/target-s390x/translate.c @@ -2925,6 +2925,18 @@ static ExitStatus op_sacf(DisasContext *s, DisasOps *o) /* Addressing mode has changed, so end the block. */ return EXIT_PC_STALE; } + +static ExitStatus op_sam(DisasContext *s, DisasOps *o) +{ + int sam = s->insn->data; + TCGv_i64 tsam = tcg_const_i64(sam); + + /* Overwrite PSW_MASK_64 and PSW_MASK_32 */ + tcg_gen_deposit_i64(psw_mask, psw_mask, tsam, 31, 2); + + tcg_temp_free_i64(tsam); + return EXIT_PC_STALE; +} #endif static ExitStatus op_sar(DisasContext *s, DisasOps *o) -- cgit v1.1