home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / LIBC / LIBC-4.6 / LIBC-4 / libc-linux / sysdeps / linux / m68k / sysdep.h < prev   
Encoding:
C/C++ Source or Header  |  1994-11-19  |  2.4 KB  |  79 lines

  1. /* Copyright (C) 1992 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. #include <sysdeps/linux/sysdep.h>
  20.  
  21. #define ENTRY(name)                                                           \
  22.   .globl _##name##;                                  \
  23.   .align 4;                                      \
  24.   _##name##:
  25.  
  26. #define _HASH  #
  27. #define PSEUDO(name, syscall_name, args)                                      \
  28.   .text;                                      \
  29.   ENTRY (name)                                                                \
  30.     PUSH_##args                                   \
  31.     moveq _HASH SYS_##syscall_name, d0;                          \
  32.     MOVE_##args                                   \
  33.     trap  _HASH 0;                                  \
  34.     tstl  d0;                                        \
  35.     bpl   Lexit;                                  \
  36.     negl  d0;                                      \
  37.     movel d0,_errno;                                  \
  38.     moveq _HASH -1,d0;                                  \
  39.    Lexit:                                      \
  40.     POP_##args
  41.  
  42. /* Linux takes system call arguments in registers:
  43.     1: d1
  44.     2: d2
  45.     3: d3
  46.     4: d4
  47.     5: d5
  48.  */
  49.  
  50. #define PUSH_0    /* No arguments to push.  */
  51. #define PUSH_1    /* no need to restore d1  */
  52. #define PUSH_2    movel d2,sp@-;
  53. #define PUSH_3    movml d2-d3,sp@-;
  54. #define PUSH_4    movml d2-d4,sp@-;
  55. #define PUSH_5    movml d2-d5,sp@-;
  56.  
  57. #define MOVE_0    /* No arguments to move.  */
  58.  
  59. #define MOVE_1    movl sp@(4),d1;
  60. #define MOVE_2    movml sp@(8),d1-d2;
  61. #define MOVE_3    movml sp@(12),d1-d3;
  62. #define MOVE_4    movml sp@(16),d1-d4;
  63. #define MOVE_5    movml sp@(20),d1-d5;
  64.  
  65. #define POP_0    /* No arguments to pop.  */
  66. #define POP_1    /* didn't save d1        */
  67. #define POP_2    movel sp@+,d2;
  68. #define POP_3    movml sp@+,d2-d3;
  69. #define POP_4    movml sp@+,d2-d4;
  70. #define POP_5    movml sp@+,d2-d5;
  71.  
  72. #define ret rts
  73. /* Linux doesn't use it. */
  74. #if 0
  75. #define r0    d0
  76. #define r1    d1
  77. #define MOVE(x,y)       movel x , y
  78. #endif
  79.