1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
/* Copyright (C) 1993, 1994 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA.
Based on GNU libc sysdep.h for the Sparc
Based on HJ's Libc5 sysdep.h for the i386
written by
Miguel de Icaza, 1996
*/
#include <sysdeps/linux/sysdep.h>
#ifdef __ELF__
#define SYMBOL_NAME(X) X
#define C_SYMBOL_NAME(X) (X)
#define SYMBOL_NAME_LABEL(X) X##:
#else
#define SYMBOL_NAME(X) _##X
#define C_SYMBOL_NAME(X) _##X
#define SYMBOL_NAME_LABEL(X) _##X##:
#endif
#ifdef NO_UNDERSCORES
/* Since C identifiers are not normally prefixed with an underscore
on this system, the asm identifier `syscall_error' intrudes on the
C name space. Make sure we use an innocuous name. */
#define syscall_error C_SYMBOL_NAME(__syscall_error)
#endif
#ifdef __ELF__
#define ENTRY(name) \
.global SYMBOL_NAME(name); \
.type name,@function; \
.align 4; \
SYMBOL_NAME_LABEL(name)
#define ENTRY_NOGLOB(name) \
.type name,@function; \
.align 4; \
SYMBOL_NAME_LABEL(name)
#else
#define ENTRY(name) \
.globl _##name##; \
.align 4; \
SYMBOL_NAME_LABEL(name)
#endif
#ifdef __ELF__
#define L(X) .L##X
#define LF(X) .L##X
#define LL(X) .L##X##:
#else
#define L(X) X
#define LF(X) X##f
#define LL(X) X##:
#endif
#ifdef PTHREAD_KERNEL
#error PTHREADS not supported on sysdeps/linux/sparc/sysdep.h
#endif
#ifndef DONT_LOAD_G1
#define loadsyscall(n) mov SYS_##n, %g1
#else
#define loadsyscall(n)
#endif
/* PIC version of the system calls */
#define PSEUDO(name, syscall_name, args) \
.text; \
.global SYMBOL_NAME(errno); \
ENTRY(name); \
loadsyscall(syscall_name); \
ta 0x10; \
bcc,a L(1); \
nop; \
save %sp,-96,%sp; \
call __errno_location; \
nop; \
st %i0,[%o0]; \
restore;\
retl; \
mov -1,%o0; \
LL(1);
#define PSEUDO_NOENT(name, syscall_name, args) \
.text; \
.global SYMBOL_NAME(errno); \
loadsyscall(syscall_name); \
ta 0x10; \
bcc L(1); \
nop; \
save %sp, -96, %sp; \
call __errno_location; \
nop; \
st %i0,[%o0]; \
restore; \
retl; \
mov -1, %o0; \
LL(1);
#define setg1to(x) "or %g0,"#x",%g1;"
#define ret retl; nop
#define r0 %o0
#define r1 %o1
#define MOVE(x,y) mov x, y
|