diff options
Diffstat (limited to 'include/asm-sh/unistd.h')
-rw-r--r-- | include/asm-sh/unistd.h | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h index 1c2abde122cd..0cae1d248761 100644 --- a/include/asm-sh/unistd.h +++ b/include/asm-sh/unistd.h | |||
@@ -349,12 +349,30 @@ do { \ | |||
349 | return (type) (res); \ | 349 | return (type) (res); \ |
350 | } while (0) | 350 | } while (0) |
351 | 351 | ||
352 | #if defined(__sh2__) || defined(__SH2E__) || defined(__SH2A__) | ||
353 | #define SYSCALL_ARG0 "trapa #0x20" | ||
354 | #define SYSCALL_ARG1 "trapa #0x21" | ||
355 | #define SYSCALL_ARG2 "trapa #0x22" | ||
356 | #define SYSCALL_ARG3 "trapa #0x23" | ||
357 | #define SYSCALL_ARG4 "trapa #0x24" | ||
358 | #define SYSCALL_ARG5 "trapa #0x25" | ||
359 | #define SYSCALL_ARG6 "trapa #0x26" | ||
360 | #else | ||
361 | #define SYSCALL_ARG0 "trapa #0x10" | ||
362 | #define SYSCALL_ARG1 "trapa #0x11" | ||
363 | #define SYSCALL_ARG2 "trapa #0x12" | ||
364 | #define SYSCALL_ARG3 "trapa #0x13" | ||
365 | #define SYSCALL_ARG4 "trapa #0x14" | ||
366 | #define SYSCALL_ARG5 "trapa #0x15" | ||
367 | #define SYSCALL_ARG6 "trapa #0x16" | ||
368 | #endif | ||
369 | |||
352 | /* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */ | 370 | /* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */ |
353 | #define _syscall0(type,name) \ | 371 | #define _syscall0(type,name) \ |
354 | type name(void) \ | 372 | type name(void) \ |
355 | { \ | 373 | { \ |
356 | register long __sc0 __asm__ ("r3") = __NR_##name; \ | 374 | register long __sc0 __asm__ ("r3") = __NR_##name; \ |
357 | __asm__ __volatile__ ("trapa #0x10" \ | 375 | __asm__ __volatile__ (SYSCALL_ARG0 \ |
358 | : "=z" (__sc0) \ | 376 | : "=z" (__sc0) \ |
359 | : "0" (__sc0) \ | 377 | : "0" (__sc0) \ |
360 | : "memory" ); \ | 378 | : "memory" ); \ |
@@ -366,7 +384,7 @@ type name(type1 arg1) \ | |||
366 | { \ | 384 | { \ |
367 | register long __sc0 __asm__ ("r3") = __NR_##name; \ | 385 | register long __sc0 __asm__ ("r3") = __NR_##name; \ |
368 | register long __sc4 __asm__ ("r4") = (long) arg1; \ | 386 | register long __sc4 __asm__ ("r4") = (long) arg1; \ |
369 | __asm__ __volatile__ ("trapa #0x11" \ | 387 | __asm__ __volatile__ (SYSCALL_ARG1 \ |
370 | : "=z" (__sc0) \ | 388 | : "=z" (__sc0) \ |
371 | : "0" (__sc0), "r" (__sc4) \ | 389 | : "0" (__sc0), "r" (__sc4) \ |
372 | : "memory"); \ | 390 | : "memory"); \ |
@@ -379,7 +397,7 @@ type name(type1 arg1,type2 arg2) \ | |||
379 | register long __sc0 __asm__ ("r3") = __NR_##name; \ | 397 | register long __sc0 __asm__ ("r3") = __NR_##name; \ |
380 | register long __sc4 __asm__ ("r4") = (long) arg1; \ | 398 | register long __sc4 __asm__ ("r4") = (long) arg1; \ |
381 | register long __sc5 __asm__ ("r5") = (long) arg2; \ | 399 | register long __sc5 __asm__ ("r5") = (long) arg2; \ |
382 | __asm__ __volatile__ ("trapa #0x12" \ | 400 | __asm__ __volatile__ (SYSCALL_ARG2 \ |
383 | : "=z" (__sc0) \ | 401 | : "=z" (__sc0) \ |
384 | : "0" (__sc0), "r" (__sc4), "r" (__sc5) \ | 402 | : "0" (__sc0), "r" (__sc4), "r" (__sc5) \ |
385 | : "memory"); \ | 403 | : "memory"); \ |
@@ -393,7 +411,7 @@ register long __sc0 __asm__ ("r3") = __NR_##name; \ | |||
393 | register long __sc4 __asm__ ("r4") = (long) arg1; \ | 411 | register long __sc4 __asm__ ("r4") = (long) arg1; \ |
394 | register long __sc5 __asm__ ("r5") = (long) arg2; \ | 412 | register long __sc5 __asm__ ("r5") = (long) arg2; \ |
395 | register long __sc6 __asm__ ("r6") = (long) arg3; \ | 413 | register long __sc6 __asm__ ("r6") = (long) arg3; \ |
396 | __asm__ __volatile__ ("trapa #0x13" \ | 414 | __asm__ __volatile__ (SYSCALL_ARG3 \ |
397 | : "=z" (__sc0) \ | 415 | : "=z" (__sc0) \ |
398 | : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6) \ | 416 | : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6) \ |
399 | : "memory"); \ | 417 | : "memory"); \ |
@@ -408,7 +426,7 @@ register long __sc4 __asm__ ("r4") = (long) arg1; \ | |||
408 | register long __sc5 __asm__ ("r5") = (long) arg2; \ | 426 | register long __sc5 __asm__ ("r5") = (long) arg2; \ |
409 | register long __sc6 __asm__ ("r6") = (long) arg3; \ | 427 | register long __sc6 __asm__ ("r6") = (long) arg3; \ |
410 | register long __sc7 __asm__ ("r7") = (long) arg4; \ | 428 | register long __sc7 __asm__ ("r7") = (long) arg4; \ |
411 | __asm__ __volatile__ ("trapa #0x14" \ | 429 | __asm__ __volatile__ (SYSCALL_ARG4 \ |
412 | : "=z" (__sc0) \ | 430 | : "=z" (__sc0) \ |
413 | : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), \ | 431 | : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), \ |
414 | "r" (__sc7) \ | 432 | "r" (__sc7) \ |
@@ -425,7 +443,7 @@ register long __sc5 __asm__ ("r5") = (long) arg2; \ | |||
425 | register long __sc6 __asm__ ("r6") = (long) arg3; \ | 443 | register long __sc6 __asm__ ("r6") = (long) arg3; \ |
426 | register long __sc7 __asm__ ("r7") = (long) arg4; \ | 444 | register long __sc7 __asm__ ("r7") = (long) arg4; \ |
427 | register long __sc0 __asm__ ("r0") = (long) arg5; \ | 445 | register long __sc0 __asm__ ("r0") = (long) arg5; \ |
428 | __asm__ __volatile__ ("trapa #0x15" \ | 446 | __asm__ __volatile__ (SYSCALL_ARG5 \ |
429 | : "=z" (__sc0) \ | 447 | : "=z" (__sc0) \ |
430 | : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \ | 448 | : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \ |
431 | "r" (__sc3) \ | 449 | "r" (__sc3) \ |
@@ -443,7 +461,7 @@ register long __sc6 __asm__ ("r6") = (long) arg3; \ | |||
443 | register long __sc7 __asm__ ("r7") = (long) arg4; \ | 461 | register long __sc7 __asm__ ("r7") = (long) arg4; \ |
444 | register long __sc0 __asm__ ("r0") = (long) arg5; \ | 462 | register long __sc0 __asm__ ("r0") = (long) arg5; \ |
445 | register long __sc1 __asm__ ("r1") = (long) arg6; \ | 463 | register long __sc1 __asm__ ("r1") = (long) arg6; \ |
446 | __asm__ __volatile__ ("trapa #0x16" \ | 464 | __asm__ __volatile__ (SYSCALL_ARG6 \ |
447 | : "=z" (__sc0) \ | 465 | : "=z" (__sc0) \ |
448 | : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \ | 466 | : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), "r" (__sc7), \ |
449 | "r" (__sc3), "r" (__sc1) \ | 467 | "r" (__sc3), "r" (__sc1) \ |