diff options
Diffstat (limited to 'arch/x86/lib')
-rw-r--r-- | arch/x86/lib/string_32.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/x86/lib/string_32.c b/arch/x86/lib/string_32.c index 82004d2bf05e..bd59090825db 100644 --- a/arch/x86/lib/string_32.c +++ b/arch/x86/lib/string_32.c | |||
@@ -164,15 +164,13 @@ EXPORT_SYMBOL(strchr); | |||
164 | size_t strlen(const char *s) | 164 | size_t strlen(const char *s) |
165 | { | 165 | { |
166 | int d0; | 166 | int d0; |
167 | int res; | 167 | size_t res; |
168 | asm volatile("repne\n\t" | 168 | asm volatile("repne\n\t" |
169 | "scasb\n\t" | 169 | "scasb" |
170 | "notl %0\n\t" | ||
171 | "decl %0" | ||
172 | : "=c" (res), "=&D" (d0) | 170 | : "=c" (res), "=&D" (d0) |
173 | : "1" (s), "a" (0), "0" (0xffffffffu) | 171 | : "1" (s), "a" (0), "0" (0xffffffffu) |
174 | : "memory"); | 172 | : "memory"); |
175 | return res; | 173 | return ~res - 1; |
176 | } | 174 | } |
177 | EXPORT_SYMBOL(strlen); | 175 | EXPORT_SYMBOL(strlen); |
178 | #endif | 176 | #endif |