summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/microblaze
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/microblaze')
-rw-r--r--libc/sysdeps/linux/microblaze/Makefile82
-rw-r--r--libc/sysdeps/linux/microblaze/Makefile.arch14
-rw-r--r--libc/sysdeps/linux/microblaze/__longjmp.S36
-rw-r--r--libc/sysdeps/linux/microblaze/bits/fcntl.h17
-rw-r--r--libc/sysdeps/linux/microblaze/bits/kernel_stat.h74
-rw-r--r--libc/sysdeps/linux/microblaze/bits/kernel_types.h29
-rw-r--r--libc/sysdeps/linux/microblaze/bits/poll.h8
-rw-r--r--libc/sysdeps/linux/microblaze/bits/setjmp.h10
-rw-r--r--libc/sysdeps/linux/microblaze/bits/stackinfo.h28
-rw-r--r--libc/sysdeps/linux/microblaze/bits/syscalls.h54
-rw-r--r--libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h4
-rw-r--r--libc/sysdeps/linux/microblaze/bits/uClibc_page.h41
-rw-r--r--libc/sysdeps/linux/microblaze/clinkage.h15
-rw-r--r--libc/sysdeps/linux/microblaze/clone.c71
-rw-r--r--libc/sysdeps/linux/microblaze/crt1.S61
-rw-r--r--libc/sysdeps/linux/microblaze/crti.S41
-rw-r--r--libc/sysdeps/linux/microblaze/crtn.S45
-rw-r--r--libc/sysdeps/linux/microblaze/fixdfsi.c85
-rw-r--r--libc/sysdeps/linux/microblaze/floatlib.h140
-rw-r--r--libc/sysdeps/linux/microblaze/setjmp.S43
-rw-r--r--libc/sysdeps/linux/microblaze/sys/procfs.h145
-rw-r--r--libc/sysdeps/linux/microblaze/sys/ptrace.h8
-rw-r--r--libc/sysdeps/linux/microblaze/syscall.c51
-rw-r--r--libc/sysdeps/linux/microblaze/vfork.S30
24 files changed, 841 insertions, 291 deletions
diff --git a/libc/sysdeps/linux/microblaze/Makefile b/libc/sysdeps/linux/microblaze/Makefile
index a7a832b24..338abc086 100644
--- a/libc/sysdeps/linux/microblaze/Makefile
+++ b/libc/sysdeps/linux/microblaze/Makefile
@@ -1,67 +1,25 @@
# 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, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-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..ecbd80141
--- /dev/null
+++ b/libc/sysdeps/linux/microblaze/Makefile.arch
@@ -0,0 +1,14 @@
+# 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 := mmap.c clone.c fixdfsi.c
+
+SSRC := setjmp.S __longjmp.S vfork.S
+
+ARCH_HEADERS := floatlib.h
+
+include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch
diff --git a/libc/sysdeps/linux/microblaze/__longjmp.S b/libc/sysdeps/linux/microblaze/__longjmp.S
index 2752f0bd3..c4423bec5 100644
--- a/libc/sysdeps/linux/microblaze/__longjmp.S
+++ b/libc/sysdeps/linux/microblaze/__longjmp.S
@@ -16,30 +16,34 @@
#define _ASM
#include <bits/setjmp.h>
-#include <clinkage.h>
+#include <libc-symbols.h>
.text
-C_ENTRY(__longjmp):
+ .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
+ 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/fcntl.h b/libc/sysdeps/linux/microblaze/bits/fcntl.h
index bb6727ad8..44e8f3f5b 100644
--- a/libc/sysdeps/linux/microblaze/bits/fcntl.h
+++ b/libc/sysdeps/linux/microblaze/bits/fcntl.h
@@ -23,6 +23,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,11 +45,11 @@
#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_NOATIME 01000000 /* Do not set atime. */
-# define O_CLOEXEC 02000000 /* set close_on_exec */
+# 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 */
#endif
/* For now Linux has synchronisity options for data and read operations.
@@ -58,7 +61,7 @@
#endif
#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE 0400000
+# define O_LARGEFILE 0100000
#endif
/* Values for the second argument to `fcntl'. */
@@ -96,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 of pipe page size array */
+# define F_GETPIPE_SZ 1032 /* Get of pipe page size array */
#endif
/* For F_[GET|SET]FL. */
diff --git a/libc/sysdeps/linux/microblaze/bits/kernel_stat.h b/libc/sysdeps/linux/microblaze/bits/kernel_stat.h
index de35488bd..2c5eb28af 100644
--- a/libc/sysdeps/linux/microblaze/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/microblaze/bits/kernel_stat.h
@@ -9,50 +9,44 @@
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;
- struct timespec st_atim;
- struct timespec st_mtim;
- struct timespec st_ctim;
- 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. */
-
- struct timespec st_atim;
- struct timespec st_mtim;
- struct timespec st_ctim;
+ 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..2a7057502 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,13 @@ 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;
+
+#ifdef __GNUC__
+typedef long long __kernel_loff_t;
+#endif
typedef struct {
#ifdef __USE_ALL
@@ -52,4 +57,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/poll.h b/libc/sysdeps/linux/microblaze/bits/poll.h
index f7a739315..78ee877c0 100644
--- a/libc/sysdeps/linux/microblaze/bits/poll.h
+++ b/libc/sysdeps/linux/microblaze/bits/poll.h
@@ -29,10 +29,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/setjmp.h b/libc/sysdeps/linux/microblaze/bits/setjmp.h
index d966efd2b..0c0573cd7 100644
--- a/libc/sysdeps/linux/microblaze/bits/setjmp.h
+++ b/libc/sysdeps/linux/microblaze/bits/setjmp.h
@@ -28,12 +28,16 @@ typedef struct
/* Link pointer. */
void *__lp;
- /* Callee-saved registers r18-r30. */
- int __regs[13];
+ /* SDA pointers */
+ void *__SDA;
+ void *__SDA2;
+
+ /* Callee-saved registers r18-r31. */
+ int __regs[14];
} __jmp_buf[1];
#endif
-#define JB_SIZE (4 * 15)
+#define JB_SIZE (4 * 18)
/* Test if longjmp to JMPBUF would unwind the frame
containing a local variable at ADDRESS. */
diff --git a/libc/sysdeps/linux/microblaze/bits/stackinfo.h b/libc/sysdeps/linux/microblaze/bits/stackinfo.h
new file mode 100644
index 000000000..819e81974
--- /dev/null
+++ b/libc/sysdeps/linux/microblaze/bits/stackinfo.h
@@ -0,0 +1,28 @@
+/* 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* 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..f4bdc4522 100644
--- a/libc/sysdeps/linux/microblaze/bits/syscalls.h
+++ b/libc/sysdeps/linux/microblaze/bits/syscalls.h
@@ -4,12 +4,54 @@
# 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...) \
+ ({ \
+ 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 2a9422e23..86d00084c 100644
--- a/libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h
+++ b/libc/sysdeps/linux/microblaze/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__
@@ -22,7 +22,7 @@
#undef __UCLIBC_HANDLE_OLDER_RLIMIT__
/* does your target have an asm .set ? */
-#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
+#undef __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
/* define if target doesn't like .global */
#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__
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..8fc81ae32
--- /dev/null
+++ b/libc/sysdeps/linux/microblaze/bits/uClibc_page.h
@@ -0,0 +1,41 @@
+/* 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, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* Supply an architecture specific value for PAGE_SIZE and friends. */
+
+#ifndef _UCLIBC_PAGE_H
+#define _UCLIBC_PAGE_H
+
+#include <linux/autoconf.h>
+
+#if defined(CONFIG_MICROBLAZE_32K_PAGES)
+#define PAGE_SHIFT 15
+#elif defined(CONFIG_MICROBLAZE_16K_PAGES)
+#define PAGE_SHIFT 14
+#elif defined(CONFIG_MICROBLAZE_8K_PAGES)
+#define PAGE_SHIFT 13
+#elif defined(CONFIG_MICROBLAZE_4K_PAGES)
+#define PAGE_SHIFT 12
+#else
+#warning Missing CONFIG_MICROBLAZE_nnK_PAGES, assuming 4K
+#define PAGE_SHIFT 12
+#endif
+
+#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#define PAGE_MASK (~(PAGE_SIZE-1))
+
+#endif /* _UCLIBC_PAGE_H */
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/crt1.S b/libc/sysdeps/linux/microblaze/crt1.S
new file mode 100644
index 000000000..e9564cfba
--- /dev/null
+++ b/libc/sysdeps/linux/microblaze/crt1.S
@@ -0,0 +1,61 @@
+/*
+ * 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):
+
+ /* Load SDAs */
+ la r2, r0, C_SYMBOL_NAME(_SDA2_BASE_) /* in the original source r2 was SDA, and r13 was SDA2, no idea why */
+ la r13, r0, C_SYMBOL_NAME(_SDA_BASE_)
+
+ /*
+ 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..da8c920ef
--- /dev/null
+++ b/libc/sysdeps/linux/microblaze/crtn.S
@@ -0,0 +1,45 @@
+/*
+ * 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:
+ .size _init,$Lfe2-_init
+
+ .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:
+ .size _fini,$Lfe3-_fini
+
+/*@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/setjmp.S b/libc/sysdeps/linux/microblaze/setjmp.S
index 7068d4b40..7acb9ea5d 100644
--- a/libc/sysdeps/linux/microblaze/setjmp.S
+++ b/libc/sysdeps/linux/microblaze/setjmp.S
@@ -8,7 +8,7 @@
* 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>
*/
@@ -16,38 +16,41 @@
#define _ASM
#include <bits/setjmp.h>
-#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):
braid C_SYMBOL_NAME(__sigsetjmp)
- nop
+ 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):
/* 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. */
braid C_SYMBOL_NAME(__sigjmp_save)
nop
-C_END(setjmp)
diff --git a/libc/sysdeps/linux/microblaze/sys/procfs.h b/libc/sysdeps/linux/microblaze/sys/procfs.h
new file mode 100644
index 000000000..8fb87ef1e
--- /dev/null
+++ b/libc/sysdeps/linux/microblaze/sys/procfs.h
@@ -0,0 +1,145 @@
+/* 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#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..26d153ce1 100644
--- a/libc/sysdeps/linux/microblaze/sys/ptrace.h
+++ b/libc/sysdeps/linux/microblaze/sys/ptrace.h
@@ -65,12 +65,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/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 42458308a..c4b4dbf2f 100644
--- a/libc/sysdeps/linux/microblaze/vfork.S
+++ b/libc/sysdeps/linux/microblaze/vfork.S
@@ -1,14 +1,14 @@
/*
* 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
*/
@@ -18,7 +18,7 @@
#define _SYSCALL_H
#include <bits/sysnum.h>
-#include <clinkage.h>
+#include <libc-symbols.h>
/* Clone the calling process, but without copying the whole address space.
The calling process is suspended until the new process exits or is
@@ -27,18 +27,20 @@
.global C_SYMBOL_NAME(errno)
-C_ENTRY (__vfork):
+ .globl __vfork
+ .align 4
+__vfork:
addi r12, r0, SYS_vfork
- bralid r17, 0x08;
- nop
+ brki r14, 0x08;
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 */
+ bri 2f /* normal return */
+1: sub r3, r3, r0 /* r3 = -r3 */
swi r3, r0, C_SYMBOL_NAME(errno);
- rtsd r15, 8 /* error return */
+ /* state restore etc */
+2: rtsd r15, 8 /* error return */
nop
-C_END(__vfork)
+ .size __vfork, .-__vfork
+
weak_alias(__vfork,vfork)
libc_hidden_weak(vfork)