qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, rth@twiddle.net
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] s390x: Implement SAM{24,31,64}
Date: Tue, 04 Nov 2014 22:32:13 +0100	[thread overview]
Message-ID: <545945DD.2030009@suse.de> (raw)
In-Reply-To: <54594CE5.30505@mail.uni-paderborn.de>



On 04.11.14 23:02, Bastian Koppelmann wrote:
> 
> On 11/04/2014 08:19 PM, Alexander Graf wrote:
>> +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;
>> +}
>> +
> You forgot to zero out bits 64-103 of psw, in case of sam24 and bits
> 64-96 in case of sam31.

These are the address bits. PSW contains an "addr" and a "mask" field.
"addr" is PC, "mask" is similar to MSR on PPC or EFER on x86.

Other bits of the code will take care of masking out unused address bits
for 31 bit mode (check out fix_address() in mem_helper.c for example).

We don't really implent 24bit addressing mode - and I doubt we will in
the near future. Today our only target is Linux - and there simply is no
24bit Linux out there ;).

> Also you forgot to add 2 (the instruction length) to bits 64-127 of psw

This happens automatically. Each instruction carries its length in the
first 2 bits, so the instruction walker can automatically increment PC.

> or if this is a target of EXECUTE/EXECUTE RELATIVE LONG add 4/6.

EXECUTE is tricky. Basically EXECUTE is an instruction that behaves like
the instruction that a memory reference points to, but at the location
the EXECUTE is actually in. Today, we treat EXECUTE as a very special
instruction with only a small number of subinstructions that it handles
(namely the ones gcc emits).

But thanks a lot for the thorough review :)


Alex

  reply	other threads:[~2014-11-04 21:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-04 20:19 [Qemu-devel] [PATCH] s390x: Implement SAM{24,31,64} Alexander Graf
2014-11-04 22:02 ` Bastian Koppelmann
2014-11-04 21:32   ` Alexander Graf [this message]
2014-11-04 23:09 ` Bastian Koppelmann
2014-11-05  6:53 ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=545945DD.2030009@suse.de \
    --to=agraf@suse.de \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).