From: Peter Maydell <peter.maydell@linaro.org>
To: Sergey Smolov <smolov@ispras.ru>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] MIPS 'move' insn emulation
Date: Tue, 12 Sep 2017 15:32:45 +0100 [thread overview]
Message-ID: <CAFEAcA-to=vWWBHoxZRX-ExcbDe0OTMwpHunE7HXaYA0GE+ccw@mail.gmail.com> (raw)
In-Reply-To: <59B7EBC5.9060908@ispras.ru>
On 12 September 2017 at 15:14, Sergey Smolov <smolov@ispras.ru> wrote:
> I've the code I probably need to modify in target/mips/translate.c:
>
> [code]
>
> static void gen_logic(DisasContext *ctx, uint32_t opc,
> int rd, int rs, int rt)
> {
> ...
> } else if (rs != 0 && rt == 0) {
> tcg_gen_mov_tl(cpu_gpr[rd], cpu_gpr[rs]);
> }
>
> [/code]
>
> I suppose that for my assembler program cpu_gpr[rs] here should contain 0x7
> value at runtime. Is it possible to extract this value somehow? I've tried
> the following constructions:
>
> GET_TCG_I32(cpu_gpr[rs])
> ((CPUMIPSState *)tcg_ctx.cpu)->active_tc.gpr[rs]
>
> but they do not provide me the correct value.
You can't do this in this bit of the code. The functions in
translate.c are called at "translate time", when we convert
MIPS assembly into x86 code to run on the host. At this point
we don't know what the values in MIPS registers are, because
we're generating code that will later be run multiple times
perhaps with different values. The register contents are only
known later, at "run time".
thanks
-- PMM
next prev parent reply other threads:[~2017-09-12 14:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-12 14:14 [Qemu-devel] MIPS 'move' insn emulation Sergey Smolov
2017-09-12 14:32 ` Peter Maydell [this message]
2017-09-12 14:53 ` Sergey Smolov
2017-09-12 15:06 ` Peter Maydell
2017-09-13 7:29 ` Sergey Smolov
2017-09-13 11:01 ` Peter Maydell
2017-09-13 14:20 ` Yongbok Kim
2017-09-14 13:49 ` Sergey Smolov
2017-09-14 13:58 ` Peter Maydell
2017-09-14 14:16 ` Sergey Smolov
2017-09-14 14:23 ` Yongbok Kim
2017-09-14 14:29 ` Peter Maydell
2017-09-14 16:32 ` Sergey Smolov
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='CAFEAcA-to=vWWBHoxZRX-ExcbDe0OTMwpHunE7HXaYA0GE+ccw@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=smolov@ispras.ru \
/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).