diff options
-rw-r--r-- | include/sys/kd.h | 4 | ||||
-rw-r--r-- | include/sys/mount.h | 13 | ||||
-rw-r--r-- | include/sys/param.h | 14 | ||||
-rw-r--r-- | include/sys/sysctl.h | 46 | ||||
-rw-r--r-- | ldso/ldso/m68k/dl-sysdep.h | 10 | ||||
-rw-r--r-- | ldso/ldso/m68k/elfinterp.c | 2 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/bits/syscalls.h | 266 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h | 2 | ||||
-rw-r--r-- | libc/sysdeps/linux/bfin/syscall.c | 64 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/getcwd.c | 4 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/mremap.c | 9 | ||||
-rw-r--r-- | libc/sysdeps/linux/m68k/clone.S | 6 | ||||
-rw-r--r-- | libc/sysdeps/linux/m68k/crt1.S | 15 |
13 files changed, 275 insertions, 180 deletions
diff --git a/include/sys/kd.h b/include/sys/kd.h index acd705723..d459c079e 100644 --- a/include/sys/kd.h +++ b/include/sys/kd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 2005 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 @@ -21,7 +21,7 @@ /* Make sure the <linux/types.h> header is not loaded. */ #ifndef _LINUX_TYPES_H -# define _LINUX_TYPES_H 1 +# define _LINUX_TYPES_H 1 # define __undef_LINUX_TYPES_H #endif diff --git a/include/sys/mount.h b/include/sys/mount.h index f768d4dc7..b30554987 100644 --- a/include/sys/mount.h +++ b/include/sys/mount.h @@ -1,5 +1,5 @@ /* Header file for mounting/unmount Linux filesystems. - Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1996,1997,1998,1999,2000,2004 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 @@ -62,7 +62,8 @@ enum }; /* Flags that can be altered by MS_REMOUNT */ -#define MS_RMT_MASK (MS_RDONLY | MS_MANDLOCK) +#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME \ + |MS_NODIRATIME) /* Magic mount flag number. Has to be or-ed to the flag values. */ @@ -82,6 +83,14 @@ enum #define BLKFLSBUF _IO(0x12, 97) /* Flush buffer cache. */ #define BLKRASET _IO(0x12, 98) /* Set read ahead for block device. */ #define BLKRAGET _IO(0x12, 99) /* Get current read ahead setting. */ +#define BLKFRASET _IO(0x12,100) /* Set filesystem read-ahead. */ +#define BLKFRAGET _IO(0x12,101) /* Get filesystem read-ahead. */ +#define BLKSECTSET _IO(0x12,102) /* Set max sectors per request. */ +#define BLKSECTGET _IO(0x12,103) /* Get max sectors per request. */ +#define BLKSSZGET _IO(0x12,104) /* Get block device sector size. */ +#define BLKBSZGET _IOR(0x12,112,size_t) +#define BLKBSZSET _IOW(0x12,113,size_t) +#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size. */ /* Possible value for FLAGS parameter of `umount2'. */ diff --git a/include/sys/param.h b/include/sys/param.h index d64f4b9a9..0b0424eb9 100644 --- a/include/sys/param.h +++ b/include/sys/param.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1997,2000,2001,2003 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 @@ -49,10 +49,16 @@ /* Macros for counting and rounding. */ #ifndef howmany -# define howmany(x, y) (((x)+((y)-1))/(y)) +# define howmany(x, y) (((x) + ((y) - 1)) / (y)) #endif -#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) -#define powerof2(x) ((((x)-1)&(x))==0) +#ifdef __GNUC__ +# define roundup(x, y) (__builtin_constant_p (y) && powerof2 (y) \ + ? (((x) + (y) - 1) & ~((y) - 1)) \ + : ((((x) + ((y) - 1)) / (y)) * (y))) +#else +# define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) +#endif +#define powerof2(x) ((((x) - 1) & (x)) == 0) /* Macros for min/max. */ #define MIN(a,b) (((a)<(b))?(a):(b)) diff --git a/include/sys/sysctl.h b/include/sys/sysctl.h index bdc8ad215..110efaa76 100644 --- a/include/sys/sysctl.h +++ b/include/sys/sysctl.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1999, 2002, 2003, 2004 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 @@ -17,16 +17,52 @@ 02111-1307 USA. */ #ifndef _SYS_SYSCTL_H - #define _SYS_SYSCTL_H 1 -#include <features.h> - -__BEGIN_DECLS +#include <features.h> #define __need_size_t #include <stddef.h> +/* Prevent more kernel headers than necessary to be included. */ +#ifndef _LINUX_KERNEL_H +# define _LINUX_KERNEL_H 1 +# define __undef_LINUX_KERNEL_H +#endif +#ifndef _LINUX_TYPES_H +# define _LINUX_TYPES_H 1 +# define __undef_LINUX_TYPES_H +#endif +#ifndef _LINUX_LIST_H +# define _LINUX_LIST_H 1 +# define __undef_LINUX_LIST_H +#endif +#ifndef __LINUX_COMPILER_H +# define __LINUX_COMPILER_H 1 +# define __user +# define __undef__LINUX_COMPILER_H +#endif + #include <linux/sysctl.h> +#ifdef __undef_LINUX_KERNEL_H +# undef _LINUX_KERNEL_H +# undef __undef_LINUX_KERNEL_H +#endif +#ifdef __undef_LINUX_TYPES_H +# undef _LINUX_TYPES_H +# undef __undef_LINUX_TYPES_H +#endif +#ifdef __undef_LINUX_LIST_H +# undef _LINUX_LIST_H +# undef __undef_LINUX_LIST_H +#endif +#ifdef __undef__LINUX_COMPILER_H +# undef __LINUX_COMPILER_H +# undef __user +# undef __undef__LINUX_COMPILER_H +#endif + +__BEGIN_DECLS + /* Read or write system parameters. */ extern int sysctl (int *__name, int __nlen, void *__oldval, size_t *__oldlenp, void *__newval, size_t __newlen) __THROW; diff --git a/ldso/ldso/m68k/dl-sysdep.h b/ldso/ldso/m68k/dl-sysdep.h index c11d2fbfe..cf1d22004 100644 --- a/ldso/ldso/m68k/dl-sysdep.h +++ b/ldso/ldso/m68k/dl-sysdep.h @@ -11,8 +11,8 @@ /* Initialization sequence for a GOT. */ #define INIT_GOT(GOT_BASE,MODULE) \ do { \ - GOT_BASE[2] = (int) _dl_linux_resolve; \ - GOT_BASE[1] = (int) (MODULE); \ + GOT_BASE[2] = (unsigned long) _dl_linux_resolve; \ + GOT_BASE[1] = (unsigned long) (MODULE); \ } while(0) /* Here we define the magic numbers that this dynamic loader should accept */ @@ -23,11 +23,7 @@ do { \ #define ELF_TARGET "m68k" struct elf_resolve; -extern unsigned int _dl_linux_resolver (struct elf_resolve *, int); - -/* Define this because we do not want to call .udiv in the library. - Not needed for m68k. */ -#define do_rem(result, n, base) ((result) = (n) % (base)) +extern unsigned long _dl_linux_resolver (struct elf_resolve *, int); /* 4096 bytes alignment */ #define PAGE_ALIGN 0xfffff000 diff --git a/ldso/ldso/m68k/elfinterp.c b/ldso/ldso/m68k/elfinterp.c index 914dc0ef6..e0e14409f 100644 --- a/ldso/ldso/m68k/elfinterp.c +++ b/ldso/ldso/m68k/elfinterp.c @@ -44,7 +44,7 @@ extern int _dl_linux_resolve(void); -unsigned int +unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) { int reloc_type; diff --git a/libc/sysdeps/linux/bfin/bits/syscalls.h b/libc/sysdeps/linux/bfin/bits/syscalls.h index d8d628cab..475d193ce 100644 --- a/libc/sysdeps/linux/bfin/bits/syscalls.h +++ b/libc/sysdeps/linux/bfin/bits/syscalls.h @@ -4,169 +4,177 @@ # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead." #endif -#include <features.h> - /* This includes the `__NR_<name>' syscall numbers taken from the Linux kernel * header files. It also defines the traditional `SYS_<name>' macros for older * programs. */ #include <bits/sysnum.h> -/* This code is mostly cut & paste from the uClinux bfin port */ +#ifndef __set_errno +# define __set_errno(val) ((*__errno_location ()) = (val)) +#endif + +#ifndef SYS_ify +# define SYS_ify(syscall_name) (__NR_##syscall_name) +#endif #ifndef __ASSEMBLER__ -#define __syscall_return(type, res) \ -do { \ - if ((unsigned long)(res) >= (unsigned long)(-125)) \ - { __set_errno(-(res)); \ - res = -1; \ - } \ - return (type) (res); \ +/* user-visible error numbers are in the range -1 - -4095: see <asm-frv/errno.h> */ +#if defined _LIBC && !defined __set_errno +# define __syscall_return(type, res) \ +do { \ + unsigned long __sr2 = (res); \ + if (__builtin_expect ((unsigned long)(__sr2) \ + >= (unsigned long)(-4095), 0)) { \ + extern int __syscall_error (int); \ + return (type) __syscall_error (__sr2); \ + } \ + return (type) (__sr2); \ } while (0) +#else +# define __syscall_return(type, res) \ +do { \ + unsigned long __sr2 = (res); \ + if (__builtin_expect ((unsigned long)(__sr2) \ + >= (unsigned long)(-4095), 0)) { \ + __set_errno (-__sr2); \ + __sr2 = -1; \ + } \ + return (type) (__sr2); \ +} while (0) +#endif #define _syscall0(type,name) \ type name(void) { \ - long __res; \ - __asm__ __volatile__ ( \ - "p0 = %1;\n\t" \ - "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name) \ - : "CC", "P0"); \ -__syscall_return(type,__res); \ + long __res; \ + __asm__ __volatile__ ( \ + "p0 = %1;\n\t" \ + "excpt 0;\n\t" \ + "%0=r0;\n\t" \ + : "=da" (__res) \ + : "i" (__NR_##name) \ + : "memory","CC","R0","P0"); \ + __syscall_return(type,__res); \ } #define _syscall1(type,name,type1,arg1) \ type name(type1 arg1) { \ - long __res; \ - __asm__ __volatile__ ( \ - "r0=%2;\n\t" \ - "p0=%1;\n\t" \ - "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "a" ((long)(arg1)) \ - : "CC", "R0", "P0"); \ -__syscall_return(type,__res); \ + long __res; \ + __asm__ __volatile__ ( \ + "r0=%2;\n\t" \ + "p0=%1;\n\t" \ + "excpt 0;\n\t" \ + "%0=r0;\n\t" \ + : "=da" (__res) \ + : "i" (__NR_##name), \ + "rm" ((long)(arg1)) \ + : "memory","CC","R0","P0"); \ + __syscall_return(type,__res); \ } #define _syscall2(type,name,type1,arg1,type2,arg2) \ type name(type1 arg1,type2 arg2) { \ - long __res; \ - __asm__ __volatile__ ( \ - "r1=%3;\n\t" \ - "r0=%2;\n\t" \ - "p0=%1;\n\t" \ - "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "a" ((long)(arg1)), \ - "a" ((long)(arg2)) \ - : "CC", "R0","R1", "P0"); \ -__syscall_return(type,__res); \ + long __res; \ + __asm__ __volatile__ ( \ + "r1=%3;\n\t" \ + "r0=%2;\n\t" \ + "p0=%1;\n\t" \ + "excpt 0;\n\t" \ + "%0=r0;\n\t" \ + : "=da" (__res) \ + : "i" (__NR_##name), \ + "rm" ((long)(arg1)), \ + "rm" ((long)(arg2)) \ + : "memory","CC","R0","R1","P0"); \ + __syscall_return(type,__res); \ } - #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ type name(type1 arg1,type2 arg2,type3 arg3) { \ - long __res; \ - __asm__ __volatile__ ( \ - "r2=%4;\n\t" \ - "r1=%3;\n\t" \ - "r0=%2;\n\t" \ - "p0=%1;\n\t" \ - "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "a" ((long)(arg1)), \ - "a" ((long)(arg2)), \ - "a" ((long)(arg3)) \ - : "CC", "R0","R1","R2", "P0"); \ -__syscall_return(type,__res); \ + long __res; \ + __asm__ __volatile__ ( \ + "r2=%4;\n\t" \ + "r1=%3;\n\t" \ + "r0=%2;\n\t" \ + "p0=%1;\n\t" \ + "excpt 0;\n\t" \ + "%0=r0;\n\t" \ + : "=da" (__res) \ + : "i" (__NR_##name), \ + "rm" ((long)(arg1)), \ + "rm" ((long)(arg2)), \ + "rm" ((long)(arg3)) \ + : "memory","CC","R0","R1","R2","P0"); \ + __syscall_return(type,__res); \ } #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ - long __res; \ - __asm__ __volatile__ ( \ - "[--sp] = r3;\n\t" \ - "r3=%5;\n\t" \ - "r2=%4;\n\t" \ - "r1=%3;\n\t" \ - "r0=%2;\n\t" \ - "p0=%1;\n\t" \ - "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - "r3 = [sp++];\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "a" ((long)(arg1)), \ - "a" ((long)(arg2)), \ - "a" ((long)(arg3)), \ - "a" ((long)(arg4)) \ - : "CC", "R0","R1","R2","R3", "P0"); \ -__syscall_return(type,__res); \ + long __res; \ + __asm__ __volatile__ ( \ + "r3=%5;\n\t" \ + "r2=%4;\n\t" \ + "r1=%3;\n\t" \ + "r0=%2;\n\t" \ + "p0=%1;\n\t" \ + "excpt 0;\n\t" \ + "%0=r0;\n\t" \ + : "=da" (__res) \ + : "i" (__NR_##name), \ + "rm" ((long)(arg1)), \ + "rm" ((long)(arg2)), \ + "rm" ((long)(arg3)), \ + "rm" ((long)(arg4)) \ + : "memory","CC","R0","R1","R2","R3","P0"); \ + __syscall_return(type,__res); \ } #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ - long __res; \ - __asm__ __volatile__ ( \ - "[--sp] = r4;\n\t" \ - "[--sp] = r3;\n\t" \ - "r4=%6;\n\t" \ - "r3=%5;\n\t" \ - "r2=%4;\n\t" \ - "r1=%3;\n\t" \ - "r0=%2;\n\t" \ - "P0=%1;\n\t" \ - "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - "r3 = [sp++];\n\t" \ - "r4 = [sp++];\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "rm" ((long)(arg1)), \ - "rm" ((long)(arg2)), \ - "rm" ((long)(arg3)), \ - "rm" ((long)(arg4)), \ - "rm" ((long)(arg5)) \ - : "CC","R0","R1","R2","R3","R4","P0"); \ -__syscall_return(type,__res); \ + long __res; \ + __asm__ __volatile__ ( \ + "r4=%6;\n\t" \ + "r3=%5;\n\t" \ + "r2=%4;\n\t" \ + "r1=%3;\n\t" \ + "r0=%2;\n\t" \ + "P0=%1;\n\t" \ + "excpt 0;\n\t" \ + "%0=r0;\n\t" \ + : "=da" (__res) \ + : "i" (__NR_##name), \ + "rm" ((long)(arg1)), \ + "rm" ((long)(arg2)), \ + "rm" ((long)(arg3)), \ + "rm" ((long)(arg4)), \ + "rm" ((long)(arg5)) \ + : "memory","CC","R0","R1","R2","R3","R4","P0"); \ + __syscall_return(type,__res); \ } -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ -type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) { \ - long __res; \ - __asm__ __volatile__ ( \ - "[--sp] = r5;\n\t" \ - "[--sp] = r4;\n\t" \ - "[--sp] = r3;\n\t" \ - "r4=%6;\n\t" \ - "r3=%5;\n\t" \ - "r2=%4;\n\t" \ - "r1=%3;\n\t" \ - "r0=%2;\n\t" \ - "P0=%1;\n\t" \ - "excpt 0;\n\t" \ - "%0=r0;\n\t" \ - "r3 = [sp++];\n\t" \ - "r4 = [sp++];\n\t" \ - "r5 = [sp++];\n\t" \ - : "=da" (__res) \ - : "i" (__NR_##name), \ - "rm" ((long)(arg1)), \ - "rm" ((long)(arg2)), \ - "rm" ((long)(arg3)), \ - "rm" ((long)(arg4)), \ - "rm" ((long)(arg5)), \ - "rm" ((long)(arg6)) \ - : "CC","R0","R1","R2","R3","R4","R5","P0"); \ -__syscall_return(type,__res); \ +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) { \ + long __res; \ + __asm__ __volatile__ ( \ + "r5=%7;\n\t" \ + "r4=%6;\n\t" \ + "r3=%5;\n\t" \ + "r2=%4;\n\t" \ + "r1=%3;\n\t" \ + "r0=%2;\n\t" \ + "P0=%1;\n\t" \ + "excpt 0;\n\t" \ + "%0=r0;\n\t" \ + : "=da" (__res) \ + : "i" (__NR_##name), \ + "rm" ((long)(arg1)), \ + "rm" ((long)(arg2)), \ + "rm" ((long)(arg3)), \ + "rm" ((long)(arg4)), \ + "rm" ((long)(arg5)), \ + "rm" ((long)(arg6)) \ + : "memory","CC","R0","R1","R2","R3","R4","R5","P0"); \ + __syscall_return(type,__res); \ } #endif /* __ASSEMBLER__ */ diff --git a/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h b/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h index 1b40e32a2..a9140ee7e 100644 --- a/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h +++ b/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h @@ -10,7 +10,7 @@ #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__ diff --git a/libc/sysdeps/linux/bfin/syscall.c b/libc/sysdeps/linux/bfin/syscall.c index c223f56a3..1db873874 100644 --- a/libc/sysdeps/linux/bfin/syscall.c +++ b/libc/sysdeps/linux/bfin/syscall.c @@ -1,10 +1,22 @@ /* vi: set sw=4 ts=4: */ /* syscall for blackfin/uClibc * - * Copyright (C) 2004 by Analog Devices Inc. - * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * Copyright (C) 2004-2006 by Analog Devices Inc. + * Copyright (C) 2002 by Erik Andersen <andersen@uclibc.org> * - * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + * 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, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <features.h> @@ -12,26 +24,34 @@ #include <sys/types.h> #include <sys/syscall.h> -long syscall(long sysnum, long a, long b, long c, long d, long e) +long syscall(long sysnum, long a, long b, long c, long d, long e, long f) { int _r0 = 0; - asm volatile( - "p0 = %1;" /*SysCall Number*/ - "r0 = %2;" - "r1 = %3;" - "r2 = %4;" - "r3 = %6;" - "r4 = %5;" - "excpt 0;" /*Call the System Call*/ - "%0 = r0;" /*Store the result of syscall*/ - : "=r"(_r0) - : "r"(sysnum), "r"(a), "r"(b), - "r"(c), "r"(d), "r"(e) - : "memory"); - if(_r0 >=(unsigned long) -4095) { - (*__errno_location())=(-_r0); - _r0=(unsigned long) -1; - } - return (long) _r0; + __asm__ __volatile__ ( + "R5 = %7;" + "R4 = %6;" + "R3 = %5;" + "R2 = %4;" + "R1 = %3;" + "R0 = %2;" + "P0 = %1;" + "excpt 0;" + "%0 = R0;" + : "=r" (_r0) + : "rm" (sysnum), + "rm" (a), + "rm" (b), + "rm" (c), + "rm" (d), + "rm" (e), + "rm" (f) + : "memory","CC","R0","R1","R2","R3","R4","R5","P0"); + + if (_r0 >= (unsigned long) -4095) { + (*__errno_location()) = (-_r0); + _r0 = (unsigned long) -1; + } + + return (long)_r0; } diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c index a9042c76b..165ea317e 100644 --- a/libc/sysdeps/linux/common/getcwd.c +++ b/libc/sysdeps/linux/common/getcwd.c @@ -12,9 +12,11 @@ #include <dirent.h> #include <string.h> #include <unistd.h> +#include <sys/param.h> #include <sys/syscall.h> libc_hidden_proto(getcwd) +libc_hidden_proto(getpagesize) libc_hidden_proto(strcat) libc_hidden_proto(strcpy) @@ -182,7 +184,7 @@ char *getcwd(char *buf, size_t size) __set_errno(EINVAL); return NULL; } - alloc_size = PATH_MAX; + alloc_size = MAX (PATH_MAX, getpagesize ()); } path=buf; if (buf == NULL) { diff --git a/libc/sysdeps/linux/common/mremap.c b/libc/sysdeps/linux/common/mremap.c index 080d2c1c2..5499c0975 100644 --- a/libc/sysdeps/linux/common/mremap.c +++ b/libc/sysdeps/linux/common/mremap.c @@ -9,10 +9,13 @@ #include "syscalls.h" #include <unistd.h> +#define mremap _hidemremap #include <sys/mman.h> +#undef mremap -libc_hidden_proto(mremap) +void *mremap(void *, size_t, size_t, int, void *); -_syscall4(__ptr_t, mremap, __ptr_t, old_address, size_t, old_size, size_t, - new_size, int, may_move); +libc_hidden_proto(mremap) +_syscall5(void *, mremap, void *, old_address, size_t, old_size, size_t, + new_size, int, may_move, void *, new_address); libc_hidden_def(mremap) diff --git a/libc/sysdeps/linux/m68k/clone.S b/libc/sysdeps/linux/m68k/clone.S index 2735bcba0..8ef916e91 100644 --- a/libc/sysdeps/linux/m68k/clone.S +++ b/libc/sysdeps/linux/m68k/clone.S @@ -21,11 +21,11 @@ clone: movel 4(%sp), %d1 /* no NULL function pointers */ movel %d1, %a0 tstl %d1 - beq.w __syscall_error + jbeq __syscall_error movel 8(%sp), %d1 /* no NULL stack pointers */ movel %d1, %a1 tstl %d1 - beq.w __syscall_error + jbeq __syscall_error /* Allocate space and copy the argument onto the new stack. */ movel 16(%sp), -(%a1) @@ -50,7 +50,7 @@ clone: #endif tstl %d0 - bmi.w __syscall_error + jbmi __syscall_error beq.w thread_start rts diff --git a/libc/sysdeps/linux/m68k/crt1.S b/libc/sysdeps/linux/m68k/crt1.S index ee25e48eb..9ce14e594 100644 --- a/libc/sysdeps/linux/m68k/crt1.S +++ b/libc/sysdeps/linux/m68k/crt1.S @@ -51,6 +51,13 @@ (4*(argc+1))(%sp) envp[0] ... NULL + + The uclinux conventions are different. %a1 is not defined on entry + and the stack is laid out as follows: + + 0(%sp) argc + 4(%sp) argv + 8(%sp) envp */ #include <features.h> @@ -73,15 +80,23 @@ _start: arguments for `main': argc, argv. envp will be determined later in __libc_start_main. */ move.l (%sp)+, %d0 /* Pop the argument count. */ +#ifndef __ARCH_USE_MMU__ + move.l (%sp)+, %a0 +#else move.l %sp, %a0 /* The argument vector starts just at the current stack top. */ +#endif /* Provide the highest stack address to the user code (for stacks which grow downward). */ pea (%sp) +#ifndef __ARCH_USE_MMU__ + clr.l -(%sp) +#else pea (%a1) /* Push address of the shared library termination function. */ +#endif /* Push the address of our own entry points to `.fini' and `.init'. */ |