Back to index

glibc  2.9
sysdep.h
Go to the documentation of this file.
00001 /* System call interface code for Sequent Symmetry running Dynix version 3.
00002    Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #include <sysdeps/unix/i386/sysdep.h>
00021 
00022 #ifdef __ASSEMBLER__
00023 
00024 /* Get the symbols for system call interrupts.  */
00025 #include <machine/trap.h>
00026 
00027 /* Use the BSD versions of system calls, by setting the high 16 bits
00028    of the syscall number (see /usr/include/syscall.h).  */
00029 #define SYS_HANDLER (SYS_bsd << 16)
00030 
00031 /* Dynix uses an interrupt interface to system calls.
00032    "int $T_SVCn" are syscall interfaces for 0-6 arg functions.
00033    (see /usr/include/machine/trap.h).  */
00034 
00035 #undef DO_CALL
00036 
00037 #ifdef __STDC__
00038 #define DO_CALL(syscall_name, args)                                         \
00039   movl $(SYS_HANDLER | SYS_##syscall_name), %eax;                           \
00040   int $T_SVC##args;
00041 #else
00042 #define DO_CALL(syscall_name, args)                                         \
00043   movl $(SYS_HANDLER | SYS_syscall_name), %eax;                      \
00044   int $T_SVCargs;
00045 #endif
00046 
00047 #undef PSEUDO
00048 #define       PSEUDO(name, syscall_name, args)                              \
00049   .text;                                                             \
00050   .globl syscall_error;                                                     \
00051   .align 4;                                                          \
00052   ENTRY (name)                                                              \
00053   ARGS (args)                                                        \
00054   DO_CALL (syscall_name, args)                                              \
00055   jb syscall_error
00056 
00057 /* For one and two-argument calls, Dynix takes the arguments in %ecx and
00058    %edx.  For 3-6 argument calls, Dynix takes the address of the first
00059    argument in %ecx.  */
00060 
00061 #ifdef __STDC__
00062 #define ARGS(n) ARGS_##n
00063 #else
00064 #define ARGS(n) ARGS_n
00065 #endif
00066 
00067 #define ARGS_0
00068 #define ARGS_1       movl 4(%esp), %ecx;
00069 #define ARGS_2       movl 4(%esp), %ecx; movl 8(%esp), %edx;
00070 #define ARGS_3       leal 4(%esp), %ecx;
00071 #define ARGS_4       ARGS_3
00072 #define ARGS_5       ARGS_3
00073 #define ARGS_6       ARGS_3
00074 
00075 /* Dynix reverses %ecx and %edx relative to most i386 Unices. */
00076 
00077 #undef r1
00078 #define       r1            %ecx   /* Secondary return-value register.  */
00079 #undef scratch
00080 #define scratch      %edx   /* Call-clobbered register for random use.  */
00081 
00082 #endif /* __ASSEMBLER__ */