All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Smolov <smolov@ispras.ru>
To: qemu-arm@nongnu.org
Subject: [Qemu-arm] [aarch64] how to get the value is stored by MSR insn
Date: Wed, 17 May 2017 17:01:45 +0300	[thread overview]
Message-ID: <591C57C9.6070202@ispras.ru> (raw)

Hello, List!

I'm running an Aarch64 assembler program on QEMU. The program starts 
from the following instructions:

movz x0, #0x50, LSL #0
msr vbar_el1, x0

My task is to print the value is stored into the vbar_el1 register to 
the console (it should be equal to 0x50, I think).

Here is what I have in target/arm/translate-a64.c that is related to MSR 
instruction simulation:

[code]
/* C5.6.129 MRS - move from system register
  * C5.6.131 MSR (register) - move to system register
  * C5.6.204 SYS
  * C5.6.205 SYSL
  * These are all essentially the same insn in 'read' and 'write'
  * versions, with varying op0 fields.
  */
static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
                        unsigned int op0, unsigned int op1, unsigned int 
op2,
                        unsigned int crn, unsigned int crm, unsigned int rt)
{
....
if (isread) {
...
} else {
if (ri->type & ARM_CP_CONST) {
             /* If not forbidden by access permissions, treat as WI */
             return;
         } else if (ri->writefn) {
             qemu_log("is-writefn\n");
             TCGv_ptr tmpptr;
             tmpptr = tcg_const_ptr(ri);
             gen_helper_set_cp_reg64(cpu_env, tmpptr, tcg_rt);
             tcg_temp_free_ptr(tmpptr);
         } else {
             tcg_gen_st_i64(tcg_rt, cpu_env, ri->fieldoffset);
         }
}
[code]

In my case the branch "else if (ri->writefn)" is executed. I've tried to 
take the value that is stored to vbar_el1 from tcg_rt variable with the 
help of GET_TCGV_I64 macro, but it returns the value (0x19) that is 
different from the right one (0x50).

In what direction should I dig?

-- 
Sincerely yours,
Sergey Smolov


                 reply	other threads:[~2017-05-17 14:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=591C57C9.6070202@ispras.ru \
    --to=smolov@ispras.ru \
    --cc=qemu-arm@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.