diff options
author | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-02-28 00:54:02 +0000 |
---|---|---|
committer | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-02-28 00:54:02 +0000 |
commit | 5eb1fae2a97ffc88d136502ace050662e57ef34a (patch) | |
tree | df1087921ff9a88aa8a47ddfd55dc15a793fec56 /libc/sysdeps/linux/i386/__syscall_error.c | |
parent | dc0e95c67d350ca9e950abb5f75a63833380af9f (diff) | |
download | uClibc-alpine-5eb1fae2a97ffc88d136502ace050662e57ef34a.tar.bz2 uClibc-alpine-5eb1fae2a97ffc88d136502ace050662e57ef34a.tar.xz |
Merge from trunk.
Diffstat (limited to 'libc/sysdeps/linux/i386/__syscall_error.c')
-rw-r--r-- | libc/sysdeps/linux/i386/__syscall_error.c | 52 |
1 files changed, 21 insertions, 31 deletions
diff --git a/libc/sysdeps/linux/i386/__syscall_error.c b/libc/sysdeps/linux/i386/__syscall_error.c index 133500cb6..7509d4409 100644 --- a/libc/sysdeps/linux/i386/__syscall_error.c +++ b/libc/sysdeps/linux/i386/__syscall_error.c @@ -1,46 +1,36 @@ /* Wrapper for setting errno. - Copyright (C) 1997, 1998, 1999, 2000 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <errno.h> -#include <features.h> + * + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ /* This routine is jumped to by all the syscall handlers, to stash * an error number into errno. */ -/* This version uses a lot of magic and relies heavily on x86 - * calling convention ... The advantage is that this is the same +/* This version uses a lot of magic and relies heavily on x86 + * calling convention ... The advantage is that this is the same * size as the previous __syscall_error() but all the .S functions * need just one instruction. * - * Local .S files have to set %eax to the negative errno value - * and then jump to this function. The neglected return to caller - * and return value of -1 is taken care of here so we don't have to + * Local .S files have to set %eax to the negative errno value + * and then jump to this function. The neglected return to caller + * and return value of -1 is taken care of here so we don't have to * worry about it in the .S functions. * - * We have to stash the errno from %eax in a local stack var because + * We have to stash the errno from %eax in a local stack var because * __set_errno will prob call a function thus clobbering %eax on us. */ -int attribute_hidden __syscall_error(void) + +#include <errno.h> +#include <features.h> + +int __syscall_error(void) attribute_hidden; +int __syscall_error(void) { - register int edx asm("%edx"); - asm("mov %eax, %edx"); - asm("negl %edx"); - __set_errno(edx); + register int edx __asm__ ("%edx"); + __asm__ ("mov %eax, %edx\n\t" + "negl %edx"); + __set_errno (edx); return -1; } |