summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/m68k
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/m68k')
-rw-r--r--libc/sysdeps/linux/m68k/Makefile.arch6
-rw-r--r--libc/sysdeps/linux/m68k/__longjmp.S6
-rw-r--r--libc/sysdeps/linux/m68k/__syscall_error.c19
-rw-r--r--libc/sysdeps/linux/m68k/bits/fcntl.h14
-rw-r--r--libc/sysdeps/linux/m68k/bits/mman.h36
-rw-r--r--libc/sysdeps/linux/m68k/bits/setjmp.h16
-rw-r--r--libc/sysdeps/linux/m68k/bits/stat.h17
-rw-r--r--libc/sysdeps/linux/m68k/bits/syscalls.h11
-rw-r--r--libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h48
-rw-r--r--libc/sysdeps/linux/m68k/brk.c14
-rw-r--r--libc/sysdeps/linux/m68k/clone.S24
-rw-r--r--libc/sysdeps/linux/m68k/crt0.S72
-rw-r--r--libc/sysdeps/linux/m68k/crt0.c43
-rw-r--r--libc/sysdeps/linux/m68k/crt1.S108
-rw-r--r--libc/sysdeps/linux/m68k/ptrace.c34
-rw-r--r--libc/sysdeps/linux/m68k/syscall.c46
-rw-r--r--libc/sysdeps/linux/m68k/vfork.S11
17 files changed, 318 insertions, 207 deletions
diff --git a/libc/sysdeps/linux/m68k/Makefile.arch b/libc/sysdeps/linux/m68k/Makefile.arch
index 2ebd602d7..14ce2e30a 100644
--- a/libc/sysdeps/linux/m68k/Makefile.arch
+++ b/libc/sysdeps/linux/m68k/Makefile.arch
@@ -5,12 +5,8 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC := ptrace.c brk.c
+CSRC := brk.c __syscall_error.c syscall.c
SSRC := __longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S vfork.S
-ifneq ($(HAVE_ELF),y)
-ARCH_HEADERS := float.h
-endif
-
include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch
diff --git a/libc/sysdeps/linux/m68k/__longjmp.S b/libc/sysdeps/linux/m68k/__longjmp.S
index d218f2ef5..5db9e4362 100644
--- a/libc/sysdeps/linux/m68k/__longjmp.S
+++ b/libc/sysdeps/linux/m68k/__longjmp.S
@@ -4,11 +4,12 @@
#define _ASM
#define _SETJMP_H
+#include <features.h>
#include <bits/setjmp.h>
-.globl __longjmp;
+.globl __longjmp
.type __longjmp,@function
-.align 4; \
+.align 4
__longjmp:
moveal %sp@(4), %a0
movel %sp@(8), %d0
@@ -22,3 +23,4 @@ __longjmp:
movel %a0@(JB_PC), %sp@
rts
+libc_hidden_def(__longjmp)
diff --git a/libc/sysdeps/linux/m68k/__syscall_error.c b/libc/sysdeps/linux/m68k/__syscall_error.c
new file mode 100644
index 000000000..5cfdead8b
--- /dev/null
+++ b/libc/sysdeps/linux/m68k/__syscall_error.c
@@ -0,0 +1,19 @@
+/* Wrapper for setting errno.
+ *
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <errno.h>
+#include <features.h>
+
+/* This routine is jumped to by all the syscall handlers, to stash
+ * an error number into errno. */
+int __syscall_error(void) attribute_hidden;
+int __syscall_error(void)
+{
+ register int err_no asm("%d0");
+ __set_errno(-err_no);
+ return -1;
+}
diff --git a/libc/sysdeps/linux/m68k/bits/fcntl.h b/libc/sysdeps/linux/m68k/bits/fcntl.h
index 4b41b4715..90c0a481e 100644
--- a/libc/sysdeps/linux/m68k/bits/fcntl.h
+++ b/libc/sysdeps/linux/m68k/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 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
@@ -45,7 +45,7 @@
# 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_NOATIME 01000000 /* Do not set atime. */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -79,7 +79,7 @@
#define F_SETLK64 13 /* Set record locking info (non-blocking). */
#define F_SETLKW64 14 /* Set record locking info (blocking). */
-#if defined __USE_BSD || defined __USE_XOPEN2K
+#if defined __USE_BSD || defined __USE_UNIX98
# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
#endif
@@ -178,3 +178,11 @@ struct flock64
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
#endif
+
+__BEGIN_DECLS
+
+/* Provide kernel hint to read ahead. */
+extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
+ __THROW;
+
+__END_DECLS
diff --git a/libc/sysdeps/linux/m68k/bits/mman.h b/libc/sysdeps/linux/m68k/bits/mman.h
index 7f644b99b..6e7bdc99d 100644
--- a/libc/sysdeps/linux/m68k/bits/mman.h
+++ b/libc/sysdeps/linux/m68k/bits/mman.h
@@ -1,5 +1,5 @@
/* Definitions for POSIX memory map interface. Linux/m68k version.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2000, 2003, 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
@@ -34,6 +34,10 @@
#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. */
+#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
+ growsdown vma (mprotect only). */
+#define PROT_GROWSUP 0x02000000 /* Extend change to start of
+ growsup vma (mprotect only). */
/* Sharing types (must choose one and only one of these). */
#define MAP_SHARED 0x01 /* Share changes. */
@@ -52,11 +56,13 @@
/* 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. */
+# define MAP_GROWSDOWN 0x00100 /* Stack-like segment. */
+# define MAP_DENYWRITE 0x00800 /* ETXTBSY */
+# define MAP_EXECUTABLE 0x01000 /* Mark it as an executable. */
+# define MAP_LOCKED 0x02000 /* Lock the mapping. */
+# define MAP_NORESERVE 0x04000 /* Don't check for reservations. */
+# define MAP_POPULATE 0x08000 /* Populate (prefault) pagetables. */
+# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */
#endif
/* Flags to `msync'. */
@@ -74,3 +80,21 @@
# define MREMAP_MAYMOVE 1
# define MREMAP_FIXED 2
#endif
+
+/* 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
diff --git a/libc/sysdeps/linux/m68k/bits/setjmp.h b/libc/sysdeps/linux/m68k/bits/setjmp.h
index efad14c13..a6b0ed0f1 100644
--- a/libc/sysdeps/linux/m68k/bits/setjmp.h
+++ b/libc/sysdeps/linux/m68k/bits/setjmp.h
@@ -1,5 +1,5 @@
/* Copyright (C) 2002, David McCullough <davidm@snapgear.com> */
-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,2005,2006 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
@@ -25,13 +25,17 @@
# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
#endif
-#ifndef _ASM
+#ifndef _ASM
typedef struct
{
- unsigned long __dregs[6]; /* save d2 - d7 */
- unsigned long __aregs[6]; /* save a2 - a7 */
- unsigned long __pc; /* the return address */
+ /* There are eight 4-byte data registers, but D0 is not saved. */
+ long int __dregs[7];
+
+ /* There are six 4-byte address registers, plus the FP and SP. */
+ int *__aregs[6];
+ int *__fp;
+ int *__sp;
#if defined __HAVE_68881__ || defined __HAVE_FPU__
/* There are eight floating point registers which
@@ -41,7 +45,7 @@ typedef struct
} __jmp_buf[1];
-#endif /* _ASM */
+#endif
#define JB_REGS 0
#define JB_DREGS 0
diff --git a/libc/sysdeps/linux/m68k/bits/stat.h b/libc/sysdeps/linux/m68k/bits/stat.h
index 213dbe267..a435240cd 100644
--- a/libc/sysdeps/linux/m68k/bits/stat.h
+++ b/libc/sysdeps/linux/m68k/bits/stat.h
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1992,95,96,97,98,99,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
@@ -61,11 +62,11 @@ struct stat
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
#endif
__time_t st_atime; /* Time of last access. */
- unsigned long int __unused1;
+ unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
- unsigned long int __unused2;
+ unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
- unsigned long int __unused3;
+ unsigned long int st_ctimensec; /* Nsecs of last status change. */
#ifndef __USE_FILE_OFFSET64
unsigned long int __unused4;
unsigned long int __unused5;
@@ -92,11 +93,11 @@ struct stat64
__blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
__time_t st_atime; /* Time of last access. */
- unsigned long int __unused1;
+ unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
- unsigned long int __unused2;
+ unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
- unsigned long int __unused3;
+ unsigned long int st_ctimensec; /* Nsecs of last status change. */
__ino64_t st_ino; /* File serial number. */
};
#endif
@@ -104,6 +105,8 @@ struct stat64
/* Tell code we have these members. */
#define _STATBUF_ST_BLKSIZE
#define _STATBUF_ST_RDEV
+/* Nanosecond resolution time values are supported. */
+#define _STATBUF_ST_NSEC
/* Encoding of the file mode. */
diff --git a/libc/sysdeps/linux/m68k/bits/syscalls.h b/libc/sysdeps/linux/m68k/bits/syscalls.h
index 05bc7b675..284112e31 100644
--- a/libc/sysdeps/linux/m68k/bits/syscalls.h
+++ b/libc/sysdeps/linux/m68k/bits/syscalls.h
@@ -4,14 +4,19 @@
# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
#endif
+#include <errno.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>
-#ifndef __set_errno
-# define __set_errno(val) (*__errno_location ()) = (val)
-#endif
+/* m68k headers does stupid stuff with __NR_iopl / __NR_vm86:
+ * #define __NR_iopl not supported
+ * #define __NR_vm86 not supported
+ */
+#undef __NR_iopl
+#undef __NR_vm86
#ifndef __ASSEMBLER__
diff --git a/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h b/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h
new file mode 100644
index 000000000..a94803749
--- /dev/null
+++ b/libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h
@@ -0,0 +1,48 @@
+/*
+ * Track misc arch-specific features that aren't config options
+ */
+
+#ifndef _BITS_UCLIBC_ARCH_FEATURES_H
+#define _BITS_UCLIBC_ARCH_FEATURES_H
+
+/* instruction used when calling abort() to kill yourself */
+#if defined(__mc68000__)
+# define __UCLIBC_ABORT_INSTRUCTION__ ".long 0xffffffff"
+#else /* defined(__m68k__) */
+# define __UCLIBC_ABORT_INSTRUCTION__ "illegal"
+#endif
+
+/* can your target use syscall6() for mmap ? */
+#undef __UCLIBC_MMAP_HAS_6_ARGS__
+
+/* does your target use syscall4() for truncate64 ? (32bit arches only) */
+#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__
+
+/* does your target have a broken create_module() ? */
+#define __UCLIBC_BROKEN_CREATE_MODULE__
+
+/* does your target have to worry about older [gs]etrlimit() ? */
+#define __UCLIBC_HANDLE_OLDER_RLIMIT__
+
+/* does your target prefix all symbols with an _ ? */
+#define __UCLIBC_NO_UNDERSCORES__
+
+/* does your target have an asm .set ? */
+#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
+
+/* define if target doesn't like .global */
+#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__
+
+/* define if target supports .weak */
+#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__
+
+/* 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 IEEE signed zero floats */
+#define __UCLIBC_HAVE_SIGNED_ZERO__
+
+#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */
diff --git a/libc/sysdeps/linux/m68k/brk.c b/libc/sysdeps/linux/m68k/brk.c
index 4c33549cc..b627f6400 100644
--- a/libc/sysdeps/linux/m68k/brk.c
+++ b/libc/sysdeps/linux/m68k/brk.c
@@ -1,13 +1,23 @@
/* consider this code LGPL - davidm */
+/*
+ * 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 <sys/syscall.h>
#include <errno.h>
+libc_hidden_proto(brk)
+
/* This must be initialized data because commons can't have aliases. */
+extern void *__curbrk;
+libc_hidden_proto(__curbrk)
void * __curbrk = 0;
+libc_hidden_data_def(__curbrk)
-int attribute_hidden __brk (void *addr)
+int brk (void *addr)
{
void *newbrk;
@@ -28,4 +38,4 @@ int attribute_hidden __brk (void *addr)
return 0;
}
-strong_alias(__brk,brk)
+libc_hidden_def(brk)
diff --git a/libc/sysdeps/linux/m68k/clone.S b/libc/sysdeps/linux/m68k/clone.S
index 916488146..2735bcba0 100644
--- a/libc/sysdeps/linux/m68k/clone.S
+++ b/libc/sysdeps/linux/m68k/clone.S
@@ -13,9 +13,9 @@
.text
.align 4
-.type __clone,@function
-.globl __clone;
-__clone:
+.type clone,@function
+.globl clone;
+clone:
/* Sanity check arguments. */
movel #-EINVAL, %d0
movel 4(%sp), %d1 /* no NULL function pointers */
@@ -55,17 +55,6 @@ __clone:
rts
-__syscall_error:
- negl %d0
- movel %d0, %sp@-
- lea __errno_location-.-8, %a0
- jsr %pc@(%a0)
- movel %d0, %a0
- movel %sp@+, %a0@
- moveq #-1, %d0
-
- rts
-
thread_start:
/*subl %fp, %fp*/ /* terminate the stack frame */
jsr (%a0)
@@ -73,10 +62,3 @@ thread_start:
movel #__NR_exit, %d0
trap #0
/*jsr exit*/
-
-#if defined(__HAVE_ELF__)
- .weak clone
- clone = __clone
-#else
- .set clone,__clone
-#endif
diff --git a/libc/sysdeps/linux/m68k/crt0.S b/libc/sysdeps/linux/m68k/crt0.S
deleted file mode 100644
index 44aca7fd1..000000000
--- a/libc/sysdeps/linux/m68k/crt0.S
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Copyright (C) 1991, 1992 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. */
-
-/*
- * NOTE: this file works for PIC and non-PIC code. Be very careful how
- * you modify it !
- */
-
-#include <features.h>
-
- .global _start
- .global __exit
- .global atexit
- .global main
-
- .text
-
- nop
- nop
-_start: /* put here so that references to _start work with elf-PIC */
-
- movea.l %d5, %a5 /* uClinux passes in data segment here */
-/*
- * argc, argv and envp are on the stack, just call to main
- */
- lea __uClibc_main-.-8, %a0 /* call uClibc main */
- jsr %pc@(%a0)
-
- /* If that didn't kill us, ... */
-__exit:
- move.l %sp@+,%d1
- moveq #1,%d0 /* __NR_exit */
- trap #0
-
-/*
- * this was needed for gcc/g++-builds, atexit was not getting included
- * for some stupid reason, this gets us a compiler
- */
-empty_func:
- rts
-#if defined(__HAVE_ELF__)
- .weak atexit
- atexit = empty_func
-#else
- .set atexit,empty_func
-#endif
-
-
-/* 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/m68k/crt0.c b/libc/sysdeps/linux/m68k/crt0.c
deleted file mode 100644
index 74601ec75..000000000
--- a/libc/sysdeps/linux/m68k/crt0.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/* uClibc/sysdeps/linux/m68k/crt0.S
- * Pull stuff off the stack and get uClibc moving.
- *
- * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
- *
- * 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
- */
-
-/* Stick in a dummy reference to main(), so that if an application
- * is linking when the main() function is in a static library (.a)
- * we can be sure that main() actually gets linked in */
-extern void main(int argc,void *argv,void *envp);
-void (*mainp)(int argc,void *argv,void *envp) = main;
-
-extern void __uClibc_main(int argc,void *argv,void *envp);
-
-void _start(unsigned int first_arg)
-{
- unsigned int argc;
- char **argv, **envp;
- unsigned long *stack;
-
- stack = (unsigned long*) &first_arg;
- argc = *(stack - 1);
- argv = (char **) stack;
- envp = (char **)stack + argc + 1;
-
- __uClibc_main(argc, argv, envp);
-}
-
diff --git a/libc/sysdeps/linux/m68k/crt1.S b/libc/sysdeps/linux/m68k/crt1.S
new file mode 100644
index 000000000..ee25e48eb
--- /dev/null
+++ b/libc/sysdeps/linux/m68k/crt1.S
@@ -0,0 +1,108 @@
+/* Startup code compliant to the ELF m68k ABI.
+ Copyright (C) 1996, 1997, 1998, 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.
+
+ In addition to the permissions in the GNU Lesser General Public
+ License, the Free Software Foundation gives you unlimited
+ permission to link the compiled version of this file with other
+ programs, and to distribute those programs without any restriction
+ coming from the use of this file. (The GNU Lesser General Public
+ License restrictions do apply in other respects; for example, they
+ cover modification of the file, and distribution when not linked
+ into another program.)
+
+ Note that people who make modified versions of this file are not
+ obligated to grant this special exception for their modified
+ versions; it is their choice whether to do so. The GNU Lesser
+ General Public License gives permission to release a modified
+ version without this exception; this exception also makes it
+ possible to release a modified version which carries forward this
+ exception.
+
+ 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. */
+
+/* This is the canonical entry point, usually the first thing in the text
+ segment. The SVR4/m68k ABI says that when the entry point runs,
+ most registers' values are unspecified, except for:
+
+ %a1 Contains a function pointer to be registered with `atexit'.
+ This is how the dynamic linker arranges to have DT_FINI
+ functions called for shared libraries that have been loaded
+ before this code runs.
+
+ %sp The stack contains the arguments and environment:
+ 0(%sp) argc
+ 4(%sp) argv[0]
+ ...
+ (4*argc)(%sp) NULL
+ (4*(argc+1))(%sp) envp[0]
+ ...
+ NULL
+*/
+
+#include <features.h>
+
+ .text
+ .type _init,%function
+ .type _fini,%function
+#ifndef __UCLIBC_CTOR_DTOR__
+ .weak _init
+ .weak _fini
+#endif
+ .globl _start
+ .type _start,@function
+_start:
+ /* Clear the frame pointer. The ABI suggests this be done, to mark
+ the outermost frame obviously. */
+ sub.l %fp, %fp
+
+ /* Extract the arguments as encoded on the stack and set up the
+ arguments for `main': argc, argv. envp will be determined
+ later in __libc_start_main. */
+ move.l (%sp)+, %d0 /* Pop the argument count. */
+ move.l %sp, %a0 /* The argument vector starts just at the
+ current stack top. */
+
+ /* Provide the highest stack address to the user code (for stacks
+ which grow downward). */
+ pea (%sp)
+
+ pea (%a1) /* Push address of the shared library
+ termination function. */
+
+ /* Push the address of our own entry points to `.fini' and
+ `.init'. */
+ pea _fini
+ pea _init
+
+ pea (%a0) /* Push second argument: argv. */
+ move.l %d0, -(%sp) /* Push first argument: argc. */
+
+ pea main
+
+ /* Call the user's main function, and exit with its value. But
+ let the libc call main. */
+ jbsr __uClibc_main
+
+ illegal /* Crash if somehow `exit' does return. */
+
+/* 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/m68k/ptrace.c b/libc/sysdeps/linux/m68k/ptrace.c
deleted file mode 100644
index e595a6ecd..000000000
--- a/libc/sysdeps/linux/m68k/ptrace.c
+++ /dev/null
@@ -1,34 +0,0 @@
-
-#include <errno.h>
-#include <asm/ptrace.h>
-#include <sys/syscall.h>
-
-int
-ptrace(int request, int pid, int addr, int data)
-{
- long ret;
- long res;
- if (request > 0 && request < 4) data = (int)&ret;
-
-
- __asm__ volatile ("movel %1,%/d0\n\t"
- "movel %2,%/d1\n\t"
- "movel %3,%/d2\n\t"
- "movel %4,%/d3\n\t"
- "movel %5,%/d4\n\t"
- "trap #0\n\t"
- "movel %/d0,%0"
- :"=g" (res)
- :"i" (__NR_ptrace), "g" (request), "g" (pid),
- "g" (addr), "g" (data) : "%d0", "%d1", "%d2", "%d3", "%d4");
-
- if (res >= 0) {
- if (request > 0 && request < 4) {
- __set_errno(0);
- return (ret);
- }
- return (int) res;
- }
- __set_errno(-res);
- return -1;
-}
diff --git a/libc/sysdeps/linux/m68k/syscall.c b/libc/sysdeps/linux/m68k/syscall.c
new file mode 100644
index 000000000..f35702a48
--- /dev/null
+++ b/libc/sysdeps/linux/m68k/syscall.c
@@ -0,0 +1,46 @@
+/* syscall for m68k/uClibc
+ *
+ * Copyright (C) 2005-2006 by Christian Magnusson <mag@mag.cx>
+ * Copyright (C) 2005-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * 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>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
+
+long syscall(long sysnum, long a, long b, long c, long d, long e, long f);
+long syscall(long sysnum, long a, long b, long c, long d, long e, long f)
+{
+ long __res;
+ __asm__ __volatile__ (
+ "movel %7, %%a0\n\t"
+ "movel %6, %%d5\n\t"
+ "movel %5, %%d4\n\t"
+ "movel %4, %%d3\n\t"
+ "movel %3, %%d2\n\t"
+ "movel %2, %%d1\n\t"
+ "movel %1, %%d0\n\t"
+ "trap #0\n\t"
+ "movel %%d0, %0"
+ : "=g" (__res)
+ : "g" (sysnum),
+ "g" ((long)a), "g" ((long)b), "g" ((long)c),
+ "g" ((long)d), "g" ((long)e), "g" ((long)f)
+ : "cc", "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%a0");
+ __syscall_return(long,__res);
+}
diff --git a/libc/sysdeps/linux/m68k/vfork.S b/libc/sysdeps/linux/m68k/vfork.S
index e58b9e949..56d57f73c 100644
--- a/libc/sysdeps/linux/m68k/vfork.S
+++ b/libc/sysdeps/linux/m68k/vfork.S
@@ -1,3 +1,9 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
#include <features.h>
#include <asm/unistd.h>
@@ -12,10 +18,8 @@
.align 2
.globl errno
.globl __vfork
-#ifdef __HAVE_ELF__
.hidden __vfork
.type __vfork,@function
-#endif
__vfork:
movl %sp@+, %a1 /* save the return address for later */
@@ -37,4 +41,5 @@ fix_errno:
jmp %a1@ /* don't return, just jmp directly */
.size __vfork,.-__vfork
-strong_alias(__vfork,vfork)
+weak_alias(__vfork,vfork)
+libc_hidden_weak(vfork)