diff options
author | Bill Wendling <morbo@google.com> | 2019-10-30 14:04:18 -0700 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2020-06-16 15:00:07 +0200 |
commit | f3154609b29ad92746c77d46bca03e3b79431437 (patch) | |
tree | 09c586c0a8ba790c1ec46895111e73d15e09e741 | |
parent | 41a7f56bf5d1c9106106ca7f496c070fbd1b68f9 (diff) | |
download | kvm-unit-tests-f3154609b29ad92746c77d46bca03e3b79431437.tar.gz |
x86: use a non-negative number in shift
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]
Message-Id: <20200514192626.9950-9-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
-rw-r--r-- | x86/svm_tests.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/x86/svm_tests.c b/x86/svm_tests.c index c1abd55..a645d66 100644 --- a/x86/svm_tests.c +++ b/x86/svm_tests.c @@ -890,7 +890,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) |