summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@amacapital.net>2014-10-20 15:31:31 -0700
committerAndy Lutomirski <luto@amacapital.net>2014-10-20 15:31:31 -0700
commit26cc77ca7d1eb7697aec1b5f6706b7bf8aebc94f (patch)
tree1d25b0981097184df73704992e3d2b0e24cd2635
parent77e505073b4c5362eef23bb871db58f5d8e3b1dc (diff)
downloadmisc-tests-26cc77ca7d1eb7697aec1b5f6706b7bf8aebc94f.tar.gz
Add lsl to timing_test and fix build
-rw-r--r--Makefile2
-rw-r--r--timing_test.cc24
2 files changed, 25 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 31f09b8..934516a 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ SIMPLE_C_TARGETS := dump-vsyscall context_switch_latency kernel_pf user_visible_
SIMPLE_CC_TARGETS := evil-clock-test
-SPLIT_C_TARGETS := dump-vdso dump-vvar syscall_exit_regs sigreturn test_mremap_vdso dump_all_pmcs
+SPLIT_C_TARGETS := dump-vdso dump-vvar syscall_exit_regs sigreturn dump_all_pmcs
SPLIT_CC_TARGETS := timing_test test_vsyscall test_vdso_parser
ALL_TARGETS := $(SIMPLE_C_TARGETS) $(SIMPLE_CC_TARGETS) $(SPLIT_C_TARGETS:%=%_64) $(SPLIT_CC_TARGETS:%=%_64) $(SPLIT_C_TARGETS:%=%_32) $(SPLIT_CC_TARGETS:%=%_32) syscall32_from_64
diff --git a/timing_test.cc b/timing_test.cc
index cf5e904..3d3b5e5 100644
--- a/timing_test.cc
+++ b/timing_test.cc
@@ -85,6 +85,30 @@ int main(int argc, char **argv)
unsigned int a, c, d;
asm volatile ("rdtscp" : "=a" (a), "=c" (c), "=d" (d));
}
+ } else if (!strcmp(mode, "lsl15")) {
+ for (size_t i = 0; i < loops; ++i) {
+ uint16_t index = (15 << 3) + 3;
+ uint32_t limit;
+ asm volatile ("lsl %[index], %[limit]"
+ : [limit] "=r" (limit)
+ : [index] "r" (index) : "cc");
+ }
+ } else if (!strcmp(mode, "lsl100")) {
+ for (size_t i = 0; i < loops; ++i) {
+ uint16_t index = (100 << 3) + 3;
+ uint32_t limit;
+ asm volatile ("lsl %[index], %[limit]"
+ : [limit] "=r" (limit)
+ : [index] "r" (index) : "cc");
+ }
+ } else if (!strcmp(mode, "sgdt")) {
+ struct {
+ unsigned short limit;
+ unsigned long base;
+ } __attribute__((packed)) val;
+
+ for (size_t i = 0; i < loops; ++i)
+ asm volatile ("sgdt %0" : "=m" (val));
} else if (!strcmp(mode, "gettimeofday")) {
struct timeval tv;
for (size_t i = 0; i < loops; ++i)