diff options
author | Markus Gutschke <markus@google.com> | 2006-03-23 05:59:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-23 10:38:07 -0500 |
commit | aeefc956d5d8f8402216a5447bd72ade9eb37eff (patch) | |
tree | 982c643fe5288bc3228e3237eaab9e4406b811c1 | |
parent | 905c399594f85322a4e513a4b0365b70d6de9fd0 (diff) |
[PATCH] x86: Make _syscallX() macros compile in PIC mode
Gcc reserves %ebx when compiling position-independent-code on i386. This
means, the _syscallX() macros in include/asm-i386/unistd.h will not
compile. This patch is changes the existing macros to take special care to
preserve %ebx.
The bug can be tracked at http://bugzilla.kernel.org/show_bug.cgi?id=6204
Signed-off-by: Markus Gutschke <markus@google.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | include/asm-i386/unistd.h | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h index dc81a55dd94d..d8afd0e3b81a 100644 --- a/include/asm-i386/unistd.h +++ b/include/asm-i386/unistd.h | |||
@@ -347,9 +347,9 @@ __syscall_return(type,__res); \ | |||
347 | type name(type1 arg1) \ | 347 | type name(type1 arg1) \ |
348 | { \ | 348 | { \ |
349 | long __res; \ | 349 | long __res; \ |
350 | __asm__ volatile ("int $0x80" \ | 350 | __asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \ |
351 | : "=a" (__res) \ | 351 | : "=a" (__res) \ |
352 | : "0" (__NR_##name),"b" ((long)(arg1)) : "memory"); \ | 352 | : "0" (__NR_##name),"ri" ((long)(arg1)) : "memory"); \ |
353 | __syscall_return(type,__res); \ | 353 | __syscall_return(type,__res); \ |
354 | } | 354 | } |
355 | 355 | ||
@@ -357,9 +357,10 @@ __syscall_return(type,__res); \ | |||
357 | type name(type1 arg1,type2 arg2) \ | 357 | type name(type1 arg1,type2 arg2) \ |
358 | { \ | 358 | { \ |
359 | long __res; \ | 359 | long __res; \ |
360 | __asm__ volatile ("int $0x80" \ | 360 | __asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \ |
361 | : "=a" (__res) \ | 361 | : "=a" (__res) \ |
362 | : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)) : "memory"); \ | 362 | : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)) \ |
363 | : "memory"); \ | ||
363 | __syscall_return(type,__res); \ | 364 | __syscall_return(type,__res); \ |
364 | } | 365 | } |
365 | 366 | ||
@@ -367,9 +368,9 @@ __syscall_return(type,__res); \ | |||
367 | type name(type1 arg1,type2 arg2,type3 arg3) \ | 368 | type name(type1 arg1,type2 arg2,type3 arg3) \ |
368 | { \ | 369 | { \ |
369 | long __res; \ | 370 | long __res; \ |
370 | __asm__ volatile ("int $0x80" \ | 371 | __asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \ |
371 | : "=a" (__res) \ | 372 | : "=a" (__res) \ |
372 | : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ | 373 | : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)), \ |
373 | "d" ((long)(arg3)) : "memory"); \ | 374 | "d" ((long)(arg3)) : "memory"); \ |
374 | __syscall_return(type,__res); \ | 375 | __syscall_return(type,__res); \ |
375 | } | 376 | } |
@@ -378,9 +379,9 @@ __syscall_return(type,__res); \ | |||
378 | type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ | 379 | type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ |
379 | { \ | 380 | { \ |
380 | long __res; \ | 381 | long __res; \ |
381 | __asm__ volatile ("int $0x80" \ | 382 | __asm__ volatile ("push %%ebx ; movl %2,%%ebx ; int $0x80 ; pop %%ebx" \ |
382 | : "=a" (__res) \ | 383 | : "=a" (__res) \ |
383 | : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ | 384 | : "0" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)), \ |
384 | "d" ((long)(arg3)),"S" ((long)(arg4)) : "memory"); \ | 385 | "d" ((long)(arg3)),"S" ((long)(arg4)) : "memory"); \ |
385 | __syscall_return(type,__res); \ | 386 | __syscall_return(type,__res); \ |
386 | } | 387 | } |
@@ -390,10 +391,12 @@ __syscall_return(type,__res); \ | |||
390 | type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ | 391 | type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ |
391 | { \ | 392 | { \ |
392 | long __res; \ | 393 | long __res; \ |
393 | __asm__ volatile ("int $0x80" \ | 394 | __asm__ volatile ("push %%ebx ; movl %2,%%ebx ; movl %1,%%eax ; " \ |
395 | "int $0x80 ; pop %%ebx" \ | ||
394 | : "=a" (__res) \ | 396 | : "=a" (__res) \ |
395 | : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ | 397 | : "i" (__NR_##name),"ri" ((long)(arg1)),"c" ((long)(arg2)), \ |
396 | "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)) : "memory"); \ | 398 | "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)) \ |
399 | : "memory"); \ | ||
397 | __syscall_return(type,__res); \ | 400 | __syscall_return(type,__res); \ |
398 | } | 401 | } |
399 | 402 | ||
@@ -402,11 +405,14 @@ __syscall_return(type,__res); \ | |||
402 | type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ | 405 | type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ |
403 | { \ | 406 | { \ |
404 | long __res; \ | 407 | long __res; \ |
405 | __asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; pop %%ebp" \ | 408 | struct { long __a1; long __a6; } __s = { (long)arg1, (long)arg6 }; \ |
409 | __asm__ volatile ("push %%ebp ; push %%ebx ; movl 4(%2),%%ebp ; " \ | ||
410 | "movl 0(%2),%%ebx ; movl %1,%%eax ; int $0x80 ; " \ | ||
411 | "pop %%ebx ; pop %%ebp" \ | ||
406 | : "=a" (__res) \ | 412 | : "=a" (__res) \ |
407 | : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \ | 413 | : "i" (__NR_##name),"0" ((long)(&__s)),"c" ((long)(arg2)), \ |
408 | "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ | 414 | "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)) \ |
409 | "0" ((long)(arg6)) : "memory"); \ | 415 | : "memory"); \ |
410 | __syscall_return(type,__res); \ | 416 | __syscall_return(type,__res); \ |
411 | } | 417 | } |
412 | 418 | ||