move old packages to obsolete
[lttv.git] / trunk / tests / kernel / test-nop-speed.c
index f75af52589a94e1f4be4b3fff8e7f2be05f6a061..49085c2f8db7bb452d143051662fc0e739b5373d 100644 (file)
@@ -9,13 +9,18 @@
 #include <linux/marker.h>
 #include <asm/ptrace.h>
 
-#define NR_TESTS 20000
+#define NR_TESTS 10000000
+
+int var, var2;
 
 struct proc_dir_entry *pentry = NULL;
 
 void empty(void)
 {
        asm volatile ("");
+       var += 50;
+       var /= 10;
+       var *= var2;
 }
 
 void twobytesjump(void)
@@ -23,26 +28,69 @@ void twobytesjump(void)
        asm volatile ("jmp 1f\n\t"
                ".byte 0x00, 0x00, 0x00\n\t"
                "1:\n\t");
+       var += 50;
+       var /= 10;
+       var *= var2;
 }
 
 void fivebytesjump(void)
 {
-       asm (".byte 0xe9, 0x00, 0x00, 0x00, 0x00\n\t");
+       asm volatile (".byte 0xe9, 0x00, 0x00, 0x00, 0x00\n\t");
+       var += 50;
+       var /= 10;
+       var *= var2;
 }
 
 void threetwonops(void)
 {
-       asm (".byte 0x66,0x66,0x90,0x66,0x90\n\t");
+       asm volatile (".byte 0x66,0x66,0x90,0x66,0x90\n\t");
+       var += 50;
+       var /= 10;
+       var *= var2;
 }
 
 void fivebytesnop(void)
 {
-       asm (".byte 0x66,0x66,0x66,0x66,0x90\n\t");
+       asm volatile (".byte 0x66,0x66,0x66,0x66,0x90\n\t");
+       var += 50;
+       var /= 10;
+       var *= var2;
 }
 
 void fivebytespsixnop(void)
 {
-       asm (".byte 0x0f,0x1f,0x44,0x00,0\n\t");
+       asm volatile (".byte 0x0f,0x1f,0x44,0x00,0\n\t");
+       var += 50;
+       var /= 10;
+       var *= var2;
+}
+
+/*
+ * GENERIC_NOP1 GENERIC_NOP4,
+ * 1: nop
+ * _not_ nops in 64-bit mode.
+ * 4: leal 0x00(,%esi,1),%esi
+ */
+void genericfivebytesonefournops(void)
+{
+       asm volatile (".byte 0x90,0x8d,0x74,0x26,0x00\n\t");
+       var += 50;
+       var /= 10;
+       var *= var2;
+}
+
+/*
+ * K7_NOP4 ASM_NOP1
+ * 1: nop
+ * assumed _not_ to be nops in 64-bit mode.
+ * leal 0x00(,%eax,1),%eax
+ */
+void k7fivebytesonefournops(void)
+{
+       asm volatile (".byte 0x90,0x8d,0x44,0x20,0x00\n\t");
+       var += 50;
+       var /= 10;
+       var *= var2;
 }
 
 void perform_test(const char *name, void (*callback)(void))
@@ -75,6 +123,10 @@ static int my_open(struct inode *inode, struct file *file)
        perform_test("3/2 nops", threetwonops);
        perform_test("5-bytes nop with long prefix", fivebytesnop);
        perform_test("5-bytes P6 nop", fivebytespsixnop);
+#ifdef CONFIG_X86_32
+       perform_test("Generic 1/4 5-bytes nops", genericfivebytesonefournops);
+       perform_test("K7 1/4 5-bytes nops", k7fivebytesonefournops);
+#endif
 
        return -EPERM;
 }
@@ -100,5 +152,4 @@ void cleanup_module(void)
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Marker Test");
-
+MODULE_DESCRIPTION("NOP Test");
This page took 0.04261 seconds and 4 git commands to generate.