From: Bill Wendling <morbo@google.com>
To: kvm@vger.kernel.org, pbonzini@redhat.com, thuth@redhat.com
Cc: jmattson@google.com, sean.j.christopherson@intel.com,
Bill Wendling <morbo@google.com>
Subject: [kvm-unit-tests PATCH v3 5/6] x86: use a non-negative number in shift
Date: Wed, 30 Oct 2019 14:04:18 -0700 [thread overview]
Message-ID: <20191030210419.213407-6-morbo@google.com> (raw)
In-Reply-To: <20191030210419.213407-1-morbo@google.com>
Shifting a negative number is undefined. Clang complains about it:
x86/svm.c:1131:38: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
test->vmcb->control.tsc_offset = TSC_OFFSET_VALUE;
Using "~0ull" results in identical asm code:
before: movabsq $-281474976710656, %rsi
after: movabsq $-281474976710656, %rsi
Signed-off-by: Bill Wendling <morbo@google.com>
---
x86/svm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x86/svm.c b/x86/svm.c
index 4ddfaa4..cef43d5 100644
--- a/x86/svm.c
+++ b/x86/svm.c
@@ -1122,7 +1122,7 @@ static bool npt_rw_l1mmio_check(struct test *test)
}
#define TSC_ADJUST_VALUE (1ll << 32)
-#define TSC_OFFSET_VALUE (-1ll << 48)
+#define TSC_OFFSET_VALUE (~0ull << 48)
static bool ok;
static void tsc_adjust_prepare(struct test *test)
--
2.24.0.rc1.363.gb1bccd3e3d-goog
next prev parent reply other threads:[~2019-10-30 21:04 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-10 18:35 [kvm-unit-tests PATCH 0/3] Patches for clang compilation Bill Wendling
2019-10-10 18:35 ` [kvm-unit-tests PATCH 1/3] x86: emulator: use "SSE2" for the target Bill Wendling
2019-10-10 18:35 ` [kvm-unit-tests PATCH 2/3] pci: use uint64_t for unsigned long values Bill Wendling
2019-10-11 9:12 ` Alexandru Elisei
2019-10-12 8:26 ` [kvm-unit-tests PATCH 1/1] " Bill Wendling
2019-10-14 16:33 ` Alexandru Elisei
2019-10-14 16:36 ` Sean Christopherson
2019-10-10 18:35 ` [kvm-unit-tests PATCH 3/3] Makefile: use "-Werror" in cc-option Bill Wendling
2019-10-15 7:29 ` Thomas Huth
2019-10-15 7:57 ` Bill Wendling
2019-10-15 8:12 ` Thomas Huth
2019-10-14 19:24 ` [kvm-unit-tests PATCH 0/4] Patches for clang compilation Bill Wendling
2019-10-14 19:24 ` [kvm-unit-tests PATCH 1/4] x86: emulator: use "SSE2" for the target Bill Wendling
2019-10-14 19:24 ` [kvm-unit-tests PATCH 2/4] pci: cast the masks to the appropriate size Bill Wendling
2019-10-14 19:24 ` [kvm-unit-tests PATCH 3/4] Makefile: use "-Werror" in cc-option Bill Wendling
2019-10-14 19:24 ` [kvm-unit-tests PATCH 4/4] Makefile: add "cxx-option" for C++ builds Bill Wendling
2019-10-14 19:25 ` [kvm-unit-tests PATCH 0/4] Patches for clang compilation Bill Wendling
2019-10-14 23:56 ` Nadav Amit
2019-10-15 0:04 ` Bill Wendling
2019-10-15 0:04 ` [kvm-unit-tests PATCH v2 " Bill Wendling
2019-10-15 0:04 ` [kvm-unit-tests PATCH v2 1/4] x86: emulator: use "SSE2" for the target Bill Wendling
2019-10-15 0:04 ` [kvm-unit-tests PATCH v2 2/4] pci: cast the masks to the appropriate size Bill Wendling
2019-10-15 0:04 ` [kvm-unit-tests PATCH v2 3/4] Makefile: use "-Werror" in cc-option Bill Wendling
2019-10-15 0:04 ` [kvm-unit-tests PATCH v2 4/4] Makefile: add "cxx-option" for C++ builds Bill Wendling
2019-10-30 21:04 ` [kvm-unit-tests PATCH v3 0/6] Patches for clang compilation Bill Wendling
2019-10-30 21:04 ` [kvm-unit-tests PATCH v3 1/6] x86: emulator: use "SSE2" for the target Bill Wendling
2019-11-28 7:31 ` Thomas Huth
2019-10-30 21:04 ` [kvm-unit-tests PATCH v3 2/6] pci: cast the masks to the appropriate size Bill Wendling
2019-11-08 8:39 ` Thomas Huth
2019-10-30 21:04 ` [kvm-unit-tests PATCH v3 3/6] Makefile: use "-Werror" in cc-option Bill Wendling
2019-11-08 8:43 ` Thomas Huth
2019-11-08 20:36 ` Bill Wendling
2019-10-30 21:04 ` [kvm-unit-tests PATCH v3 4/6] Makefile: add "cxx-option" for C++ builds Bill Wendling
2019-11-08 8:48 ` Thomas Huth
2019-10-30 21:04 ` Bill Wendling [this message]
2019-11-08 8:31 ` [kvm-unit-tests PATCH v3 5/6] x86: use a non-negative number in shift Thomas Huth
2019-10-30 21:04 ` [kvm-unit-tests PATCH v3 6/6] x86: use inline asm to retrieve stack pointer Bill Wendling
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=20191030210419.213407-6-morbo@google.com \
--to=morbo@google.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=thuth@redhat.com \
/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).