qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org
Subject: Re: [PATCH] target/i386: svm: fix sign extension of exit code
Date: Tue, 18 Nov 2025 09:31:26 +0100	[thread overview]
Message-ID: <24c4e4cf-ddce-4e93-8f0c-33e48cdc130c@linaro.org> (raw)
In-Reply-To: <851ab1f1-c05b-48e9-a08d-2076fa9ab67c@redhat.com>

On 11/17/25 12:32, Paolo Bonzini wrote:
> On 11/17/25 10:42, Richard Henderson wrote:
>> On 11/15/25 01:26, Paolo Bonzini wrote:
>>> -void cpu_vmexit(CPUX86State *env, uint32_t exit_code, uint64_t exit_info_1,
>>> +void cpu_vmexit(CPUX86State *env, uint64_t exit_code, uint64_t exit_info_1,
>>>                   uintptr_t retaddr)
>>>   {
>>>       CPUState *cs = env_cpu(env);
>>> @@ -732,7 +732,7 @@ void cpu_vmexit(CPUX86State *env, uint32_t exit_code, uint64_t 
>>> exit_info_1,
>>>       qemu_log_mask(CPU_LOG_TB_IN_ASM, "vmexit(%08x, %016" PRIx64 ", %016"
>>>                     PRIx64 ", " TARGET_FMT_lx ")!\n",
>>> -                  exit_code, exit_info_1,
>>> +                  (uint32_t)exit_code, exit_info_1,
>>
>> Why cast instead of printing all 64 bits?
> 
> Because in practice exit_code is either a very small negative value (-1...-4) or a 
> positive value.  For QEMU in addition the positive value will also be small (less than 16 
> bits); values between 0x8000_0000 and 0xffff_ffff could happen in principle but are for 
> use by software and by the processor[1].  So the high 32 bits are basically unused, and 
> the cast removes eight zeroes or f's from the log.

Then maybe you really want the signed int64_t?


r~


  reply	other threads:[~2025-11-18  8:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-15  0:26 [PATCH] target/i386: svm: fix sign extension of exit code Paolo Bonzini
2025-11-17  9:42 ` Richard Henderson
2025-11-17 11:32   ` Paolo Bonzini
2025-11-18  8:31     ` Richard Henderson [this message]
2025-11-18 13:07       ` Paolo Bonzini
2025-11-19 10:59         ` Richard Henderson

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=24c4e4cf-ddce-4e93-8f0c-33e48cdc130c@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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).