From: Thomas Huth <thuth@redhat.com>
To: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>
Cc: Laurent Vivier <lvivier@redhat.com>,
Drew Jones <drjones@redhat.com>, Bill Wendling <morbo@google.com>
Subject: [kvm-unit-tests PATCH 08/11] x86: use a non-negative number in shift
Date: Thu, 14 May 2020 21:26:23 +0200 [thread overview]
Message-ID: <20200514192626.9950-9-thuth@redhat.com> (raw)
In-Reply-To: <20200514192626.9950-1-thuth@redhat.com>
From: Bill Wendling <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>
[thuth: Rebased to master - code is in svm_tests.c instead of svm.c now]
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
x86/svm_tests.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x86/svm_tests.c b/x86/svm_tests.c
index 2f53b8f..be1bddf 100644
--- a/x86/svm_tests.c
+++ b/x86/svm_tests.c
@@ -844,7 +844,7 @@ static bool npt_rw_l1mmio_check(struct svm_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 svm_test *test)
--
2.18.1
next prev parent reply other threads:[~2020-05-14 19:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-14 19:26 [kvm-unit-tests PATCH 00/11] Misc fixes and CI improvements Thomas Huth
2020-05-14 19:26 ` [kvm-unit-tests PATCH 01/11] x86/access: Fix phys-bits parameter Thomas Huth
2020-05-14 19:26 ` [kvm-unit-tests PATCH 02/11] Fix out-of-tree builds Thomas Huth
2020-05-14 19:26 ` [kvm-unit-tests PATCH 03/11] x86: avoid multiply defined symbol Thomas Huth
2020-05-14 19:26 ` [kvm-unit-tests PATCH 04/11] Fixes for the umip test Thomas Huth
2020-05-14 19:26 ` [kvm-unit-tests PATCH 05/11] Always compile the kvm-unit-tests with -fno-common Thomas Huth
2020-05-14 19:26 ` [kvm-unit-tests PATCH 06/11] Fix powerpc issue with the linker from Fedora 32 Thomas Huth
2020-05-14 19:26 ` [kvm-unit-tests PATCH 07/11] Update the gitlab-ci to " Thomas Huth
2020-05-14 19:26 ` Thomas Huth [this message]
2020-05-14 19:26 ` [kvm-unit-tests PATCH 09/11] x86: use inline asm to retrieve stack pointer Thomas Huth
2020-05-14 19:26 ` [kvm-unit-tests PATCH 10/11] vmx_tests: Silence warning from Clang Thomas Huth
2020-05-14 19:26 ` [kvm-unit-tests PATCH 11/11] Compile the kvm-unit-tests also with Clang 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=20200514192626.9950-9-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lvivier@redhat.com \
--cc=morbo@google.com \
--cc=pbonzini@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 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.