freebsd-skq/lib/libc/ia64/SYS.h
Peter Wemm eabc04d472 Adjust the syscall stub macros to be consistent in their meaning. In
particular:
SYSCALL() makes a syscall, with errno handling, and continues execution
directly after the macro in the non-error case.
RSYSCALL() is just like SYSCALL(), but returns after success.
Both SYSCALL(name) and RSYSCALL(name) export  "__sys_name" as a strong
symbol, with "_name" and "name" as weak aliases.
PSEUDO() is just like RSYSCALL(), but skipping the "name" weak alias.  It
still does "__sys_name" and "_name".

Change i386 to add errno handling to PSEUDO.  The same for amd64 and
sparc64, with appear to have copied the behavior.
ia64 was correct (as was alpha).  Just remove some apparently unused
variants of the macros. (untested!)
I believe powerpc is correct.
Fix arm to not export "name" from the PSEUDO case.  Remove apparently
extra unused variants.  (untested!)

The errno problem manifested on i386/amd64/sparc64 by having "PSEUDO"
classified syscalls return without setting errno.  eg: "addr = mmap()"
could return with "addr" = 22 instead of setting errno to 22 and
returning -1.

Approved by: re (kensmith)
2007-07-04 23:18:38 +00:00

64 lines
1.9 KiB
C

/* $NetBSD: SYS.h,v 1.5 1997/05/02 18:15:15 kleink Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $FreeBSD$
*/
#include <machine/asm.h>
#include <sys/syscall.h>
#define CALLSYS_ERROR(name) \
CALLSYS_NOERROR(name); \
cmp.ne p6,p0=r0,r10; \
(p6) br.cond.sptk.few .cerror
#define SYSCALL(name) \
ENTRY(__sys_ ## name,0); /* XXX # of args? */ \
WEAK_ALIAS(name, __sys_ ## name); \
WEAK_ALIAS(_ ## name, __sys_ ## name); \
CALLSYS_ERROR(name)
#define SYSCALL_NOERROR(name) \
ENTRY(__sys_ ## name,0); /* XXX # of args? */ \
WEAK_ALIAS(name, __sys_ ## name); \
WEAK_ALIAS(_ ## name, __sys_ ## name); \
CALLSYS_NOERROR(name)
#define RSYSCALL(name) \
SYSCALL(name); \
br.ret.sptk.few rp; \
END(__sys_ ## name)
#define PSEUDO(name) \
ENTRY(__sys_ ## name,0); /* XXX # of args? */ \
WEAK_ALIAS(_ ## name, __sys_ ## name); \
CALLSYS_ERROR(name); \
br.ret.sptk.few rp; \
END(__sys_ ## name);