diff options
-rw-r--r-- | arch/x86/lib/delay_32.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/arch/x86/lib/delay_32.c b/arch/x86/lib/delay_32.c index d710f2d167bb..ef691316f8b6 100644 --- a/arch/x86/lib/delay_32.c +++ b/arch/x86/lib/delay_32.c | |||
@@ -3,6 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 1993 Linus Torvalds | 4 | * Copyright (C) 1993 Linus Torvalds |
5 | * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz> | 5 | * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz> |
6 | * Copyright (C) 2008 Jiri Hladky <hladky _dot_ jiri _at_ gmail _dot_ com> | ||
6 | * | 7 | * |
7 | * The __delay function must _NOT_ be inlined as its execution time | 8 | * The __delay function must _NOT_ be inlined as its execution time |
8 | * depends wildly on alignment on many x86 processors. The additional | 9 | * depends wildly on alignment on many x86 processors. The additional |
@@ -28,16 +29,22 @@ | |||
28 | /* simple loop based delay: */ | 29 | /* simple loop based delay: */ |
29 | static void delay_loop(unsigned long loops) | 30 | static void delay_loop(unsigned long loops) |
30 | { | 31 | { |
31 | int d0; | ||
32 | |||
33 | __asm__ __volatile__( | 32 | __asm__ __volatile__( |
34 | "\tjmp 1f\n" | 33 | " test %0,%0 \n" |
35 | ".align 16\n" | 34 | " jz 3f \n" |
36 | "1:\tjmp 2f\n" | 35 | " jmp 1f \n" |
37 | ".align 16\n" | 36 | |
38 | "2:\tdecl %0\n\tjns 2b" | 37 | ".align 16 \n" |
39 | :"=&a" (d0) | 38 | "1: jmp 2f \n" |
40 | :"0" (loops)); | 39 | |
40 | ".align 16 \n" | ||
41 | "2: decl %0 \n" | ||
42 | " jnz 2b \n" | ||
43 | "3: decl %0 \n" | ||
44 | |||
45 | : /* we don't need output */ | ||
46 | :"a" (loops) | ||
47 | ); | ||
41 | } | 48 | } |
42 | 49 | ||
43 | /* TSC based delay: */ | 50 | /* TSC based delay: */ |