All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-arm] [aarch64] how to get the value is stored by MSR insn
@ 2017-05-17 14:01 Sergey Smolov
  0 siblings, 0 replies; only message in thread
From: Sergey Smolov @ 2017-05-17 14:01 UTC (permalink / raw)
  To: qemu-arm

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-05-17 14:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-17 14:01 [Qemu-arm] [aarch64] how to get the value is stored by MSR insn Sergey Smolov

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.