qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: JIANG Muhui <1925512@bugs.launchpad.net>
To: qemu-devel@nongnu.org
Subject: [Bug 1925512] Re: UNDEFINED case for instruction BLX
Date: Thu, 22 Apr 2021 19:29:59 -0000	[thread overview]
Message-ID: <161911980004.9771.6887610667740746888.malone@wampee.canonical.com> (raw)
In-Reply-To: 161909962601.31655.7052824363126074861.malonedeb@soybean.canonical.com

Hi

I still feel QEMU's implementation is not right. Could you please check
it again.

According to https://developer.arm.com/documentation/ddi0406/c
/Application-Level-Architecture/Instruction-Details/Alphabetical-list-
of-instructions/BL--BLX--immediate-?lang=en

The encoding T2 for BLX is below:

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 
 1  1  1  1  0  S |       imm10H     | 1  1 J1  0 J2 |       imm10L      |H

In the ASL of ARM,  we have  H == '1' then UNDEFINED;

Symbol *H* represents the last bit of this instruction. I am not sure
whether a->imm includes the symbol *H*. I double checked the file
`t32.decode` and it seems so (It would be great if you can tell me what
a->imm indeed represents in BLX).

However, UNDEFINED means unallocated encoding in ARM manual. The right
behavior might be something like below:

    if (s->thumb && (a->imm & 2)) {
        unallocated_encoding(s);
        return true;
    }

Correct me if I am wrong. I can also provide test case if you need. Many
Thanks

Regards
Muhui

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1925512

Title:
  UNDEFINED case for instruction BLX

Status in QEMU:
  Invalid

Bug description:
  Hi

  I refer to the instruction BLX imm (T2 encoding) in ARMv7 (Thumb
  mode).

  11110 S imm10H  11 J1 0 J2 imm10L H

  
  if H == '1' then UNDEFINED;
  I1 = NOT(J1 EOR S);  I2 = NOT(J2 EOR S);  imm32 = SignExtend(S:I1:I2:imm10H:imm10L:'00', 32);
  targetInstrSet = InstrSet_A32;
  if InITBlock() && !LastInITBlock() then UNPREDICTABLE;

  According to the manual, if H equals to 1, this instruction should be
  an UNDEFINED instruction. However, it seems QEMU does not check this
  constraint in function trans_BLX_i. Thanks

  Regards
  Muhui

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1925512/+subscriptions


  parent reply	other threads:[~2021-04-22 19:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-22 13:53 [Bug 1925512] [NEW] UNDEFINED case for instruction BLX JIANG Muhui
2021-04-22 15:00 ` [Bug 1925512] " Philippe Mathieu-Daudé
2021-04-22 16:06 ` Richard Henderson
2021-04-22 19:29 ` JIANG Muhui [this message]
2021-04-22 21:38 ` Richard Henderson
2021-04-23  6:52 ` JIANG Muhui
2021-04-23 15:20 ` Richard Henderson
2021-04-23 17:14 ` Richard Henderson
2021-05-26 15:38 ` Thomas Huth
2021-08-25  7:11 ` Thomas Huth

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=161911980004.9771.6887610667740746888.malone@wampee.canonical.com \
    --to=1925512@bugs.launchpad.net \
    --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).