From: Sergey Smolov <smolov@ispras.ru>
To: QEMU Developers <qemu-devel@nongnu.org>
Subject: [Qemu-devel] MIPS 'move' insn emulation
Date: Tue, 12 Sep 2017 17:14:29 +0300 [thread overview]
Message-ID: <59B7EBC5.9060908@ispras.ru> (raw)
Hello, List!
I run MIPS assembler program on QEMU. The program is just a sample, here
is the code:
.text
addiu $8, $zero, 0x7
move $9, $8
sll $8, $8, 3
add $8, $8, $9
The program finishes on QEMU with the following values for registers,
and it's ok:
$8 - 0x3f
$9 - 0x7
Now I want to implement some logging features for MIPS assembler
programs. For example, I want to write a record to log every time the
'move' instruction writes some value to GPR register.
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. Could you help me in
solving this problem?
Thanks in advance,
Sergey Smolov
next reply other threads:[~2017-09-12 14:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-12 14:14 Sergey Smolov [this message]
2017-09-12 14:32 ` [Qemu-devel] MIPS 'move' insn emulation Peter Maydell
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=59B7EBC5.9060908@ispras.ru \
--to=smolov@ispras.ru \
--cc=qemu-devel@nongnu.org \
/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).