diff options
Diffstat (limited to 'libc/sysdeps/linux/microblaze')
35 files changed, 995 insertions, 585 deletions
diff --git a/libc/sysdeps/linux/microblaze/Makefile b/libc/sysdeps/linux/microblaze/Makefile index a7a832b24..4fa4bb107 100644 --- a/libc/sysdeps/linux/microblaze/Makefile +++ b/libc/sysdeps/linux/microblaze/Makefile @@ -1,67 +1,24 @@ # Makefile for uClibc # -# Copyright (C) 2001,2002 NEC Corporation -# Copyright (C) 2001,2002 Miles Bader <miles@gnu.org> +# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org> # -# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - -TOPDIR=../../../../ -include $(TOPDIR)Rules.mak - -#FIXME -- this arch should include its own crti.S and crtn.S -UCLIBC_CTOR_DTOR=n - -CFLAGS += -I.. -ASFLAGS += -I.. -D__ASSEMBLER -DASM_GLOBAL_DIRECTIVE=.globl - -TARGET_MACHINE_TYPE=$(shell $(CC) -dumpmachine) - -CRT_SRC := crt0.S -CRT_OBJ := crt0.o crt1.o -CTOR_TARGETS := $(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o - -SSRC := setjmp.S __longjmp.S vfork.S -SOBJ := $(patsubst %.S,%.o, $(SSRC)) - -CSRC := mmap.c syscall.c clone.c -COBJ := $(patsubst %.c,%.o, $(CSRC)) - -OBJS := $(SOBJ) $(COBJ) - -OBJ_LIST := ../../../obj.sysdeps.$(TARGET_ARCH) - -all: $(OBJ_LIST) $(CTOR_TARGETS) - -$(OBJ_LIST): $(OBJS) $(CRT_OBJ) - $(STRIPTOOL) -x -R .note -R .comment $^ - $(INSTALL) -d $(TOPDIR)lib/ - cp $(CRT_OBJ) $(TOPDIR)lib/ - echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $@ - -$(CRT_OBJ): $(CRT_SRC) - $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o - -$(SOBJ): %.o : %.S - $(CC) $(ASFLAGS) -c $< -o $@ - -$(COBJ): %.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - -ifeq ($(UCLIBC_CTOR_DTOR),y) -$(TOPDIR)lib/crti.o: crti.S - $(INSTALL) -d $(TOPDIR)lib/ - $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c $< -o $@ - -$(TOPDIR)lib/crtn.o: crtn.S - $(INSTALL) -d $(TOPDIR)lib/ - $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c $< -o $@ -else -$(CTOR_TARGETS): - $(INSTALL) -d $(TOPDIR)lib/ - $(AR) $(ARFLAGS) $@ -endif +# This program 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. +# +# This program 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 this program; if not, see <http://www.gnu.org/licenses/>. -headers: +top_srcdir=../../../../ +top_builddir=../../../../ +all: objs -clean: - $(RM) *.o *~ core +include $(top_builddir)Rules.mak +include Makefile.arch +include $(top_srcdir)Makerules diff --git a/libc/sysdeps/linux/microblaze/Makefile.arch b/libc/sysdeps/linux/microblaze/Makefile.arch new file mode 100644 index 000000000..8f14fb94f --- /dev/null +++ b/libc/sysdeps/linux/microblaze/Makefile.arch @@ -0,0 +1,12 @@ +# Makefile for uClibc +# +# Copyright (C) 2001,2002 NEC Corporation +# Copyright (C) 2001,2002 Miles Bader <miles@gnu.org> +# +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +CSRC-y := clone.c fixdfsi.c + +SSRC-y := setjmp.S __longjmp.S vfork.S + +ARCH_HEADERS := floatlib.h diff --git a/libc/sysdeps/linux/microblaze/__longjmp.S b/libc/sysdeps/linux/microblaze/__longjmp.S index fba1e9fbf..c7fce3435 100644 --- a/libc/sysdeps/linux/microblaze/__longjmp.S +++ b/libc/sysdeps/linux/microblaze/__longjmp.S @@ -8,38 +8,38 @@ * This file is subject to the terms and conditions of the GNU Lesser * General Public License. See the file COPYING.LIB in the main * directory of this archive for more details. - * + * * Written by Miles Bader <miles@gnu.org> */ -#define _SETJMP_H -#define _ASM -#include <bits/setjmp.h> - -#include <clinkage.h> +#include <libc-symbols.h> .text -C_ENTRY(__longjmp): - /* load registers from memory to r5 (arg0)*/ + .globl C_SYMBOL_NAME(__longjmp) + .align 4 +C_SYMBOL_NAME(__longjmp): + /* load registers from memory to r5 (arg0) */ lwi r1, r5, 0 lwi r15, r5, 4 - lwi r18, r5, 8 - lwi r19, r5, 12 - lwi r20, r5, 16 - lwi r21, r5, 20 - lwi r22, r5, 24 - lwi r23, r5, 28 - lwi r24, r5, 32 - lwi r25, r5, 36 - lwi r26, r5, 40 - lwi r27, r5, 44 - lwi r28, r5, 48 - lwi r29, r5, 52 - lwi r30, r5, 56 - - addi r3, r0, 1 // return val - rtsd r15, 8 // normal return + lwi r2, r5, 8 + lwi r13, r5, 12 + lwi r18, r5, 16 + lwi r19, r5, 20 + lwi r20, r5, 24 + lwi r21, r5, 28 + lwi r22, r5, 32 + lwi r23, r5, 36 + lwi r24, r5, 40 + lwi r25, r5, 44 + lwi r26, r5, 48 + lwi r27, r5, 52 + lwi r28, r5, 56 + lwi r29, r5, 60 + lwi r30, r5, 64 + lwi r31, r5, 68 + + addi r3, r0, 1 /* return val */ + rtsd r15, 8 /* normal return */ nop -C_END(__longjmp) libc_hidden_def(__longjmp) diff --git a/libc/sysdeps/linux/microblaze/bits/byteswap.h b/libc/sysdeps/linux/microblaze/bits/byteswap.h deleted file mode 100644 index 9b6a5d722..000000000 --- a/libc/sysdeps/linux/microblaze/bits/byteswap.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * libc/sysdeps/linux/microblaze/bits/byteswap.h -- Macros to swap the order - * of bytes in integer values - * - * Copyright (C) 2001 NEC Corporation - * Copyright (C) 2001 Miles Bader <miles@gnu.org> - * Copyright (C) 1997,1998,2001 Free Software Foundation, Inc. - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License. See the file COPYING.LIB in the main - * directory of this archive for more details. - */ - -#if !defined _BYTESWAP_H && !defined _NETINET_IN_H -# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead." -#endif - -/* Swap bytes in 16 bit value. */ -#define __bswap_constant_16(x) \ - ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) - -# define __bswap_16(x) __bswap_constant_16 (x) - -/* Swap bytes in 32 bit value. */ -#define __bswap_constant_32(x) \ - ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ - (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) - -# define __bswap_32(x) __bswap_constant_32 (x) - -#if defined __GNUC__ && __GNUC__ >= 2 -/* Swap bytes in 64 bit value. */ -# define __bswap_64(x) \ - (__extension__ \ - ({ union { unsigned long long int __ll; \ - unsigned long int __l[2]; } __bswap_64_v, __bswap_64_r; \ - __bswap_64_v.__ll = (x); \ - __bswap_64_r.__l[0] = __bswap_32 (__bswap_64_v.__l[1]); \ - __bswap_64_r.__l[1] = __bswap_32 (__bswap_64_v.__l[0]); \ - __bswap_64_r.__ll; })) -#endif diff --git a/libc/sysdeps/linux/microblaze/bits/endian.h b/libc/sysdeps/linux/microblaze/bits/endian.h index 8a4f6efcc..56fcd5dd9 100644 --- a/libc/sysdeps/linux/microblaze/bits/endian.h +++ b/libc/sysdeps/linux/microblaze/bits/endian.h @@ -17,4 +17,11 @@ # error "Never use <bits/endian.h> directly; include <endian.h> instead." #endif -#define __BYTE_ORDER __BIG_ENDIAN +/* Note: Toolchain supplies _BIG_ENDIAN or _LITTLE_ENDIAN */ +#if defined(_BIG_ENDIAN) +# define __BYTE_ORDER __BIG_ENDIAN +#elif defined(_LITTLE_ENDIAN) +# define __BYTE_ORDER __LITTLE_ENDIAN +#else +# error "Endianness is unknown" +#endif diff --git a/libc/sysdeps/linux/microblaze/bits/fcntl.h b/libc/sysdeps/linux/microblaze/bits/fcntl.h index 87d193923..ee300a293 100644 --- a/libc/sysdeps/linux/microblaze/bits/fcntl.h +++ b/libc/sysdeps/linux/microblaze/bits/fcntl.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _FCNTL_H # error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead." @@ -23,6 +22,9 @@ #include <sys/types.h> +#ifdef __USE_GNU +# include <bits/uio.h> +#endif /* open/fcntl - O_SYNC is only implemented on blocks devices and on files located on an ext2 file system */ @@ -42,10 +44,12 @@ #define O_ASYNC 020000 #ifdef __USE_GNU -# define O_DIRECTORY 040000 /* Must be a directory. */ -# define O_NOFOLLOW 0100000 /* Do not follow links. */ -# define O_DIRECT 0200000 /* Direct disk access. */ -# define O_STREAMING 04000000/* streaming access */ +# define O_DIRECTORY 0200000 /* Must be a directory. */ +# define O_NOFOLLOW 0400000 /* Do not follow links. */ +# define O_DIRECT 040000 /* Direct disk access. */ +# define O_NOATIME 01000000 /* Do not set atime. */ +# define O_CLOEXEC 02000000 /* set close_on_exec */ +# define O_PATH 010000000 /* Resolve pathname but do not open file. */ #endif /* For now Linux has synchronisity options for data and read operations. @@ -57,7 +61,7 @@ #endif #ifdef __USE_LARGEFILE64 -# define O_LARGEFILE 0400000 +# define O_LARGEFILE 0100000 #endif /* Values for the second argument to `fcntl'. */ @@ -95,6 +99,8 @@ # define F_NOTIFY 1026 /* Request notfications on a directory. */ # define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with close-on-exit set on new fd. */ +# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */ +# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */ #endif /* For F_[GET|SET]FL. */ @@ -182,7 +188,7 @@ struct flock64 #endif -#ifdef __USE_GNU +#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__ /* Flags for SYNC_FILE_RANGE. */ # define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages in the range before performing the @@ -205,7 +211,7 @@ struct flock64 __BEGIN_DECLS -#ifdef __USE_GNU +#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__ /* Provide kernel hint to read ahead. */ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) diff --git a/libc/sysdeps/linux/microblaze/bits/kernel_stat.h b/libc/sysdeps/linux/microblaze/bits/kernel_stat.h index 248345e8b..c2695098d 100644 --- a/libc/sysdeps/linux/microblaze/bits/kernel_stat.h +++ b/libc/sysdeps/linux/microblaze/bits/kernel_stat.h @@ -3,64 +3,46 @@ #ifndef _BITS_STAT_STRUCT_H #define _BITS_STAT_STRUCT_H -#ifndef _LIBC -#error bits/kernel_stat.h is for internal uClibc use only! -#endif - struct kernel_stat { - __kernel_dev_t st_dev; - __kernel_ino_t st_ino; - __kernel_mode_t st_mode; - __kernel_nlink_t st_nlink; - __kernel_uid_t st_uid; - __kernel_gid_t st_gid; - __kernel_dev_t st_rdev; - __kernel_off_t st_size; - unsigned long st_blksize; - unsigned long st_blocks; - unsigned long st_atime; - unsigned long __unused1; - unsigned long st_mtime; - unsigned long __unused2; - unsigned long st_ctime; - unsigned long __unused3; - unsigned long __unused4; - unsigned long __unused5; + unsigned long st_dev; /* Device. */ + unsigned long st_ino; /* File serial number. */ + unsigned int st_mode; /* File mode. */ + unsigned int st_nlink; /* Link count. */ + unsigned int st_uid; /* User ID of the file's owner. */ + unsigned int st_gid; /* Group ID of the file's group. */ + unsigned long st_rdev; /* Device number, if device. */ + unsigned long __pad1; + long st_size; /* Size of file, in bytes. */ + int st_blksize; /* Optimal block size for I/O. */ + int __pad2; + long st_blocks; /* Number 512-byte blocks allocated. */ + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned int __unused4; + unsigned int __unused5; }; struct kernel_stat64 { - __kernel_dev_t st_dev; - unsigned long __unused0; - unsigned long __unused1; - - __kernel_ino64_t st_ino; - - __kernel_mode_t st_mode; - __kernel_nlink_t st_nlink; - - __kernel_uid_t st_uid; - __kernel_gid_t st_gid; - - __kernel_dev_t st_rdev; - unsigned long __unused2; - unsigned long __unused3; - - __kernel_loff_t st_size; - unsigned long st_blksize; - - unsigned long __unused4; /* future possible st_blocks high bits */ - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ - - unsigned long st_atime; - unsigned long __unused5; - - unsigned long st_mtime; - unsigned long __unused6; - - unsigned long st_ctime; - unsigned long __unused7; /* high 32 bits of ctime someday */ + unsigned long long st_dev; /* Device. */ + unsigned long long st_ino; /* File serial number. */ + unsigned int st_mode; /* File mode. */ + unsigned int st_nlink; /* Link count. */ + unsigned int st_uid; /* User ID of the file's owner. */ + unsigned int st_gid; /* Group ID of the file's group. */ + unsigned long long st_rdev; /* Device number, if device. */ + unsigned long long __pad1; + long long st_size; /* Size of file, in bytes. */ + int st_blksize; /* Optimal block size for I/O. */ + int __pad2; + long long st_blocks; /* Number 512-byte blocks allocated. */ + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned int __unused4; + unsigned int __unused5; }; #endif /* _BITS_STAT_STRUCT_H */ diff --git a/libc/sysdeps/linux/microblaze/bits/kernel_types.h b/libc/sysdeps/linux/microblaze/bits/kernel_types.h index 1ca2dae30..a9f736b2e 100644 --- a/libc/sysdeps/linux/microblaze/bits/kernel_types.h +++ b/libc/sysdeps/linux/microblaze/bits/kernel_types.h @@ -13,18 +13,17 @@ * Microblaze port by John Williams */ -#ifndef __MICROBLAZE_POSIX_TYPES_H__ -#define __MICROBLAZE_POSIX_TYPES_H__ +#ifndef _ASM_MICROBLAZE_POSIX_TYPES_H +#define _ASM_MICROBLAZE_POSIX_TYPES_H -typedef unsigned int __kernel_dev_t; +typedef unsigned long __kernel_dev_t; typedef unsigned long __kernel_ino_t; -typedef unsigned long long __kernel_ino64_t; -typedef unsigned int __kernel_mode_t; -typedef unsigned int __kernel_nlink_t; +//typedef unsigned long long __kernel_ino64_t; +typedef unsigned short __kernel_mode_t; +typedef unsigned long __kernel_nlink_t; typedef long __kernel_off_t; -typedef long long __kernel_loff_t; typedef int __kernel_pid_t; -typedef unsigned short __kernel_ipc_pid_t; +typedef int __kernel_ipc_pid_t; typedef unsigned int __kernel_uid_t; typedef unsigned int __kernel_gid_t; typedef unsigned int __kernel_size_t; @@ -33,6 +32,8 @@ typedef int __kernel_ptrdiff_t; typedef long __kernel_time_t; typedef long __kernel_suseconds_t; typedef long __kernel_clock_t; +typedef int __kernel_timer_t; +typedef int __kernel_clockid_t; typedef int __kernel_daddr_t; typedef char * __kernel_caddr_t; typedef unsigned short __kernel_uid16_t; @@ -40,9 +41,15 @@ typedef unsigned short __kernel_gid16_t; typedef unsigned int __kernel_uid32_t; typedef unsigned int __kernel_gid32_t; -typedef unsigned short __kernel_old_uid_t; -typedef unsigned short __kernel_old_gid_t; -typedef __kernel_dev_t __kernel_old_dev_t; +typedef unsigned int __kernel_old_uid_t; +typedef unsigned int __kernel_old_gid_t; +typedef unsigned int __kernel_old_dev_t; +typedef long __kernel_long_t; +typedef unsigned long __kernel_ulong_t; + +#ifdef __GNUC__ +typedef long long __kernel_loff_t; +#endif typedef struct { #ifdef __USE_ALL @@ -52,4 +59,4 @@ typedef struct { #endif } __kernel_fsid_t; -#endif /* __MICROBLAZE_POSIX_TYPES_H__ */ +#endif /* _ASM_MICROBLAZE_POSIX_TYPES_H */ diff --git a/libc/sysdeps/linux/microblaze/bits/mman.h b/libc/sysdeps/linux/microblaze/bits/mman.h deleted file mode 100644 index d051c8fa7..000000000 --- a/libc/sysdeps/linux/microblaze/bits/mman.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Definitions for POSIX memory map interface. Linux/microblaze version. - Copyright (C) 1997, 1999, 2001, 2002 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. */ - -/* These are the bits used by 4.4 BSD and its derivatives. On systems - (such as GNU) where these facilities are not system services but can be - emulated in the C library, these are the definitions we emulate. */ - -#ifndef _SYS_MMAN_H -# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead." -#endif - -/* The following definitions basically come from the kernel headers. - But the kernel header is not namespace clean. */ - - -/* Protections are chosen from these bits, OR'd together. The - implementation does not necessarily support PROT_EXEC or PROT_WRITE - without PROT_READ. The only guarantees are that no writing will be - allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */ - -#define PROT_READ 0x1 /* Page can be read. */ -#define PROT_WRITE 0x2 /* Page can be written. */ -#define PROT_EXEC 0x4 /* Page can be executed. */ -#define PROT_NONE 0x0 /* Page can not be accessed. */ - -/* Sharing types (must choose one and only one of these). */ -#define MAP_SHARED 0x01 /* Share changes. */ -#define MAP_PRIVATE 0x02 /* Changes are private. */ -#ifdef __USE_MISC -# define MAP_TYPE 0x0f /* Mask for type of mapping. */ -#endif - -/* Other flags. */ -#define MAP_FIXED 0x10 /* Interpret addr exactly. */ -#ifdef __USE_MISC -# define MAP_FILE 0 -# define MAP_ANONYMOUS 0x20 /* Don't use a file. */ -# define MAP_ANON MAP_ANONYMOUS -#endif - -/* These are Linux-specific. */ -#ifdef __USE_MISC -# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */ -# define MAP_DENYWRITE 0x0800 /* ETXTBSY */ -# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */ -# define MAP_LOCKED 0x2000 /* Lock the mapping. */ -# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */ -#endif - -/* Flags to `msync'. */ -#define MS_ASYNC 1 /* Sync memory asynchronously. */ -#define MS_SYNC 4 /* Synchronous memory sync. */ -#define MS_INVALIDATE 2 /* Invalidate the caches. */ - -/* Advice to `madvise'. */ -#ifdef __USE_BSD -# define MADV_NORMAL 0 /* No further special treatment. */ -# define MADV_RANDOM 1 /* Expect random page references. */ -# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */ -# define MADV_WILLNEED 3 /* Will need these pages. */ -# define MADV_DONTNEED 4 /* Don't need these pages. */ -#endif - -/* The POSIX people had to invent similar names for the same things. */ -#ifdef __USE_XOPEN2K -# define POSIX_MADV_NORMAL 0 /* No further special treatment. */ -# define POSIX_MADV_RANDOM 1 /* Expect random page references. */ -# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */ -# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */ -# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */ -#endif - - -/* Flags for `mlockall' (can be OR'd together). */ -#define MCL_CURRENT 1 /* Lock all currently mapped pages. */ -#define MCL_FUTURE 2 /* Lock all additions to address - space. */ - -/* Flags for `mremap'. */ -#ifdef __USE_GNU -# define MREMAP_MAYMOVE 1 -# define MREMAP_FIXED 2 -#endif diff --git a/libc/sysdeps/linux/microblaze/bits/poll.h b/libc/sysdeps/linux/microblaze/bits/poll.h index f7a739315..9b284c857 100644 --- a/libc/sysdeps/linux/microblaze/bits/poll.h +++ b/libc/sysdeps/linux/microblaze/bits/poll.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_POLL_H # error "Never use <bits/poll.h> directly; include <sys/poll.h> instead." @@ -29,10 +28,10 @@ #ifdef __USE_XOPEN /* These values are defined in XPG4.2. */ -# define POLLRDNORM 0x040 /* Normal data may be read. */ -# define POLLRDBAND 0x080 /* Priority data may be read. */ -# define POLLWRNORM POLLOUT /* Writing now will not block. */ -# define POLLWRBAND 0x100 /* Priority data may be written. */ +# define POLLRDNORM 0x0040 /* Normal data may be read. */ +# define POLLRDBAND 0x0080 /* Priority data may be read. */ +# define POLLWRNORM 0x0100 /* Writing now will not block. */ +# define POLLWRBAND 0x0200 /* Priority data may be written. */ #endif /* Event types always implicitly polled for. These bits need not be set in diff --git a/libc/sysdeps/linux/microblaze/bits/select.h b/libc/sysdeps/linux/microblaze/bits/select.h deleted file mode 100644 index 7c787b324..000000000 --- a/libc/sysdeps/linux/microblaze/bits/select.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * include/bits/select.h -- fd_set operations - * - * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au> - * Copyright (C) 2001 NEC Corporation - * Copyright (C) 2001 Miles Bader <miles@gnu.org> - * Copyright (C) 1997, 1998 Free Software Foundation, Inc. - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License. See the file COPYING.LIB in the main - * directory of this archive for more details. - */ - -#ifndef _SYS_SELECT_H -# error "Never use <bits/select.h> directly; include <sys/select.h> instead." -#endif - -#ifdef __GNUC__ - -/* We don't use `memset' because this would require a prototype and - the array isn't too big. */ -#define __FD_ZERO(s) \ - do { \ - unsigned int __i; \ - fd_set *__arr = (s); \ - for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \ - __FDS_BITS (__arr)[__i] = 0; \ - } while (0) - -#define __FD_SET(fd, s) \ - do { \ - int __fd = (fd); \ - unsigned int *__addr = (unsigned int *)&__FDS_BITS (s); \ - *__addr |= (1 << __fd); \ - } while (0) - -#define __FD_CLR(fd, s) \ - do { \ - int __fd = (fd); \ - unsigned int *__addr = (unsigned int *)&__FDS_BITS (s); \ - *__addr &= ~(1 << __fd); \ - } while (0) - -#define __FD_ISSET(fd, s) \ - ({ \ - int __fd = (fd); \ - unsigned int *__addr = (unsigned int *)&__FDS_BITS (s); \ - int res; \ - res = (*__addr & (1 << fd)) ? 1 : 0; \ - }) - -#else /* !__GNUC__ */ - -#define __FD_SET(d, s) (__FDS_BITS (s)[__FDELT(d)] |= __FDMASK(d)) -#define __FD_CLR(d, s) (__FDS_BITS (s)[__FDELT(d)] &= ~__FDMASK(d)) -#define __FD_ISSET(d, s) ((__FDS_BITS (s)[__FDELT(d)] & __FDMASK(d)) != 0) - -#endif /* __GNUC__ */ diff --git a/libc/sysdeps/linux/microblaze/bits/setjmp.h b/libc/sysdeps/linux/microblaze/bits/setjmp.h index d966efd2b..b384878de 100644 --- a/libc/sysdeps/linux/microblaze/bits/setjmp.h +++ b/libc/sysdeps/linux/microblaze/bits/setjmp.h @@ -19,7 +19,6 @@ # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead." #endif -#ifndef _ASM typedef struct { /* Stack pointer. */ @@ -28,16 +27,12 @@ typedef struct /* Link pointer. */ void *__lp; - /* Callee-saved registers r18-r30. */ - int __regs[13]; - } __jmp_buf[1]; -#endif + /* SDA pointers */ + void *__SDA; + void *__SDA2; -#define JB_SIZE (4 * 15) - -/* Test if longjmp to JMPBUF would unwind the frame - containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (void *) (jmpbuf)[0].__sp) + /* Callee-saved registers r18-r31. */ + int __regs[14]; + } __jmp_buf[1]; #endif /* bits/setjmp.h */ diff --git a/libc/sysdeps/linux/microblaze/bits/stackinfo.h b/libc/sysdeps/linux/microblaze/bits/stackinfo.h new file mode 100644 index 000000000..f45982e8d --- /dev/null +++ b/libc/sysdeps/linux/microblaze/bits/stackinfo.h @@ -0,0 +1,27 @@ +/* Copyright (C) 1999 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, see + <http://www.gnu.org/licenses/>. */ + +/* This file contains a bit of information about the stack allocation + of the processor. */ + +#ifndef _STACKINFO_H +#define _STACKINFO_H 1 + +/* On microblaze the stack grows down. */ +#define _STACK_GROWS_DOWN 1 + +#endif /* stackinfo.h */ diff --git a/libc/sysdeps/linux/microblaze/bits/syscalls.h b/libc/sysdeps/linux/microblaze/bits/syscalls.h index b21851333..535502b86 100644 --- a/libc/sysdeps/linux/microblaze/bits/syscalls.h +++ b/libc/sysdeps/linux/microblaze/bits/syscalls.h @@ -4,12 +4,55 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -#include <features.h> -/* Do something very evil for now. Until we create our own syscall - * macros, short circuit bits/sysnum.h and use asm/unistd.h instead */ -#warning "fixme -- add arch specific syscall macros.h" -#include <asm/unistd.h> +#ifndef __ASSEMBLER__ -#endif /* _BITS_SYSCALLS_H */ +#include <errno.h> + +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ +(__extension__ \ + ({ \ + register int __ret __asm__("r3"); \ + register int _scno __asm__("r12") = name; \ + LOAD_ARGS_##nr (args); \ + __asm__ __volatile__("brki r14, 0x8" \ + : "=r" (__ret) \ + : "r"(_scno) ASM_ARGS_##nr \ + : __SYSCALL_CLOBBERS ); \ + __ret; \ + }) \ +) +#define INTERNAL_SYSCALL_ERROR_P(val, err) \ + ((unsigned int)(val) >= 0xfffff001U) + +#define LOAD_ARGS_0() do { } while(0) +#define ASM_ARGS_0 +#define LOAD_ARGS_1(a1) \ + register int _a1 __asm__("r5") = (int)(a1); \ + LOAD_ARGS_0() +#define ASM_ARGS_1 ASM_ARGS_0, "r"(_a1) +#define LOAD_ARGS_2(a1, a2) \ + register int _a2 __asm__("r6") = (int)(a2); \ + LOAD_ARGS_1(a1) +#define ASM_ARGS_2 ASM_ARGS_1, "r"(_a2) +#define LOAD_ARGS_3(a1, a2, a3) \ + register int _a3 __asm__("r7") = (int)(a3); \ + LOAD_ARGS_2(a1, a2) +#define ASM_ARGS_3 ASM_ARGS_2, "r"(_a3) +#define LOAD_ARGS_4(a1, a2, a3, a4) \ + register int _a4 __asm__("r8") = (int)(a4); \ + LOAD_ARGS_3(a1, a2, a3) +#define ASM_ARGS_4 ASM_ARGS_3, "r"(_a4) +#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \ + register int _a5 __asm__("r9") = (int)(a5); \ + LOAD_ARGS_4(a1, a2, a3, a4) +#define ASM_ARGS_5 ASM_ARGS_4, "r"(_a5) +#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \ + register int _a6 __asm__("r10") = (int)(a6); \ + LOAD_ARGS_5(a1, a2, a3, a4, a5) +#define ASM_ARGS_6 ASM_ARGS_5, "r"(_a6) +#define __SYSCALL_CLOBBERS "r4", "r14", "cc", "memory" + +#endif /* __ASSEMBLER__ */ +#endif /* _BITS_SYSCALLS_H */ diff --git a/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h b/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h index f4adaf5ad..ea767abbf 100644 --- a/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h +++ b/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h @@ -10,19 +10,19 @@ #undef __UCLIBC_ABORT_INSTRUCTION__ /* can your target use syscall6() for mmap ? */ -#undef __UCLIBC_MMAP_HAS_6_ARGS__ +#define __UCLIBC_MMAP_HAS_6_ARGS__ -/* does your target use syscall4() for truncate64 ? (32bit arches only) */ -#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__ +/* does your target align 64bit values in register pairs ? (32bit arches only) */ +#undef __UCLIBC_SYSCALL_ALIGN_64BIT__ /* does your target have a broken create_module() ? */ #undef __UCLIBC_BROKEN_CREATE_MODULE__ -/* does your target have an asm .set ? */ -#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ +/* does your target have to worry about older [gs]etrlimit() ? */ +#undef __UCLIBC_HANDLE_OLDER_RLIMIT__ -/* define if target doesn't like .global */ -#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__ +/* does your target have an asm .set ? */ +#undef __UCLIBC_HAVE_ASM_SET_DIRECTIVE__ /* define if target supports .weak */ #define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__ @@ -30,10 +30,13 @@ /* define if target supports .weakext */ #undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__ -/* needed probably only for ppc64 */ -#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__ +/* define if target supports CFI pseudo ops */ +#undef __UCLIBC_HAVE_ASM_CFI_DIRECTIVES__ /* define if target supports IEEE signed zero floats */ #define __UCLIBC_HAVE_SIGNED_ZERO__ +/* only weird assemblers generally need this */ +#undef __UCLIBC_ASM_LINE_SEP__ + #endif /* _BITS_UCLIBC_ARCH_FEATURES_H */ diff --git a/libc/sysdeps/linux/microblaze/bits/uClibc_page.h b/libc/sysdeps/linux/microblaze/bits/uClibc_page.h new file mode 100644 index 000000000..580ca1368 --- /dev/null +++ b/libc/sysdeps/linux/microblaze/bits/uClibc_page.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2004 Erik Andersen + * + * This 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. + * + * This 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 this library; if not, see + * <http://www.gnu.org/licenses/>. + */ + +/* Supply an architecture specific value for PAGE_SIZE and friends. */ + +#ifndef _UCLIBC_PAGE_H +#define _UCLIBC_PAGE_H + +#define PAGE_SHIFT 12 +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) + +#endif /* _UCLIBC_PAGE_H */ diff --git a/libc/sysdeps/linux/microblaze/bits/wordsize.h b/libc/sysdeps/linux/microblaze/bits/wordsize.h index ba643b60a..ca82fd7d4 100644 --- a/libc/sysdeps/linux/microblaze/bits/wordsize.h +++ b/libc/sysdeps/linux/microblaze/bits/wordsize.h @@ -12,8 +12,7 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #define __WORDSIZE 32 diff --git a/libc/sysdeps/linux/microblaze/clinkage.h b/libc/sysdeps/linux/microblaze/clinkage.h deleted file mode 100644 index a9beffc96..000000000 --- a/libc/sysdeps/linux/microblaze/clinkage.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * libc/sysdeps/linux/microblaze/clinkage.h -- Macros for C symbols in assembler - * - * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au> - * Copyright (C) 2001 NEC Corporation - * Copyright (C) 2001 Miles Bader <miles@gnu.org> - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License. See the file COPYING.LIB in the main - * directory of this archive for more details. - * - * Written by Miles Bader <miles@gnu.org> - */ - -#include <asm/clinkage.h> diff --git a/libc/sysdeps/linux/microblaze/clone.c b/libc/sysdeps/linux/microblaze/clone.c index a47ee8c68..d92100865 100644 --- a/libc/sysdeps/linux/microblaze/clone.c +++ b/libc/sysdeps/linux/microblaze/clone.c @@ -1,52 +1,47 @@ /* - * libc/sysdeps/linux/microblaze/clone.c -- `clone' syscall for linux/microblaze + * Copyright (C) 2004 Atmel Corporation * - * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au> - * Copyright (C) 2002,03 NEC Electronics Corporation - * Copyright (C) 2002,03 Miles Bader <miles@gnu.org> - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License. See the file COPYING.LIB in the main - * directory of this archive for more details. - * - * Written by Miles Bader <miles@gnu.org> - * Microblaze port by John Williams + * This file is subject to the terms and conditions of the GNU Lesser General + * Public License. See the file "COPYING.LIB" in the main directory of this + * archive for more details. */ - +#include <sched.h> #include <errno.h> #include <sys/syscall.h> +#include <unistd.h> -int -clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg) +int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...) { - register unsigned long rval __asm__ (SYSCALL_RET) = -EINVAL; + int rval = -EINVAL; + if (fn && child_stack) + rval = INTERNAL_SYSCALL(clone, 0, 2, flags, child_stack); + + if (rval == 0) + { + int exitCode = fn(arg); + rval = INTERNAL_SYSCALL(exit, 0, 1, exitCode); + } - if (fn && child_stack) - { - register unsigned long syscall __asm__ (SYSCALL_NUM); - register unsigned long arg0 __asm__ (SYSCALL_ARG0); - register unsigned long arg1 __asm__ (SYSCALL_ARG1); + return rval; +} - /* Clone this thread. */ - arg0 = flags; - arg1 = (unsigned long)child_stack; - syscall = __NR_clone; - __asm__ __volatile__ ("bralid r17, trap;nop;" - : "=r" (rval), "=r" (syscall) - : "1" (syscall), "r" (arg0), "r" (arg1) - : SYSCALL_CLOBBERS); +#ifdef __NR_clone2 +int +__clone2(int (*fn)(void *arg), void *child_stack, size_t stack_size, + int flags, void *arg, ...) +{ + int rval = -EINVAL; + if (fn && child_stack) + { + rval = INTERNAL_SYSCALL(clone2, 0, 3, flags, child_stack, stack_size); + } - if (rval == 0) - /* In child thread, call FN and exit. */ + if (rval == 0) { - arg0 = (*fn) (arg); - syscall = __NR_exit; - __asm__ __volatile__ ("bralid r17, trap;nop;" - : "=r" (rval), "=r" (syscall) - : "1" (syscall), "r" (arg0) - : SYSCALL_CLOBBERS); + int exitCode = fn(arg); + rval = INTERNAL_SYSCALL(exit, 0, 1, exitCode); } - } - __syscall_return (int, rval); + return rval; } +#endif diff --git a/libc/sysdeps/linux/microblaze/crt0.S b/libc/sysdeps/linux/microblaze/crt0.S index 99687b707..6be1e4dfa 100644 --- a/libc/sysdeps/linux/microblaze/crt0.S +++ b/libc/sysdeps/linux/microblaze/crt0.S @@ -20,22 +20,18 @@ .text C_ENTRY(_start): - lw r5, r0, r1 // Arg 0: argc + lw r5, r0, r1 /* Arg 0: argc */ - addi r6, r1, 4 // Arg 1: argv + addi r6, r1, 4 /* Arg 1: argv */ - // Arg 2: envp - addi r3, r5, 1 // skip argc elements to get envp start - // ...plus the NULL at the end of argv - add r3, r3, r3 // Make word offset + /* Arg 2: envp */ + addi r3, r5, 1 /* skip argc elements to get envp start */ + /* ...plus the NULL at the end of argv */ + add r3, r3, r3 /* Make word offset */ add r3, r3, r3 - add r7, r6, r3 // add to argv to get offset + add r7, r6, r3 /* add to argv to get offset */ - // Load SDAs - la r2, r0, C_SYMBOL_NAME(_SDA_BASE_) - la r13, r0, C_SYMBOL_NAME(_SDA2_BASE_) - - // tail-call uclibc's startup routine + /* tail-call uclibc's startup routine */ brid C_SYMBOL_NAME(__uClibc_main) nop diff --git a/libc/sysdeps/linux/microblaze/crt1.S b/libc/sysdeps/linux/microblaze/crt1.S new file mode 100644 index 000000000..7bf8f64c1 --- /dev/null +++ b/libc/sysdeps/linux/microblaze/crt1.S @@ -0,0 +1,57 @@ +/* + * libc/sysdeps/linux/microblaze/crt1.S -- Initial program entry point for linux/microblaze + * + * Copyright (C) 2009 Meyer Sound Laboratories + * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au> + * Copyright (C) 2001,2002 NEC Corporation + * Copyright (C) 2001,2002 Miles Bader <miles@gnu.org> + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License. See the file COPYING.LIB in the main + * directory of this archive for more details. + * + * Written by Miles Bader <miles@gnu.org> + */ + +#include <libc-symbols.h> + +/* Upon entry, the stack contains the following data: + argc, argv[0], ..., argv[argc-1], 0, envp[0], ..., 0 +*/ + + .text + .globl C_SYMBOL_NAME(_start) + .align 4 +C_SYMBOL_NAME(_start): + + /* + Preparing arguments for uClibc's startup routine. + The routine has 6 arguments, so 5 of them are placed + into registers, one on the stack + */ + + la r5, r0, C_SYMBOL_NAME(main) /* Arg 1: main() */ + lw r6, r0, r1 /* Arg 2: argc */ + addi r7, r1, 4 /* Arg 3: argv */ + la r8, r0, _init /* Arg 4: init */ + la r9, r0, _fini /* Arg 5: fini */ + addk r10,r0,r0 /* Arg 6: rtld_fini = NULL */ + + + /* Reserve space for __uClibc_main to save parameters + (Microblaze ABI stack calling convention) + and for stack_end argument to __uClibc_main */ + add r3, r1, r0 + addi r1, r1, -32 + + /* tail-call uClibc's startup routine */ + brid C_SYMBOL_NAME(__uClibc_main) + swi r3, r1, 28 /* Arg 7: stack end [DELAY SLOT] */ + +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 + .weak data_start + data_start = __data_start diff --git a/libc/sysdeps/linux/microblaze/crti.S b/libc/sysdeps/linux/microblaze/crti.S new file mode 100644 index 000000000..e00396897 --- /dev/null +++ b/libc/sysdeps/linux/microblaze/crti.S @@ -0,0 +1,41 @@ +/* + * libc/sysdeps/linux/microblaze/crti.S -- init/fini entry code for microblaze + * (baselined with gcc 4.1.2) + * + * Copyright (C) 2010 Digital Design Corporation + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License. See the file COPYING.LIB in the main + * directory of this archive for more details. + */ + +#define END_INIT +#define END_FINI +#define ALIGN +#include <libc-symbols.h> + +/*@HEADER_ENDS*/ + + .section .init + .align 2 + .globl _init +_init: + addik r1, r1, -32 + swi r19, r1, 28 + addk r19, r1, r0 + swi r15, r1, 0 + + ALIGN + END_INIT + + .section .fini + .align 2 + .globl _fini +_fini: + addik r1, r1, -32 + swi r19, r1, 28 + addk r19, r1, r0 + swi r15, r1, 0 + + ALIGN + END_FINI diff --git a/libc/sysdeps/linux/microblaze/crtn.S b/libc/sysdeps/linux/microblaze/crtn.S new file mode 100644 index 000000000..6f4ef60d3 --- /dev/null +++ b/libc/sysdeps/linux/microblaze/crtn.S @@ -0,0 +1,43 @@ +/* + * libc/sysdeps/linux/microblaze/crtn.S -- init/fini exit code for microblaze + * (baselined with gcc 4.1.2) + * + * Copyright (C) 2010 Digital Design Corporation + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License. See the file COPYING.LIB in the main + * directory of this archive for more details. + */ + +#define END_INIT +#define END_FINI +#define ALIGN +#include <libc-symbols.h> + + .section .init + .align 2 + .globl _init + .ent _init + + lwi r15, r1, 0 + lwi r19, r1, 28 + rtsd r15, 8 + addik r1, r1, 32 # Delay slot + + .end _init +$Lfe2: + + .section .fini + .align 2 + .globl _fini + .ent _fini + + lwi r15, r1, 0 + lwi r19, r1, 28 + rtsd r15, 8 + addik r1, r1, 32 # Delay slot + + .end _fini +$Lfe3: + +/*@TRAILER_BEGINS*/ diff --git a/libc/sysdeps/linux/microblaze/fixdfsi.c b/libc/sysdeps/linux/microblaze/fixdfsi.c new file mode 100644 index 000000000..1611176aa --- /dev/null +++ b/libc/sysdeps/linux/microblaze/fixdfsi.c @@ -0,0 +1,85 @@ +/* +** libgcc support for software floating point. +** Copyright (C) 1991 by Pipeline Associates, Inc. All rights reserved. +** Permission is granted to do *anything* you want with this file, +** commercial or otherwise, provided this message remains intact. So there! +** I would appreciate receiving any updates/patches/changes that anyone +** makes, and am willing to be the repository for said changes (am I +** making a big mistake?). + +Warning! Only single-precision is actually implemented. This file +won't really be much use until double-precision is supported. + +However, once that is done, this file might eventually become a +replacement for libgcc1.c. It might also make possible +cross-compilation for an IEEE target machine from a non-IEEE +host such as a VAX. + +If you'd like to work on completing this, please talk to rms@gnu.ai.mit.edu. + +--> Double precision floating support added by James Carlson on 20 April 1998. + +** +** Pat Wood +** Pipeline Associates, Inc. +** pipeline!phw@motown.com or +** sun!pipeline!phw or +** uunet!motown!pipeline!phw +** +** 05/01/91 -- V1.0 -- first release to gcc mailing lists +** 05/04/91 -- V1.1 -- added float and double prototypes and return values +** -- fixed problems with adding and subtracting zero +** -- fixed rounding in truncdfsf2 +** -- fixed SWAP define and tested on 386 +*/ + +/* +** The following are routines that replace the libgcc soft floating point +** routines that are called automatically when -msoft-float is selected. +** The support single and double precision IEEE format, with provisions +** for byte-swapped machines (tested on 386). Some of the double-precision +** routines work at full precision, but most of the hard ones simply punt +** and call the single precision routines, producing a loss of accuracy. +** long long support is not assumed or included. +** Overall accuracy is close to IEEE (actually 68882) for single-precision +** arithmetic. I think there may still be a 1 in 1000 chance of a bit +** being rounded the wrong way during a multiply. I'm not fussy enough to +** bother with it, but if anyone is, knock yourself out. +** +** Efficiency has only been addressed where it was obvious that something +** would make a big difference. Anyone who wants to do this right for +** best speed should go in and rewrite in assembler. +** +** I have tested this only on a 68030 workstation and 386/ix integrated +** in with -msoft-float. +*/ + +#include "floatlib.h" + +/* convert double to int */ +long +__fixdfsi (double a1) +{ + register union double_long dl1; + register int exp; + register long l; + + dl1.d = a1; + + if (!dl1.l.upper && !dl1.l.lower) + return (0); + + exp = EXPD (dl1) - EXCESSD - 31; + l = MANTD (dl1); + + if (exp > 0) + return SIGND(dl1) ? (1<<31) : ((1ul<<31)-1); + + /* shift down until exp = 0 or l = 0 */ + if (exp < 0 && exp > -32 && l) + l >>= -exp; + else + return (0); + + return (SIGND (dl1) ? -l : l); +} diff --git a/libc/sysdeps/linux/microblaze/floatlib.h b/libc/sysdeps/linux/microblaze/floatlib.h new file mode 100644 index 000000000..817ba7de0 --- /dev/null +++ b/libc/sysdeps/linux/microblaze/floatlib.h @@ -0,0 +1,140 @@ +/* +** libgcc support for software floating point. +** Copyright (C) 1991 by Pipeline Associates, Inc. All rights reserved. +** Permission is granted to do *anything* you want with this file, +** commercial or otherwise, provided this message remains intact. So there! +** I would appreciate receiving any updates/patches/changes that anyone +** makes, and am willing to be the repository for said changes (am I +** making a big mistake?). + +Warning! Only single-precision is actually implemented. This file +won't really be much use until double-precision is supported. + +However, once that is done, this file might eventually become a +replacement for libgcc1.c. It might also make possible +cross-compilation for an IEEE target machine from a non-IEEE +host such as a VAX. + +If you'd like to work on completing this, please talk to rms@gnu.ai.mit.edu. + +--> Double precision floating support added by James Carlson on 20 April 1998. + +** +** Pat Wood +** Pipeline Associates, Inc. +** pipeline!phw@motown.com or +** sun!pipeline!phw or +** uunet!motown!pipeline!phw +** +** 05/01/91 -- V1.0 -- first release to gcc mailing lists +** 05/04/91 -- V1.1 -- added float and double prototypes and return values +** -- fixed problems with adding and subtracting zero +** -- fixed rounding in truncdfsf2 +** -- fixed SWAP define and tested on 386 +*/ + +/* +** The following are routines that replace the libgcc soft floating point +** routines that are called automatically when -msoft-float is selected. +** The support single and double precision IEEE format, with provisions +** for byte-swapped machines (tested on 386). Some of the double-precision +** routines work at full precision, but most of the hard ones simply punt +** and call the single precision routines, producing a loss of accuracy. +** long long support is not assumed or included. +** Overall accuracy is close to IEEE (actually 68882) for single-precision +** arithmetic. I think there may still be a 1 in 1000 chance of a bit +** being rounded the wrong way during a multiply. I'm not fussy enough to +** bother with it, but if anyone is, knock yourself out. +** +** Efficiency has only been addressed where it was obvious that something +** would make a big difference. Anyone who wants to do this right for +** best speed should go in and rewrite in assembler. +** +** I have tested this only on a 68030 workstation and 386/ix integrated +** in with -msoft-float. +*/ + +#ifndef __FLOAT_LIB_H__ +#define __FLOAT_LIB_H__ +/* the following deal with IEEE single-precision numbers */ +#define EXCESS 126 +#define SIGNBIT 0x80000000 +#define HIDDEN (1 << 23) +#define SIGN(fp) ((fp) & SIGNBIT) +#define EXP(fp) (((fp) >> 23) & 0xFF) +#define MANT(fp) (((fp) & 0x7FFFFF) | HIDDEN) +#define PACK(s,e,m) ((s) | ((e) << 23) | (m)) + +/* the following deal with IEEE double-precision numbers */ +#define EXCESSD 1022 +#define HIDDEND (1 << 20) +#define EXPD(fp) (((fp.l.upper) >> 20) & 0x7FF) +#define SIGND(fp) ((fp.l.upper) & SIGNBIT) +#define MANTD(fp) (((((fp.l.upper) & 0xFFFFF) | HIDDEND) << 10) | \ + (fp.l.lower >> 22)) +#define HIDDEND_LL ((long long)1 << 52) +#define MANTD_LL(fp) ((fp.ll & (HIDDEND_LL-1)) | HIDDEND_LL) +#define PACKD_LL(s,e,m) (((long long)((s)+((e)<<20))<<32)|(m)) + +/* define SWAP for 386/960 reverse-byte-order brain-damaged CPUs */ +union double_long { + double d; +#ifdef SWAP + struct { + unsigned long lower; + long upper; + } l; +#else + struct { + long upper; + unsigned long lower; + } l; +#endif + long long ll; +}; + +union float_long + { + float f; + long l; + }; + +#endif + +/* Functions defined in different files */ + +float __addsf3 (float, float); +float __subsf3 (float, float); +long __cmpsf2 (float, float); +float __mulsf3 (float, float); +float __divsf3 (float, float); +double __floatsidf (register long); +double __floatdidf (register long long); +float __floatsisf (register long ); +float __floatdisf (register long long ); +float __negsf2 (float); +double __negdf2 (double); +double __extendsfdf2 (float); +float __truncdfsf2 (double); +long __cmpdf2 (double, double); +long __fixsfsi (float); +long __fixdfsi (double); +long long __fixdfdi (double); +unsigned long __fixunsdfsi (double); +unsigned long long __fixunsdfdi (double); +double __adddf3 (double, double); +double __subdf3 (double, double); +double __muldf3 (double, double); +double __divdf3 (double, double); +int __gtdf2 (double, double); +int __gedf2 (double, double); +int __ltdf2 (double, double); +int __ledf2 (double, double); +int __eqdf2 (double, double); +int __nedf2 (double, double); +int __gtsf2 (float, float); +int __gesf2 (float, float); +int __ltsf2 (float, float); +int __lesf2 (float, float); +int __eqsf2 (float, float); +int __nesf2 (float, float); diff --git a/libc/sysdeps/linux/microblaze/jmpbuf-offsets.h b/libc/sysdeps/linux/microblaze/jmpbuf-offsets.h new file mode 100644 index 000000000..c6cccc739 --- /dev/null +++ b/libc/sysdeps/linux/microblaze/jmpbuf-offsets.h @@ -0,0 +1,6 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +#define JB_SIZE (4 * 18) diff --git a/libc/sysdeps/linux/microblaze/jmpbuf-unwind.h b/libc/sysdeps/linux/microblaze/jmpbuf-unwind.h new file mode 100644 index 000000000..a24cd12f0 --- /dev/null +++ b/libc/sysdeps/linux/microblaze/jmpbuf-unwind.h @@ -0,0 +1,11 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +#include <setjmp.h> + +/* Test if longjmp to JMPBUF would unwind the frame + containing a local variable at ADDRESS. */ +#define _JMPBUF_UNWINDS(jmpbuf, address) \ + ((void *) (address) < (void *) (jmpbuf)[0].__sp) diff --git a/libc/sysdeps/linux/microblaze/mmap.c b/libc/sysdeps/linux/microblaze/mmap.c deleted file mode 100644 index cad528d17..000000000 --- a/libc/sysdeps/linux/microblaze/mmap.c +++ /dev/null @@ -1,17 +0,0 @@ -/* Use new style mmap for microblaze */ -/* - * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> - * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - */ - -#include <unistd.h> -#include <errno.h> -#include <sys/mman.h> -#include <sys/syscall.h> - -libc_hidden_proto(mmap) - -_syscall6 (__ptr_t, mmap, __ptr_t, addr, size_t, len, int, prot, - int, flags, int, fd, __off_t, offset); -libc_hidden_def(mmap) diff --git a/libc/sysdeps/linux/microblaze/setjmp.S b/libc/sysdeps/linux/microblaze/setjmp.S index 7068d4b40..3c1d8a1dd 100644 --- a/libc/sysdeps/linux/microblaze/setjmp.S +++ b/libc/sysdeps/linux/microblaze/setjmp.S @@ -8,46 +8,74 @@ * This file is subject to the terms and conditions of the GNU Lesser * General Public License. See the file COPYING.LIB in the main * directory of this archive for more details. - * + * * Written by Miles Bader <miles@gnu.org> - */ + * + * PIC code based on glibc 2.3.6 */ + +/* + 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. -#define _SETJMP_H -#define _ASM -#include <bits/setjmp.h> + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ -#include <clinkage.h> +#include <libc-symbols.h> .text -C_ENTRY(setjmp): - addi r6, r0, 1 /* Save the signal mask. */ + .globl C_SYMBOL_NAME(setjmp) + .align 4 +C_SYMBOL_NAME(setjmp): +#ifdef __PIC__ + brid 1f +#else braid C_SYMBOL_NAME(__sigsetjmp) - nop +#endif + addi r6, r0, 1 /* Save the signal mask. */ .globl C_SYMBOL_NAME(_setjmp) C_SYMBOL_NAME(_setjmp): - add r6, r0, r0 /* Don't save the signal mask. */ + and r6, r0, r0 /* Don't save the signal mask. */ .globl C_SYMBOL_NAME(__sigsetjmp) C_SYMBOL_NAME(__sigsetjmp): +1: /* Save registers relative to r5 (arg0)*/ swi r1, r5, 0 /* stack pointer */ swi r15, r5, 4 /* link register */ - swi r18, r5, 8 /* assembler temp */ - swi r19, r5, 12 /* now call-preserved regs */ - swi r20, r5, 16 - swi r21, r5, 20 - swi r22, r5, 24 - swi r23, r5, 28 - swi r24, r5, 32 - swi r25, r5, 36 - swi r26, r5, 40 - swi r27, r5, 44 - swi r28, r5, 48 - swi r29, r5, 52 - swi r30, r5, 56 + swi r2, r5, 8 /* SDA and SDA2 ptrs */ + swi r13, r5, 12 + swi r18, r5, 16 /* assembler temp */ + swi r19, r5, 20 /* now call-preserved regs */ + swi r20, r5, 24 + swi r21, r5, 28 + swi r22, r5, 32 + swi r23, r5, 36 + swi r24, r5, 40 + swi r25, r5, 44 + swi r26, r5, 48 + swi r27, r5, 52 + swi r28, r5, 56 + swi r29, r5, 60 + swi r30, r5, 64 + swi r31, r5, 68 /* Make a tail call to __sigjmp_save; it takes the same args. */ +#ifdef __PIC__ + mfs r12,rpc + addik r12,r12,_GLOBAL_OFFSET_TABLE_+8 + lwi r12,r12,__sigjmp_save@GOT + brad r12 + nop +#else braid C_SYMBOL_NAME(__sigjmp_save) nop -C_END(setjmp) +#endif diff --git a/libc/sysdeps/linux/microblaze/sys/procfs.h b/libc/sysdeps/linux/microblaze/sys/procfs.h new file mode 100644 index 000000000..eca782856 --- /dev/null +++ b/libc/sysdeps/linux/microblaze/sys/procfs.h @@ -0,0 +1,144 @@ +/* Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002 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, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _SYS_PROCFS_H +#define _SYS_PROCFS_H 1 + +/* This is somewhat modelled after the file of the same name on SVR4 + systems. It provides a definition of the core file format for ELF + used on Linux. It doesn't have anything to do with the /proc file + system, even though Linux has one. + + Anyway, the whole purpose of this file is for GDB and GDB only. + Don't read too much into it. Don't use it for anything other than + GDB unless you know what you are doing. */ + +#include <features.h> +#include <sys/time.h> +#include <sys/types.h> + + +/* Type for a general-purpose register. */ +#ifndef ELF_GREG_T +#define ELF_GREG_T +typedef unsigned long elf_greg_t; +#endif + +/* This is exactly the same as `struct pt_regs' in the kernel. */ +struct elf_gregset +{ + elf_greg_t gpr[32]; /* General purpose registers. */ + + elf_greg_t pc; /* program counter */ + elf_greg_t psw; /* program status word */ + elf_greg_t ear; /* Exception address register */ + elf_greg_t esr; /* Excep[tion Status Register */ + elf_greg_t fsr; /* FPU Status register */ + + elf_greg_t kernel_mode; /* 1 if in `kernel mode', 0 if user mode */ + elf_greg_t single_step; /* 1 if in single step mode */ +}; + +#ifndef ELF_NGREG +#define ELF_NGREG (sizeof (struct elf_gregset) / sizeof(elf_greg_t)) +#endif + +#ifndef ELF_GREGSET_T +#define ELF_GREGSET_T +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; +#endif + +/* Register set for the floating-point registers. */ +#ifndef ELF_FPREGSET_T +#define ELF_FPREGSET_T +typedef elf_greg_t elf_fpregset_t; +#endif + +struct elf_siginfo +{ + int si_signo; /* signal number */ + int si_code; /* extra code */ + int si_errno; /* errno */ +}; + + +/* + * Definitions to generate Intel SVR4-like core files. + * These mostly have the same names as the SVR4 types with "elf_" + * tacked on the front to prevent clashes with linux definitions, + * and the typedef forms have been avoided. This is mostly like + * the SVR4 structure, but more Linuxy, with things that Linux does + * not support and which gdb doesn't really use excluded. + * Fields present but not used are marked with "XXX". + */ +struct elf_prstatus +{ + struct elf_siginfo pr_info; /* Info associated with signal */ + short pr_cursig; /* Current signal */ + unsigned long pr_sigpend; /* Set of pending signals */ + unsigned long pr_sighold; /* Set of held signals */ + __kernel_pid_t pr_pid; + __kernel_pid_t pr_ppid; + __kernel_pid_t pr_pgrp; + __kernel_pid_t pr_sid; + struct timeval pr_utime; /* User time */ + struct timeval pr_stime; /* System time */ + struct timeval pr_cutime; /* Cumulative user time */ + struct timeval pr_cstime; /* Cumulative system time */ + elf_gregset_t pr_reg; /* GP registers */ + int pr_fpvalid; /* True if math co-processor being used. */ +}; + +#define ELF_PRARGSZ (80) /* Number of chars for args */ + +struct elf_prpsinfo +{ + char pr_state; /* numeric process state */ + char pr_sname; /* char for pr_state */ + char pr_zomb; /* zombie */ + char pr_nice; /* nice val */ + unsigned long pr_flag; /* flags */ + __kernel_uid_t pr_uid; + __kernel_gid_t pr_gid; + __kernel_pid_t pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* filename of executable */ + char pr_psargs[ELF_PRARGSZ]; /* initial part of arg list */ +}; + + +/* The rest of this file provides the types for emulation of the + Solaris <proc_service.h> interfaces that should be implemented by + users of libthread_db. */ + +/* Addresses. */ +typedef void *psaddr_t; + +/* Register sets. Linux has different names. */ +typedef elf_gregset_t prgregset_t; +typedef elf_fpregset_t prfpregset_t; + +/* We don't have any differences between processes and threads, + therefore have only one PID type. */ +typedef __kernel_pid_t lwpid_t; + +/* Process status and info. In the end we do provide typedefs for them. */ +typedef struct elf_prstatus prstatus_t; +typedef struct elf_prpsinfo prpsinfo_t; + + +#endif /* sys/procfs.h */ diff --git a/libc/sysdeps/linux/microblaze/sys/ptrace.h b/libc/sysdeps/linux/microblaze/sys/ptrace.h index b7a9adf25..a81f97162 100644 --- a/libc/sysdeps/linux/microblaze/sys/ptrace.h +++ b/libc/sysdeps/linux/microblaze/sys/ptrace.h @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_PTRACE_H #define _SYS_PTRACE_H 1 @@ -65,12 +64,16 @@ enum __ptrace_request PTRACE_KILL = 8, #define PT_KILL PTRACE_KILL + /* Single step the process. */ + PTRACE_SINGLESTEP = 9, +#define PT_STEP PTRACE_SINGLESTEP + /* Attach to a process that is already running. */ - PTRACE_ATTACH = 0x10, + PTRACE_ATTACH = 16, #define PT_ATTACH PTRACE_ATTACH /* Detach from a process attached to with PTRACE_ATTACH. */ - PTRACE_DETACH = 0x11, + PTRACE_DETACH = 17, #define PT_DETACH PTRACE_DETACH /* Continue and stop at the next (return from) syscall. */ diff --git a/libc/sysdeps/linux/microblaze/sys/ucontext.h b/libc/sysdeps/linux/microblaze/sys/ucontext.h index 07f0933ff..7c5e30384 100644 --- a/libc/sysdeps/linux/microblaze/sys/ucontext.h +++ b/libc/sysdeps/linux/microblaze/sys/ucontext.h @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _SYS_UCONTEXT_H #define _SYS_UCONTEXT_H 1 diff --git a/libc/sysdeps/linux/microblaze/sys/user.h b/libc/sysdeps/linux/microblaze/sys/user.h new file mode 100644 index 000000000..eafb88553 --- /dev/null +++ b/libc/sysdeps/linux/microblaze/sys/user.h @@ -0,0 +1,76 @@ +/* Copyright (C) 1998, 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, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _SYS_USER_H +#define _SYS_USER_H 1 + +/* The whole purpose of this file is for GDB and GDB only. Don't read + too much into it. Don't use it for anything other than GDB unless + you know what you are doing. */ + +struct user_fpregs_struct +{ + long int cwd; + long int swd; + long int twd; + long int fip; + long int fcs; + long int foo; + long int fos; + long int st_space [20]; +}; + +struct user_regs_struct +{ + unsigned int gpr[32]; + unsigned int pc; + unsigned int msr; + unsigned int ear; + unsigned int esr; + unsigned int fsr; + unsigned int btr; + unsigned int pvr[12]; +}; + +struct user +{ + struct user_regs_struct regs; + int u_fpvalid; + struct user_fpregs_struct i387; + unsigned long int u_tsize; + unsigned long int u_dsize; + unsigned long int u_ssize; + unsigned long start_code; + unsigned long start_stack; + long int signal; + int reserved; + struct user_regs_struct* u_ar0; + struct user_fpregs_struct* u_fpstate; + unsigned long int magic; + char u_comm [32]; + int u_debugreg [8]; +}; + +#define PAGE_SHIFT 12 +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) +#define NBPG PAGE_SIZE +#define UPAGES 1 +#define HOST_TEXT_START_ADDR (u.start_code) +#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) + +#endif /* _SYS_USER_H */ diff --git a/libc/sysdeps/linux/microblaze/syscall.c b/libc/sysdeps/linux/microblaze/syscall.c deleted file mode 100644 index 0e07e4595..000000000 --- a/libc/sysdeps/linux/microblaze/syscall.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * libc/sysdeps/linux/microblaze/syscall.c -- generic syscall function for linux/microblaze - * - * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au> - * Copyright (C) 2002 NEC Corporation - * Copyright (C) 2002 Miles Bader <miles@gnu.org> - * - * This file is subject to the terms and conditions of the GNU Lesser - * General Public License. See the file COPYING.LIB in the main - * directory of this archive for more details. - * - * Written by Miles Bader <miles@gnu.org> - */ - -#include <errno.h> -#include <sys/syscall.h> - -typedef unsigned long arg_t; - -/* Invoke `system call' NUM, passing it the remaining arguments. - This is completely system-dependent, and not often useful. */ -long -syscall (long num, arg_t a1, arg_t a2, arg_t a3, arg_t a4, arg_t a5, arg_t a6) -{ - /* We don't know how many arguments are valid, so A5 and A6 are fetched - off the stack even for (the majority of) system calls with fewer - arguments; hopefully this won't cause any problems. A1-A4 are in - registers, so they're OK. */ - register arg_t a __asm__ (SYSCALL_ARG0) = a1; - register arg_t b __asm__ (SYSCALL_ARG1) = a2; - register arg_t c __asm__ (SYSCALL_ARG2) = a3; - register arg_t d __asm__ (SYSCALL_ARG3) = a4; - register arg_t e __asm__ (SYSCALL_ARG4) = a5; - register arg_t f __asm__ (SYSCALL_ARG5) = a6; - register unsigned long syscall __asm__ (SYSCALL_NUM) = num; - register unsigned long ret __asm__ (SYSCALL_RET); - unsigned long ret_sav; - - *((unsigned long *)0xFFFF4004) = (unsigned int)('+'); - __asm__ ("brlid r17, 08x; nop;" - : "=r" (ret) - : "r" (syscall), "r" (a), "r" (b), "r" (c), "r" (d), "r" (e), "r" (f) - : SYSCALL_CLOBBERS); - - ret_sav=ret; - *((unsigned long *)0xFFFF4004) = (unsigned int)('-'); - - - - __syscall_return (long, ret); -} diff --git a/libc/sysdeps/linux/microblaze/vfork.S b/libc/sysdeps/linux/microblaze/vfork.S index 1e802ae29..cd6012889 100644 --- a/libc/sysdeps/linux/microblaze/vfork.S +++ b/libc/sysdeps/linux/microblaze/vfork.S @@ -1,44 +1,47 @@ /* * libc/sysdeps/linux/microblaze/vfork.S -- `vfork' syscall for linux/microblaze * + * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au> * Copyright (C) 2001 NEC Corporation * Copyright (C) 2001 Miles Bader <miles@gnu.org> - * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au> - * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. - */ -/* + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License. See the file COPYING.LIB in the main + * directory of this archive for more details. + * * Written by Miles Bader <miles@gnu.org> * Microblaze port by John Williams */ -#define _ERRNO_H 1 -#include <bits/errno.h> -#define _SYSCALL_H -#include <bits/sysnum.h> - -#include <clinkage.h> +#include <sys/syscall.h> /* Clone the calling process, but without copying the whole address space. The calling process is suspended until the new process exits or is replaced by a call to `execve'. Return -1 for errors, 0 to the new process, and the process ID of the new process to the old process. */ -.global C_SYMBOL_NAME(errno) - -C_ENTRY (__vfork): + .globl __vfork + .hidden __vfork + .align 4 +__vfork: addi r12, r0, SYS_vfork - bralid r17, 0x08; - nop - addi r4, r3, 125 // minimum err value - blti r4, 1f // is r3 < -125? - rtsd r15, 8 // normal return - nop -1: sub r3, r3, r0 // r3 = -r3 + brki r14, 0x08; + addi r4, r3, 125 /* minimum err value */ + blti r4, 1f /* is r3 < -125? */ + bri 2f /* normal return */ +1: sub r3, r3, r0 /* r3 = -r3 */ +#ifdef __PIC__ + mfs r3,rpc + addik r3,r3,_GLOBAL_OFFSET_TABLE_+8 + lwi r3,r3,C_SYMBOL_NAME(errno)@GOT + sw r3, r0, r3 +#else swi r3, r0, C_SYMBOL_NAME(errno); - rtsd r15, 8 // error return +#endif + /* state restore etc */ +2: rtsd r15, 8 /* error return */ nop -C_END(__vfork) + .size __vfork, .-__vfork + weak_alias(__vfork,vfork) -libc_hidden_weak(vfork) +libc_hidden_def(vfork) |
