2009-06-18 17:56:05

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 00/11] microblaze: use generic headers

This series changes the microblaze architecture to just
fall back on generic headers. This is especially important
for those header files that define the user space ABI.

While there has already been a release (2.6.30) with
a different ABI, I hope that changing it now will still
simplify life in the future.
The unistd.h file still defines a lof of the legacy
system calls by setting __ARCH_WANT_SYSCALL_* macros.
These should be removed once the C libraries have been
adapted to work without them. Unfortunately, doing that
will change the ABI one more time in a forward-compatible
way: new C libraries and applications will still work on
older kernels, but old applications may not run on new
kernels after that change.

Michal, please apply for 2.6.31 or pull from
git://git.kernel.org:/pub/scm/linux/kernel/git/arnd/asm-generic.git microblaze

Arnd <><

Arnd Bergmann (8):
ipc: use __ARCH_WANT_IPC_PARSE_VERSION in ipc/util.h
microblaze: remove init_mm
microblaze: fall back on generic header files for the ABI
microblaze: use generic unistd.h syscall list
microblaze: clean up signal handling
microblaze: use generic syscalls.h
microblaze: make syscall_table implementation generic
microblaze: remove sys_ipc

Remis Lima Baima (3):
microblaze: use the generic lib/checksum.c
microblaze: convert all simple headers to use asm-generic
microblaze: use generic system.h

arch/microblaze/Kconfig | 6 +
arch/microblaze/include/asm/atomic.h | 124 +--------
arch/microblaze/include/asm/bitops.h | 28 +--
arch/microblaze/include/asm/bug.h | 14 -
arch/microblaze/include/asm/bugs.h | 18 +-
arch/microblaze/include/asm/checksum.h | 134 ++------
arch/microblaze/include/asm/cmpxchg-local.h | 1 +
arch/microblaze/include/asm/fb.h | 1 +
arch/microblaze/include/asm/hardirq.h | 14 +-
arch/microblaze/include/asm/ioctls.h | 92 +------
arch/microblaze/include/asm/ipcbuf.h | 37 +---
arch/microblaze/include/asm/irq.h | 6 +-
arch/microblaze/include/asm/irqflags.h | 2 +-
arch/microblaze/include/asm/mman.h | 26 +--
arch/microblaze/include/asm/mmu.h | 7 +-
arch/microblaze/include/asm/mmu_context.h | 2 +-
arch/microblaze/include/asm/mmu_context_no.h | 23 --
arch/microblaze/include/asm/module.h | 10 +-
arch/microblaze/include/asm/msgbuf.h | 32 +--
arch/microblaze/include/asm/param.h | 31 +--
arch/microblaze/include/asm/parport.h | 1 +
arch/microblaze/include/asm/pci.h | 2 +-
arch/microblaze/include/asm/posix_types.h | 94 ++-----
arch/microblaze/include/asm/scatterlist.h | 29 +--
arch/microblaze/include/asm/sembuf.h | 35 +--
arch/microblaze/include/asm/serial.h | 15 +-
arch/microblaze/include/asm/shmbuf.h | 43 +---
arch/microblaze/include/asm/shmparam.h | 7 +-
arch/microblaze/include/asm/siginfo.h | 14 -
arch/microblaze/include/asm/signal.h | 166 +----------
arch/microblaze/include/asm/socket.h | 70 +----
arch/microblaze/include/asm/sockios.h | 24 +--
arch/microblaze/include/asm/stat.h | 69 +----
arch/microblaze/include/asm/swab.h | 9 +-
arch/microblaze/include/asm/syscalls.h | 56 +---
arch/microblaze/include/asm/system.h | 121 ++------
arch/microblaze/include/asm/termbits.h | 204 +------------
arch/microblaze/include/asm/termios.h | 89 +------
arch/microblaze/include/asm/timex.h | 6 +-
arch/microblaze/include/asm/types.h | 39 +---
arch/microblaze/include/asm/ucontext.h | 23 +--
arch/microblaze/include/asm/unistd.h | 435 +-------------------------
arch/microblaze/include/asm/vga.h | 2 +-
arch/microblaze/kernel/entry-nommu.S | 35 +--
arch/microblaze/kernel/init_task.c | 2 -
arch/microblaze/kernel/signal.c | 178 +++--------
arch/microblaze/kernel/sys_microblaze.c | 109 +------
arch/microblaze/kernel/syscall_table.S | 371 ----------------------
arch/microblaze/lib/Makefile | 2 +-
arch/microblaze/lib/checksum.c | 172 ----------
ipc/util.h | 2 +-
kernel/Makefile | 1 +
kernel/syscall_table.c | 12 +
53 files changed, 218 insertions(+), 2827 deletions(-)
rewrite arch/microblaze/include/asm/atomic.h (100%)
rewrite arch/microblaze/include/asm/bitops.h (95%)
rewrite arch/microblaze/include/asm/checksum.h (69%)
create mode 100644 arch/microblaze/include/asm/cmpxchg-local.h
create mode 100644 arch/microblaze/include/asm/fb.h
rewrite arch/microblaze/include/asm/ioctls.h (100%)
rewrite arch/microblaze/include/asm/ipcbuf.h (100%)
rewrite arch/microblaze/include/asm/mman.h (96%)
delete mode 100644 arch/microblaze/include/asm/mmu_context_no.h
rewrite arch/microblaze/include/asm/msgbuf.h (100%)
rewrite arch/microblaze/include/asm/param.h (100%)
create mode 100644 arch/microblaze/include/asm/parport.h
rewrite arch/microblaze/include/asm/posix_types.h (96%)
rewrite arch/microblaze/include/asm/scatterlist.h (100%)
rewrite arch/microblaze/include/asm/sembuf.h (100%)
rewrite arch/microblaze/include/asm/shmbuf.h (100%)
rewrite arch/microblaze/include/asm/signal.h (100%)
rewrite arch/microblaze/include/asm/socket.h (100%)
rewrite arch/microblaze/include/asm/sockios.h (100%)
rewrite arch/microblaze/include/asm/stat.h (100%)
rewrite arch/microblaze/include/asm/syscalls.h (95%)
rewrite arch/microblaze/include/asm/system.h (66%)
rewrite arch/microblaze/include/asm/termbits.h (100%)
rewrite arch/microblaze/include/asm/termios.h (100%)
rewrite arch/microblaze/include/asm/types.h (100%)
rewrite arch/microblaze/include/asm/ucontext.h (100%)
rewrite arch/microblaze/include/asm/unistd.h (99%)
delete mode 100644 arch/microblaze/kernel/syscall_table.S
delete mode 100644 arch/microblaze/lib/checksum.c
create mode 100644 kernel/syscall_table.c


2009-06-18 17:56:22

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 03/11] microblaze: fall back on generic header files for the ABI

Almost all of the ABI relevant header files now have generic
versions, so use those now in order to reduce the amount
of architecture specific code.

Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/microblaze/include/asm/ioctls.h | 92 +-------------
arch/microblaze/include/asm/ipcbuf.h | 37 +-----
arch/microblaze/include/asm/mman.h | 26 +----
arch/microblaze/include/asm/msgbuf.h | 32 +-----
arch/microblaze/include/asm/param.h | 31 +-----
arch/microblaze/include/asm/posix_types.h | 94 +++----------
arch/microblaze/include/asm/sembuf.h | 35 +-----
arch/microblaze/include/asm/shmbuf.h | 43 +------
arch/microblaze/include/asm/siginfo.h | 14 --
arch/microblaze/include/asm/socket.h | 70 +----------
arch/microblaze/include/asm/sockios.h | 24 +----
arch/microblaze/include/asm/stat.h | 69 +----------
arch/microblaze/include/asm/swab.h | 9 +-
arch/microblaze/include/asm/termbits.h | 204 +----------------------------
arch/microblaze/include/asm/termios.h | 89 +-------------
arch/microblaze/include/asm/types.h | 39 +------
arch/microblaze/include/asm/ucontext.h | 23 +---
17 files changed, 36 insertions(+), 895 deletions(-)
rewrite arch/microblaze/include/asm/ioctls.h (100%)
rewrite arch/microblaze/include/asm/ipcbuf.h (100%)
rewrite arch/microblaze/include/asm/mman.h (96%)
rewrite arch/microblaze/include/asm/msgbuf.h (100%)
rewrite arch/microblaze/include/asm/param.h (100%)
rewrite arch/microblaze/include/asm/posix_types.h (96%)
rewrite arch/microblaze/include/asm/sembuf.h (100%)
rewrite arch/microblaze/include/asm/shmbuf.h (100%)
rewrite arch/microblaze/include/asm/socket.h (100%)
rewrite arch/microblaze/include/asm/sockios.h (100%)
rewrite arch/microblaze/include/asm/stat.h (100%)
rewrite arch/microblaze/include/asm/termbits.h (100%)
rewrite arch/microblaze/include/asm/termios.h (100%)
rewrite arch/microblaze/include/asm/types.h (100%)
rewrite arch/microblaze/include/asm/ucontext.h (100%)

diff --git a/arch/microblaze/include/asm/ioctls.h b/arch/microblaze/include/asm/ioctls.h
dissimilarity index 100%
index 03582b2..ec34c76 100644
--- a/arch/microblaze/include/asm/ioctls.h
+++ b/arch/microblaze/include/asm/ioctls.h
@@ -1,91 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_IOCTLS_H
-#define _ASM_MICROBLAZE_IOCTLS_H
-
-#include <linux/ioctl.h>
-
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS 0x5401
-#define TCSETS 0x5402
-#define TCSETSW 0x5403
-#define TCSETSF 0x5404
-#define TCGETA 0x5405
-#define TCSETA 0x5406
-#define TCSETAW 0x5407
-#define TCSETAF 0x5408
-#define TCSBRK 0x5409
-#define TCXONC 0x540A
-#define TCFLSH 0x540B
-#define TIOCEXCL 0x540C
-#define TIOCNXCL 0x540D
-#define TIOCSCTTY 0x540E
-#define TIOCGPGRP 0x540F
-#define TIOCSPGRP 0x5410
-#define TIOCOUTQ 0x5411
-#define TIOCSTI 0x5412
-#define TIOCGWINSZ 0x5413
-#define TIOCSWINSZ 0x5414
-#define TIOCMGET 0x5415
-#define TIOCMBIS 0x5416
-#define TIOCMBIC 0x5417
-#define TIOCMSET 0x5418
-#define TIOCGSOFTCAR 0x5419
-#define TIOCSSOFTCAR 0x541A
-#define FIONREAD 0x541B
-#define TIOCINQ FIONREAD
-#define TIOCLINUX 0x541C
-#define TIOCCONS 0x541D
-#define TIOCGSERIAL 0x541E
-#define TIOCSSERIAL 0x541F
-#define TIOCPKT 0x5420
-#define FIONBIO 0x5421
-#define TIOCNOTTY 0x5422
-#define TIOCSETD 0x5423
-#define TIOCGETD 0x5424
-#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
-#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
-#define TIOCSBRK 0x5427 /* BSD compatibility */
-#define TIOCCBRK 0x5428 /* BSD compatibility */
-#define TIOCGSID 0x5429 /* Return the session ID of FD */
-/* Get Pty Number (of pty-mux device) */
-#define TIOCGPTN _IOR('T', 0x30, unsigned int)
-#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
-
-#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
-#define FIOCLEX 0x5451
-#define FIOASYNC 0x5452
-#define TIOCSERCONFIG 0x5453
-#define TIOCSERGWILD 0x5454
-#define TIOCSERSWILD 0x5455
-#define TIOCGLCKTRMIOS 0x5456
-#define TIOCSLCKTRMIOS 0x5457
-#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
-#define TIOCSERGETLSR 0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
-#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
-
-#define FIOQSIZE 0x545E
-
-/* Used for packet mode */
-#define TIOCPKT_DATA 0
-#define TIOCPKT_FLUSHREAD 1
-#define TIOCPKT_FLUSHWRITE 2
-#define TIOCPKT_STOP 4
-#define TIOCPKT_START 8
-#define TIOCPKT_NOSTOP 16
-#define TIOCPKT_DOSTOP 32
-
-#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
-
-#endif /* _ASM_MICROBLAZE_IOCTLS_H */
+#include <asm-generic/ioctls.h>
diff --git a/arch/microblaze/include/asm/ipcbuf.h b/arch/microblaze/include/asm/ipcbuf.h
dissimilarity index 100%
index b056fa4..84c7e51 100644
--- a/arch/microblaze/include/asm/ipcbuf.h
+++ b/arch/microblaze/include/asm/ipcbuf.h
@@ -1,36 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_IPCBUF_H
-#define _ASM_MICROBLAZE_IPCBUF_H
-
-/*
- * The user_ipc_perm structure for microblaze architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 32-bit mode_t and seq
- * - 2 miscellaneous 32-bit values
- */
-
-struct ipc64_perm {
- __kernel_key_t key;
- __kernel_uid32_t uid;
- __kernel_gid32_t gid;
- __kernel_uid32_t cuid;
- __kernel_gid32_t cgid;
- __kernel_mode_t mode;
- unsigned short __pad1;
- unsigned short seq;
- unsigned short __pad2;
- unsigned long __unused1;
- unsigned long __unused2;
-};
-
-#endif /* _ASM_MICROBLAZE_IPCBUF_H */
+#include <asm-generic/ipcbuf.h>
diff --git a/arch/microblaze/include/asm/mman.h b/arch/microblaze/include/asm/mman.h
dissimilarity index 96%
index 4914b13..8eebf89 100644
--- a/arch/microblaze/include/asm/mman.h
+++ b/arch/microblaze/include/asm/mman.h
@@ -1,25 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_MMAN_H
-#define _ASM_MICROBLAZE_MMAN_H
-
-#include <asm-generic/mman.h>
-
-#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 /* pages are locked */
-#define MAP_NORESERVE 0x4000 /* don't check for reservations */
-#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
-#define MAP_NONBLOCK 0x10000 /* do not block on IO */
-
-#define MCL_CURRENT 1 /* lock all current mappings */
-#define MCL_FUTURE 2 /* lock all future mappings */
-
-#endif /* _ASM_MICROBLAZE_MMAN_H */
+#include <asm-generic/mman.h>
diff --git a/arch/microblaze/include/asm/msgbuf.h b/arch/microblaze/include/asm/msgbuf.h
dissimilarity index 100%
index 09dd970..809134c 100644
--- a/arch/microblaze/include/asm/msgbuf.h
+++ b/arch/microblaze/include/asm/msgbuf.h
@@ -1,31 +1 @@
-#ifndef _ASM_MICROBLAZE_MSGBUF_H
-#define _ASM_MICROBLAZE_MSGBUF_H
-
-/*
- * The msqid64_ds structure for microblaze architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
- * - 2 miscellaneous 32-bit values
- */
-
-struct msqid64_ds {
- struct ipc64_perm msg_perm;
- __kernel_time_t msg_stime; /* last msgsnd time */
- unsigned long __unused1;
- __kernel_time_t msg_rtime; /* last msgrcv time */
- unsigned long __unused2;
- __kernel_time_t msg_ctime; /* last change time */
- unsigned long __unused3;
- unsigned long msg_cbytes; /* current number of bytes on queue */
- unsigned long msg_qnum; /* number of messages in queue */
- unsigned long msg_qbytes; /* max number of bytes on queue */
- __kernel_pid_t msg_lspid; /* pid of last msgsnd */
- __kernel_pid_t msg_lrpid; /* last receive pid */
- unsigned long __unused4;
- unsigned long __unused5;
-};
-
-#endif /* _ASM_MICROBLAZE_MSGBUF_H */
+#include <asm-generic/msgbuf.h>
diff --git a/arch/microblaze/include/asm/param.h b/arch/microblaze/include/asm/param.h
dissimilarity index 100%
index 8c538a4..965d454 100644
--- a/arch/microblaze/include/asm/param.h
+++ b/arch/microblaze/include/asm/param.h
@@ -1,30 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_PARAM_H
-#define _ASM_MICROBLAZE_PARAM_H
-
-#ifdef __KERNEL__
-#define HZ CONFIG_HZ /* internal kernel timer frequency */
-#define USER_HZ 100 /* for user interfaces in "ticks" */
-#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */
-#endif /* __KERNEL__ */
-
-#ifndef HZ
-#define HZ 100
-#endif
-
-#define EXEC_PAGESIZE 4096
-
-#ifndef NOGROUP
-#define NOGROUP (-1)
-#endif
-
-#define MAXHOSTNAMELEN 64 /* max length of hostname */
-
-#endif /* _ASM_MICROBLAZE_PARAM_H */
+#include <asm-generic/param.h>
diff --git a/arch/microblaze/include/asm/posix_types.h b/arch/microblaze/include/asm/posix_types.h
dissimilarity index 96%
index 8c758b2..e890d6c 100644
--- a/arch/microblaze/include/asm/posix_types.h
+++ b/arch/microblaze/include/asm/posix_types.h
@@ -1,73 +1,21 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_POSIX_TYPES_H
-#define _ASM_MICROBLAZE_POSIX_TYPES_H
-
-/*
- * This file is generally used by user-level software, so you need to
- * be a little careful about namespace pollution etc. Also, we cannot
- * assume GCC is being used.
- */
-
-typedef unsigned long __kernel_ino_t;
-typedef unsigned short __kernel_mode_t;
-typedef unsigned int __kernel_nlink_t;
-typedef long __kernel_off_t;
-typedef int __kernel_pid_t;
-typedef unsigned int __kernel_ipc_pid_t;
-typedef unsigned int __kernel_uid_t;
-typedef unsigned int __kernel_gid_t;
-typedef unsigned long __kernel_size_t;
-typedef long __kernel_ssize_t;
-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;
-typedef unsigned short __kernel_gid16_t;
-typedef unsigned int __kernel_uid32_t;
-typedef unsigned int __kernel_gid32_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 {
-#if defined(__KERNEL__) || defined(__USE_ALL)
- int val[2];
-#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
- int __val[2];
-#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
-} __kernel_fsid_t;
-
-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
-
-#undef __FD_SET
-#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
-
-#undef __FD_CLR
-#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
-
-#undef __FD_ISSET
-#define __FD_ISSET(d, set) (!!((set)->fds_bits[__FDELT(d)] & __FDMASK(d)))
-
-#undef __FD_ZERO
-#define __FD_ZERO(fdsetp) (memset(fdsetp, 0, sizeof(*(fd_set *)fdsetp)))
-
-#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
-
-#endif /* _ASM_MICROBLAZE_POSIX_TYPES_H */
+#ifndef __ASM_MICRBLAZE_POSIX_TYPES_H
+#define __ASM_MICRBLAZE_POSIX_TYPES_H
+
+/*
+ * Our tool chain uses 'unsigned long' for size_t,
+ * so the kernel should too. If there is a chance
+ * to update the tool chain, that should probably
+ * be done so it does the same as most of the
+ * other architectures.
+ *
+ * Overriding this mostly has the effect of
+ * avoiding compiler warnings.
+ */
+typedef unsigned long __kernel_size_t;
+typedef long __kernel_ssize_t;
+typedef long __kernel_ptrdiff_t;
+#define __kernel_size_t __kernel_size_t
+
+#include <asm-generic/posix_types.h>
+
+#endif /* __ASM_MICRBLAZE_POSIX_TYPES_H */
diff --git a/arch/microblaze/include/asm/sembuf.h b/arch/microblaze/include/asm/sembuf.h
dissimilarity index 100%
index b804ed7..7673b83 100644
--- a/arch/microblaze/include/asm/sembuf.h
+++ b/arch/microblaze/include/asm/sembuf.h
@@ -1,34 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_SEMBUF_H
-#define _ASM_MICROBLAZE_SEMBUF_H
-
-/*
- * The semid64_ds structure for microblaze architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
- * - 2 miscellaneous 32-bit values
- */
-
-struct semid64_ds {
- struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
- __kernel_time_t sem_otime; /* last semop time */
- unsigned long __unused1;
- __kernel_time_t sem_ctime; /* last change time */
- unsigned long __unused2;
- unsigned long sem_nsems; /* no. of semaphores in array */
- unsigned long __unused3;
- unsigned long __unused4;
-};
-
-
-#endif /* _ASM_MICROBLAZE_SEMBUF_H */
+#include <asm-generic/sembuf.h>
diff --git a/arch/microblaze/include/asm/shmbuf.h b/arch/microblaze/include/asm/shmbuf.h
dissimilarity index 100%
index f829c58..83c05fc 100644
--- a/arch/microblaze/include/asm/shmbuf.h
+++ b/arch/microblaze/include/asm/shmbuf.h
@@ -1,42 +1 @@
-#ifndef _ASM_MICROBLAZE_SHMBUF_H
-#define _ASM_MICROBLAZE_SHMBUF_H
-
-/*
- * The shmid64_ds structure for microblaze architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
- * - 2 miscellaneous 32-bit values
- */
-
-struct shmid64_ds {
- struct ipc64_perm shm_perm; /* operation perms */
- size_t shm_segsz; /* size of segment (bytes) */
- __kernel_time_t shm_atime; /* last attach time */
- unsigned long __unused1;
- __kernel_time_t shm_dtime; /* last detach time */
- unsigned long __unused2;
- __kernel_time_t shm_ctime; /* last change time */
- unsigned long __unused3;
- __kernel_pid_t shm_cpid; /* pid of creator */
- __kernel_pid_t shm_lpid; /* pid of last operator */
- unsigned long shm_nattch; /* no. of current attaches */
- unsigned long __unused4;
- unsigned long __unused5;
-};
-
-struct shminfo64 {
- unsigned long shmmax;
- unsigned long shmmin;
- unsigned long shmmni;
- unsigned long shmseg;
- unsigned long shmall;
- unsigned long __unused1;
- unsigned long __unused2;
- unsigned long __unused3;
- unsigned long __unused4;
-};
-
-#endif /* _ASM_MICROBLAZE_SHMBUF_H */
+#include <asm-generic/shmbuf.h>
diff --git a/arch/microblaze/include/asm/siginfo.h b/arch/microblaze/include/asm/siginfo.h
index f162911..0815d29 100644
--- a/arch/microblaze/include/asm/siginfo.h
+++ b/arch/microblaze/include/asm/siginfo.h
@@ -1,15 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_SIGINFO_H
-#define _ASM_MICROBLAZE_SIGINFO_H
-
-#include <linux/types.h>
#include <asm-generic/siginfo.h>
-
-#endif /* _ASM_MICROBLAZE_SIGINFO_H */
diff --git a/arch/microblaze/include/asm/socket.h b/arch/microblaze/include/asm/socket.h
dissimilarity index 100%
index 8259368..6b71384 100644
--- a/arch/microblaze/include/asm/socket.h
+++ b/arch/microblaze/include/asm/socket.h
@@ -1,69 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_SOCKET_H
-#define _ASM_MICROBLAZE_SOCKET_H
-
-#include <asm/sockios.h>
-
-/* For setsockoptions(2) */
-#define SOL_SOCKET 1
-
-#define SO_DEBUG 1
-#define SO_REUSEADDR 2
-#define SO_TYPE 3
-#define SO_ERROR 4
-#define SO_DONTROUTE 5
-#define SO_BROADCAST 6
-#define SO_SNDBUF 7
-#define SO_RCVBUF 8
-#define SO_SNDBUFFORCE 32
-#define SO_RCVBUFFORCE 33
-#define SO_KEEPALIVE 9
-#define SO_OOBINLINE 10
-#define SO_NO_CHECK 11
-#define SO_PRIORITY 12
-#define SO_LINGER 13
-#define SO_BSDCOMPAT 14
-/* To add :#define SO_REUSEPORT 15 */
-#define SO_PASSCRED 16
-#define SO_PEERCRED 17
-#define SO_RCVLOWAT 18
-#define SO_SNDLOWAT 19
-#define SO_RCVTIMEO 20
-#define SO_SNDTIMEO 21
-
-/* Security levels - as per NRL IPv6 - don't actually do anything */
-#define SO_SECURITY_AUTHENTICATION 22
-#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
-#define SO_SECURITY_ENCRYPTION_NETWORK 24
-
-#define SO_BINDTODEVICE 25
-
-/* Socket filtering */
-#define SO_ATTACH_FILTER 26
-#define SO_DETACH_FILTER 27
-
-#define SO_PEERNAME 28
-#define SO_TIMESTAMP 29
-#define SCM_TIMESTAMP SO_TIMESTAMP
-
-#define SO_ACCEPTCONN 30
-
-#define SO_PEERSEC 31
-#define SO_PASSSEC 34
-
-#define SO_TIMESTAMPNS 35
-#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
-
-#define SO_MARK 36
-
-#define SO_TIMESTAMPING 37
-#define SCM_TIMESTAMPING SO_TIMESTAMPING
-
-#endif /* _ASM_MICROBLAZE_SOCKET_H */
+#include <asm-generic/socket.h>
diff --git a/arch/microblaze/include/asm/sockios.h b/arch/microblaze/include/asm/sockios.h
dissimilarity index 100%
index 9fff57a..def6d47 100644
--- a/arch/microblaze/include/asm/sockios.h
+++ b/arch/microblaze/include/asm/sockios.h
@@ -1,23 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_SOCKIOS_H
-#define _ASM_MICROBLAZE_SOCKIOS_H
-
-#include <linux/ioctl.h>
-
-/* Socket-level I/O control calls. */
-#define FIOSETOWN 0x8901
-#define SIOCSPGRP 0x8902
-#define FIOGETOWN 0x8903
-#define SIOCGPGRP 0x8904
-#define SIOCATMARK 0x8905
-#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
-#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
-
-#endif /* _ASM_MICROBLAZE_SOCKIOS_H */
+#include <asm-generic/sockios.h>
diff --git a/arch/microblaze/include/asm/stat.h b/arch/microblaze/include/asm/stat.h
dissimilarity index 100%
index a15f775..3dc90fa 100644
--- a/arch/microblaze/include/asm/stat.h
+++ b/arch/microblaze/include/asm/stat.h
@@ -1,68 +1 @@
-/*
- * Microblaze stat structure
- *
- * Copyright (C) 2001,02,03 NEC Electronics Corporation
- * Copyright (C) 2001,02,03 Miles Bader <[email protected]>
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License. See the file COPYING in the main directory of this
- * archive for more details.
- *
- * Written by Miles Bader <[email protected]>
- */
-
-#ifndef _ASM_MICROBLAZE_STAT_H
-#define _ASM_MICROBLAZE_STAT_H
-
-#include <linux/posix_types.h>
-
-#define STAT_HAVE_NSEC 1
-
-struct stat {
- unsigned long st_dev;
- unsigned long st_ino;
- unsigned int st_mode;
- unsigned int st_nlink;
- unsigned int st_uid;
- unsigned int st_gid;
- unsigned long st_rdev;
- unsigned long __pad1;
- long st_size;
- int st_blksize;
- int __pad2;
- long st_blocks;
- int st_atime;
- unsigned int st_atime_nsec;
- int st_mtime;
- unsigned int st_mtime_nsec;
- int st_ctime;
- unsigned int st_ctime_nsec;
- unsigned long __unused4;
- unsigned long __unused5;
-};
-
-struct stat64 {
- 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. */
- int st_atime; /* Time of last access. */
- unsigned int st_atime_nsec;
- int st_mtime; /* Time of last modification. */
- unsigned int st_mtime_nsec;
- int st_ctime; /* Time of last status change. */
- unsigned int st_ctime_nsec;
- unsigned int __unused4;
- unsigned int __unused5;
-};
-
-#endif /* _ASM_MICROBLAZE_STAT_H */
-
+#include <asm-generic/stat.h>
diff --git a/arch/microblaze/include/asm/swab.h b/arch/microblaze/include/asm/swab.h
index b375d7b..7847e56 100644
--- a/arch/microblaze/include/asm/swab.h
+++ b/arch/microblaze/include/asm/swab.h
@@ -1,8 +1 @@
-#ifndef _ASM_MICROBLAZE_SWAB_H
-#define _ASM_MICROBLAZE_SWAB_H
-
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
-#define __SWAB_64_THRU_32__
-#endif
-
-#endif /* _ASM_MICROBLAZE_SWAB_H */
+#include <asm-generic/swab.h>
diff --git a/arch/microblaze/include/asm/termbits.h b/arch/microblaze/include/asm/termbits.h
dissimilarity index 100%
index a1b64bc..3935b10 100644
--- a/arch/microblaze/include/asm/termbits.h
+++ b/arch/microblaze/include/asm/termbits.h
@@ -1,203 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_TERMBITS_H
-#define _ASM_MICROBLAZE_TERMBITS_H
-
-#include <linux/posix_types.h>
-
-typedef unsigned char cc_t;
-typedef unsigned int speed_t;
-typedef unsigned int tcflag_t;
-
-#define NCCS 19
-struct termios {
- tcflag_t c_iflag; /* input mode flags */
- tcflag_t c_oflag; /* output mode flags */
- tcflag_t c_cflag; /* control mode flags */
- tcflag_t c_lflag; /* local mode flags */
- cc_t c_line; /* line discipline */
- cc_t c_cc[NCCS]; /* control characters */
-};
-
-struct ktermios {
- tcflag_t c_iflag; /* input mode flags */
- tcflag_t c_oflag; /* output mode flags */
- tcflag_t c_cflag; /* control mode flags */
- tcflag_t c_lflag; /* local mode flags */
- cc_t c_line; /* line discipline */
- cc_t c_cc[NCCS]; /* control characters */
- speed_t c_ispeed; /* input speed */
- speed_t c_ospeed; /* output speed */
-};
-
-/* c_cc characters */
-
-#define VINTR 0
-#define VQUIT 1
-#define VERASE 2
-#define VKILL 3
-#define VEOF 4
-#define VTIME 5
-#define VMIN 6
-#define VSWTC 7
-#define VSTART 8
-#define VSTOP 9
-#define VSUSP 10
-#define VEOL 11
-#define VREPRINT 12
-#define VDISCARD 13
-#define VWERASE 14
-#define VLNEXT 15
-#define VEOL2 16
-
-/* c_iflag bits */
-
-#define IGNBRK 0000001
-#define BRKINT 0000002
-#define IGNPAR 0000004
-#define PARMRK 0000010
-#define INPCK 0000020
-#define ISTRIP 0000040
-#define INLCR 0000100
-#define IGNCR 0000200
-#define ICRNL 0000400
-#define IUCLC 0001000
-#define IXON 0002000
-#define IXANY 0004000
-#define IXOFF 0010000
-#define IMAXBEL 0020000
-#define IUTF8 0040000
-
-/* c_oflag bits */
-
-#define OPOST 0000001
-#define OLCUC 0000002
-#define ONLCR 0000004
-#define OCRNL 0000010
-#define ONOCR 0000020
-#define ONLRET 0000040
-#define OFILL 0000100
-#define OFDEL 0000200
-#define NLDLY 0000400
-#define NL0 0000000
-#define NL1 0000400
-#define CRDLY 0003000
-#define CR0 0000000
-#define CR1 0001000
-#define CR2 0002000
-#define CR3 0003000
-#define TABDLY 0014000
-#define TAB0 0000000
-#define TAB1 0004000
-#define TAB2 0010000
-#define TAB3 0014000
-#define XTABS 0014000
-#define BSDLY 0020000
-#define BS0 0000000
-#define BS1 0020000
-#define VTDLY 0040000
-#define VT0 0000000
-#define VT1 0040000
-#define FFDLY 0100000
-#define FF0 0000000
-#define FF1 0100000
-
-/* c_cflag bit meaning */
-
-#define CBAUD 0010017
-#define B0 0000000 /* hang up */
-#define B50 0000001
-#define B75 0000002
-#define B110 0000003
-#define B134 0000004
-#define B150 0000005
-#define B200 0000006
-#define B300 0000007
-#define B600 0000010
-#define B1200 0000011
-#define B1800 0000012
-#define B2400 0000013
-#define B4800 0000014
-#define B9600 0000015
-#define B19200 0000016
-#define B38400 0000017
-#define EXTA B19200
-#define EXTB B38400
-#define CSIZE 0000060
-#define CS5 0000000
-#define CS6 0000020
-#define CS7 0000040
-#define CS8 0000060
-#define CSTOPB 0000100
-#define CREAD 0000200
-#define PARENB 0000400
-#define PARODD 0001000
-#define HUPCL 0002000
-#define CLOCAL 0004000
-#define CBAUDEX 0010000
-#define B57600 0010001
-#define B115200 0010002
-#define B230400 0010003
-#define B460800 0010004
-#define B500000 0010005
-#define B576000 0010006
-#define B921600 0010007
-#define BOTHER 0010000
-#define B1000000 0010010
-#define B1152000 0010011
-#define B1500000 0010012
-#define B2000000 0010013
-#define B2500000 0010014
-#define B3000000 0010015
-#define B3500000 0010016
-#define B4000000 0010017
-#define CIBAUD 002003600000 /* input baud rate (not used) */
-#define CMSPAR 010000000000 /* mark or space (stick) parity */
-#define CRTSCTS 020000000000 /* flow control */
-
-#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
-
-/* c_lflag bits */
-
-#define ISIG 0000001
-#define ICANON 0000002
-#define XCASE 0000004
-#define ECHO 0000010
-#define ECHOE 0000020
-#define ECHOK 0000040
-#define ECHONL 0000100
-#define NOFLSH 0000200
-#define TOSTOP 0000400
-#define ECHOCTL 0001000
-#define ECHOPRT 0002000
-#define ECHOKE 0004000
-#define FLUSHO 0010000
-#define PENDIN 0040000
-#define IEXTEN 0100000
-
-/* tcflow() and TCXONC use these */
-
-#define TCOOFF 0
-#define TCOON 1
-#define TCIOFF 2
-#define TCION 3
-
-/* tcflush() and TCFLSH use these */
-
-#define TCIFLUSH 0
-#define TCOFLUSH 1
-#define TCIOFLUSH 2
-
-/* tcsetattr uses these */
-
-#define TCSANOW 0
-#define TCSADRAIN 1
-#define TCSAFLUSH 2
-
-#endif /* _ASM_MICROBLAZE_TERMBITS_H */
+#include <asm-generic/termbits.h>
diff --git a/arch/microblaze/include/asm/termios.h b/arch/microblaze/include/asm/termios.h
dissimilarity index 100%
index 47a46d1..280d78a 100644
--- a/arch/microblaze/include/asm/termios.h
+++ b/arch/microblaze/include/asm/termios.h
@@ -1,88 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_TERMIOS_H
-#define _ASM_MICROBLAZE_TERMIOS_H
-
-#include <linux/string.h>
-#include <asm/termbits.h>
-#include <asm/ioctls.h>
-
-struct winsize {
- unsigned short ws_row;
- unsigned short ws_col;
- unsigned short ws_xpixel;
- unsigned short ws_ypixel;
-};
-
-#define NCC 8
-struct termio {
- unsigned short c_iflag; /* input mode flags */
- unsigned short c_oflag; /* output mode flags */
- unsigned short c_cflag; /* control mode flags */
- unsigned short c_lflag; /* local mode flags */
- unsigned char c_line; /* line discipline */
- unsigned char c_cc[NCC]; /* control characters */
-};
-
-#ifdef __KERNEL__
-/* intr=^C quit=^| erase=del kill=^U
- eof=^D vtime=\0 vmin=\1 sxtc=\0
- start=^Q stop=^S susp=^Z eol=\0
- reprint=^R discard=^U werase=^W lnext=^V
- eol2=\0
-*/
-#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
-#endif
-
-/* Modem lines */
-
-#define TIOCM_LE 0x001
-#define TIOCM_DTR 0x002
-#define TIOCM_RTS 0x004
-#define TIOCM_ST 0x008
-#define TIOCM_SR 0x010
-#define TIOCM_CTS 0x020
-#define TIOCM_CAR 0x040
-#define TIOCM_RNG 0x080
-#define TIOCM_DSR 0x100
-#define TIOCM_CD TIOCM_CAR
-#define TIOCM_RI TIOCM_RNG
-#define TIOCM_OUT1 0x2000
-#define TIOCM_OUT2 0x4000
-#define TIOCM_LOOP 0x8000
-
-/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-
-/* Line disciplines */
-
-#define N_TTY 0
-#define N_SLIP 1
-#define N_MOUSE 2
-#define N_PPP 3
-#define N_STRIP 4
-#define N_AX25 5
-#define N_X25 6 /* X.25 async */
-#define N_6PACK 7
-#define N_MASC 8 /* Reserved for Mobitex module <[email protected]> */
-#define N_R3964 9 /* Reserved for Simatic R3964 module */
-#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <[email protected]> */
-#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */
-#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards
- about SMS messages */
-#define N_HDLC 13 /* synchronous HDLC */
-#define N_SYNC_PPP 14
-#define N_HCI 15 /* Bluetooth HCI UART */
-
-#ifdef __KERNEL__
-
-#include <asm-generic/termios-base.h>
-
-#endif /* __KERNEL__ */
-
-#endif /* _ASM_MICROBLAZE_TERMIOS_H */
+#include <asm-generic/termios.h>
diff --git a/arch/microblaze/include/asm/types.h b/arch/microblaze/include/asm/types.h
dissimilarity index 100%
index bebc018..b9e79bc 100644
--- a/arch/microblaze/include/asm/types.h
+++ b/arch/microblaze/include/asm/types.h
@@ -1,38 +1 @@
-/*
- * Copyright (C) Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_TYPES_H
-#define _ASM_MICROBLAZE_TYPES_H
-
-/*
- * This file is never included by application software unless
- * explicitly requested (e.g., via linux/types.h) in which case the
- * application is Linux specific so (user-) name space pollution is
- * not a major issue. However, for interoperability, libraries still
- * need to be careful to avoid a name clashes.
- */
-
-#include <asm-generic/int-ll64.h>
-
-# ifndef __ASSEMBLY__
-
-typedef unsigned short umode_t;
-
-/*
- * These aren't exported outside the kernel to avoid name space clashes
- */
-# ifdef __KERNEL__
-# define BITS_PER_LONG 32
-
-/* Dma addresses are 32-bits wide. */
-
-typedef u32 dma_addr_t;
-
-# endif/* __KERNEL__ */
-# endif /* __ASSEMBLY__ */
-#endif /* _ASM_MICROBLAZE_TYPES_H */
+#include <asm-generic/types.h>
diff --git a/arch/microblaze/include/asm/ucontext.h b/arch/microblaze/include/asm/ucontext.h
dissimilarity index 100%
index 11f6bb3..9bc07b9 100644
--- a/arch/microblaze/include/asm/ucontext.h
+++ b/arch/microblaze/include/asm/ucontext.h
@@ -1,22 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_UCONTEXT_H
-#define _ASM_MICROBLAZE_UCONTEXT_H
-
-#include <asm/sigcontext.h>
-
-struct ucontext {
- unsigned long uc_flags;
- struct ucontext *uc_link;
- stack_t uc_stack;
- struct sigcontext uc_mcontext;
- sigset_t uc_sigmask; /* mask last for extensibility */
-};
-
-#endif /* _ASM_MICROBLAZE_UCONTEXT_H */
+#include <asm-generic/ucontext.h>
--
1.6.3.1

2009-06-18 17:56:35

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 06/11] microblaze: use generic syscalls.h

The prototypes in syscalls.h all make sense for
microblaze, but for some of them, the actual implementation
in sys_microblaze.c needs to be adapted.

Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/microblaze/include/asm/syscalls.h | 49 +++++--------------------------
arch/microblaze/kernel/sys_microblaze.c | 12 ++++----
2 files changed, 14 insertions(+), 47 deletions(-)
rewrite arch/microblaze/include/asm/syscalls.h (94%)

diff --git a/arch/microblaze/include/asm/syscalls.h b/arch/microblaze/include/asm/syscalls.h
dissimilarity index 94%
index ea23843..720761c 100644
--- a/arch/microblaze/include/asm/syscalls.h
+++ b/arch/microblaze/include/asm/syscalls.h
@@ -1,41 +1,8 @@
-#ifndef __ASM_MICROBLAZE_SYSCALLS_H
-#define __ASM_MICROBLAZE_SYSCALLS_H
-#ifdef __KERNEL__
-
-#include <linux/compiler.h>
-#include <linux/linkage.h>
-#include <linux/types.h>
-#include <linux/signal.h>
-
-/* FIXME will be removed */
-asmlinkage int sys_ipc(uint call, int first, int second,
- int third, void *ptr, long fifth);
-
-struct pt_regs;
-asmlinkage int sys_vfork(struct pt_regs *regs);
-asmlinkage int sys_clone(int flags, unsigned long stack, struct pt_regs *regs);
-asmlinkage int sys_execve(char __user *filenamei, char __user *__user *argv,
- char __user *__user *envp, struct pt_regs *regs);
-
-asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len,
- unsigned long prot, unsigned long flags,
- unsigned long fd, unsigned long pgoff);
-
-asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
- unsigned long prot, unsigned long flags,
- unsigned long fd, off_t offset);
-
-/* from signal.c */
-asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize,
- struct pt_regs *regs);
-
-asmlinkage long sys_rt_sigaction(int sig, const struct sigaction __user *act,
- struct sigaction __user *oact, size_t sigsetsize);
-
-asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
- struct pt_regs *regs);
-
-asmlinkage long sys_rt_sigreturn(struct pt_regs *regs);
-
-#endif /* __KERNEL__ */
-#endif /* __ASM_MICROBLAZE_SYSCALLS_H */
+#ifndef __ASM_MICROBLAZE_SYSCALLS_H
+
+asmlinkage long sys_clone(int flags, unsigned long stack, struct pt_regs *regs);
+#define sys_clone sys_clone
+
+#include <asm-generic/syscalls.h>
+
+#endif /* __ASM_MICROBLAZE_SYSCALLS_H */
diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c
index d668518..61080a2 100644
--- a/arch/microblaze/kernel/sys_microblaze.c
+++ b/arch/microblaze/kernel/sys_microblaze.c
@@ -39,7 +39,7 @@
*
* This is really horribly ugly. This will be remove with new toolchain.
*/
-asmlinkage int
+asmlinkage long
sys_ipc(uint call, int first, int second, int third, void *ptr, long fifth)
{
int version, ret;
@@ -134,20 +134,20 @@ sys_ipc(uint call, int first, int second, int third, void *ptr, long fifth)
return ret;
}

-asmlinkage int microblaze_vfork(struct pt_regs *regs)
+asmlinkage long microblaze_vfork(struct pt_regs *regs)
{
return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->r1,
regs, 0, NULL, NULL);
}

-asmlinkage int microblaze_clone(int flags, unsigned long stack, struct pt_regs *regs)
+asmlinkage long microblaze_clone(int flags, unsigned long stack, struct pt_regs *regs)
{
if (!stack)
stack = regs->r1;
return do_fork(flags, stack, regs, 0, NULL, NULL);
}

-asmlinkage int microblaze_execve(char __user *filenamei, char __user *__user *argv,
+asmlinkage long microblaze_execve(char __user *filenamei, char __user *__user *argv,
char __user *__user *envp, struct pt_regs *regs)
{
int error;
@@ -163,7 +163,7 @@ out:
return error;
}

-asmlinkage unsigned long
+asmlinkage long
sys_mmap2(unsigned long addr, size_t len,
unsigned long prot, unsigned long flags,
unsigned long fd, unsigned long pgoff)
@@ -189,7 +189,7 @@ out:
return ret;
}

-asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
+asmlinkage long sys_mmap(unsigned long addr, size_t len,
unsigned long prot, unsigned long flags,
unsigned long fd, off_t offset)
{
--
1.6.3.1

2009-06-18 17:56:46

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 09/11] microblaze: convert all simple headers to use asm-generic

From: Remis Lima Baima <[email protected]>

All the simple microblaze header files were adapted to use their
asm-generic implementations. These files are more simple and were quite
straightforward to change.

fb.h, vga.h and parport.h previously did not exist, using
the generic version makes it possible to build more drivers
successfully in allyesonfig.

Signed-off-by: Remis Lima Baima <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/microblaze/include/asm/atomic.h | 147 ++++---------------------
arch/microblaze/include/asm/bitops.h | 28 +-----
arch/microblaze/include/asm/bug.h | 14 ---
arch/microblaze/include/asm/bugs.h | 18 +---
arch/microblaze/include/asm/fb.h | 1 +
arch/microblaze/include/asm/hardirq.h | 14 +--
arch/microblaze/include/asm/irq.h | 6 +-
arch/microblaze/include/asm/mmu.h | 7 +-
arch/microblaze/include/asm/mmu_context.h | 2 +-
arch/microblaze/include/asm/mmu_context_no.h | 23 ----
arch/microblaze/include/asm/module.h | 10 +--
arch/microblaze/include/asm/parport.h | 1 +
arch/microblaze/include/asm/pci.h | 2 +-
arch/microblaze/include/asm/scatterlist.h | 29 +-----
arch/microblaze/include/asm/serial.h | 15 +---
arch/microblaze/include/asm/shmparam.h | 7 +-
arch/microblaze/include/asm/system.h | 3 +
arch/microblaze/include/asm/timex.h | 6 +-
arch/microblaze/include/asm/vga.h | 2 +-
19 files changed, 45 insertions(+), 290 deletions(-)
rewrite arch/microblaze/include/asm/atomic.h (84%)
rewrite arch/microblaze/include/asm/bitops.h (95%)
create mode 100644 arch/microblaze/include/asm/fb.h
delete mode 100644 arch/microblaze/include/asm/mmu_context_no.h
create mode 100644 arch/microblaze/include/asm/parport.h
rewrite arch/microblaze/include/asm/scatterlist.h (100%)

diff --git a/arch/microblaze/include/asm/atomic.h b/arch/microblaze/include/asm/atomic.h
dissimilarity index 84%
index 0de612a..6d2e1d4 100644
--- a/arch/microblaze/include/asm/atomic.h
+++ b/arch/microblaze/include/asm/atomic.h
@@ -1,123 +1,24 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_ATOMIC_H
-#define _ASM_MICROBLAZE_ATOMIC_H
-
-#include <linux/types.h>
-#include <linux/compiler.h> /* likely */
-#include <asm/system.h> /* local_irq_XXX and friends */
-
-#define ATOMIC_INIT(i) { (i) }
-#define atomic_read(v) ((v)->counter)
-#define atomic_set(v, i) (((v)->counter) = (i))
-
-#define atomic_inc(v) (atomic_add_return(1, (v)))
-#define atomic_dec(v) (atomic_sub_return(1, (v)))
-
-#define atomic_add(i, v) (atomic_add_return(i, (v)))
-#define atomic_sub(i, v) (atomic_sub_return(i, (v)))
-
-#define atomic_inc_return(v) (atomic_add_return(1, (v)))
-#define atomic_dec_return(v) (atomic_sub_return(1, (v)))
-
-#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
-#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
-
-#define atomic_inc_not_zero(v) (atomic_add_unless((v), 1, 0))
-
-#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0)
-
-static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
-{
- int ret;
- unsigned long flags;
-
- local_irq_save(flags);
- ret = v->counter;
- if (likely(ret == old))
- v->counter = new;
- local_irq_restore(flags);
-
- return ret;
-}
-
-static inline int atomic_add_unless(atomic_t *v, int a, int u)
-{
- int c, old;
-
- c = atomic_read(v);
- while (c != u && (old = atomic_cmpxchg((v), c, c + a)) != c)
- c = old;
- return c != u;
-}
-
-static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
-{
- unsigned long flags;
-
- local_irq_save(flags);
- *addr &= ~mask;
- local_irq_restore(flags);
-}
-
-/**
- * atomic_add_return - add and return
- * @i: integer value to add
- * @v: pointer of type atomic_t
- *
- * Atomically adds @i to @v and returns @i + @v
- */
-static inline int atomic_add_return(int i, atomic_t *v)
-{
- unsigned long flags;
- int val;
-
- local_irq_save(flags);
- val = v->counter;
- v->counter = val += i;
- local_irq_restore(flags);
-
- return val;
-}
-
-static inline int atomic_sub_return(int i, atomic_t *v)
-{
- return atomic_add_return(-i, v);
-}
-
-/*
- * Atomically test *v and decrement if it is greater than 0.
- * The function returns the old value of *v minus 1.
- */
-static inline int atomic_dec_if_positive(atomic_t *v)
-{
- unsigned long flags;
- int res;
-
- local_irq_save(flags);
- res = v->counter - 1;
- if (res >= 0)
- v->counter = res;
- local_irq_restore(flags);
-
- return res;
-}
-
-#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
-#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
-
-/* Atomic operations are already serializing */
-#define smp_mb__before_atomic_dec() barrier()
-#define smp_mb__after_atomic_dec() barrier()
-#define smp_mb__before_atomic_inc() barrier()
-#define smp_mb__after_atomic_inc() barrier()
-
-#include <asm-generic/atomic-long.h>
-
-#endif /* _ASM_MICROBLAZE_ATOMIC_H */
+#ifndef _ASM_MICROBLAZE_ATOMIC_H
+#define _ASM_MICROBLAZE_ATOMIC_H
+
+#include <asm-generic/atomic.h>
+
+/*
+ * Atomically test *v and decrement if it is greater than 0.
+ * The function returns the old value of *v minus 1.
+ */
+static inline int atomic_dec_if_positive(atomic_t *v)
+{
+ unsigned long flags;
+ int res;
+
+ local_irq_save(flags);
+ res = v->counter - 1;
+ if (res >= 0)
+ v->counter = res;
+ local_irq_restore(flags);
+
+ return res;
+}
+
+#endif /* _ASM_MICROBLAZE_ATOMIC_H */
diff --git a/arch/microblaze/include/asm/bitops.h b/arch/microblaze/include/asm/bitops.h
dissimilarity index 95%
index d6df1fd..a72468f 100644
--- a/arch/microblaze/include/asm/bitops.h
+++ b/arch/microblaze/include/asm/bitops.h
@@ -1,27 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_BITOPS_H
-#define _ASM_MICROBLAZE_BITOPS_H
-
-/*
- * Copyright 1992, Linus Torvalds.
- */
-
-#include <asm/byteorder.h> /* swab32 */
-#include <asm/system.h> /* save_flags */
-
-/*
- * clear_bit() doesn't provide any barrier for the compiler.
- */
-#define smp_mb__before_clear_bit() barrier()
-#define smp_mb__after_clear_bit() barrier()
-#include <asm-generic/bitops.h>
-#include <asm-generic/bitops/__fls.h>
-
-#endif /* _ASM_MICROBLAZE_BITOPS_H */
+#include <asm-generic/bitops.h>
diff --git a/arch/microblaze/include/asm/bug.h b/arch/microblaze/include/asm/bug.h
index 8eb2cdd..b12fd89 100644
--- a/arch/microblaze/include/asm/bug.h
+++ b/arch/microblaze/include/asm/bug.h
@@ -1,15 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_BUG_H
-#define _ASM_MICROBLAZE_BUG_H
-
-#include <linux/kernel.h>
#include <asm-generic/bug.h>
-
-#endif /* _ASM_MICROBLAZE_BUG_H */
diff --git a/arch/microblaze/include/asm/bugs.h b/arch/microblaze/include/asm/bugs.h
index f2c6593..61791e1 100644
--- a/arch/microblaze/include/asm/bugs.h
+++ b/arch/microblaze/include/asm/bugs.h
@@ -1,17 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_BUGS_H
-#define _ASM_MICROBLAZE_BUGS_H
-
-static inline void check_bugs(void)
-{
- /* nothing to do */
-}
-
-#endif /* _ASM_MICROBLAZE_BUGS_H */
+#include <asm-generic/bugs.h>
diff --git a/arch/microblaze/include/asm/fb.h b/arch/microblaze/include/asm/fb.h
new file mode 100644
index 0000000..3a4988e
--- /dev/null
+++ b/arch/microblaze/include/asm/fb.h
@@ -0,0 +1 @@
+#include <asm-generic/fb.h>
diff --git a/arch/microblaze/include/asm/hardirq.h b/arch/microblaze/include/asm/hardirq.h
index 0f2d6b0..41e1e1a 100644
--- a/arch/microblaze/include/asm/hardirq.h
+++ b/arch/microblaze/include/asm/hardirq.h
@@ -9,21 +9,11 @@
#ifndef _ASM_MICROBLAZE_HARDIRQ_H
#define _ASM_MICROBLAZE_HARDIRQ_H

-#include <linux/cache.h>
-#include <linux/irq.h>
-#include <asm/irq.h>
-#include <asm/current.h>
-#include <linux/ptrace.h>
-
/* should be defined in each interrupt controller driver */
extern unsigned int get_irq(struct pt_regs *regs);

-typedef struct {
- unsigned int __softirq_pending;
-} ____cacheline_aligned irq_cpustat_t;
-
+#define ack_bad_irq ack_bad_irq
void ack_bad_irq(unsigned int irq);
-
-#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
+#include <asm-generic/hardirq.h>

#endif /* _ASM_MICROBLAZE_HARDIRQ_H */
diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h
index db515de..90f0505 100644
--- a/arch/microblaze/include/asm/irq.h
+++ b/arch/microblaze/include/asm/irq.h
@@ -10,6 +10,7 @@
#define _ASM_MICROBLAZE_IRQ_H

#define NR_IRQS 32
+#include <asm-generic/irq.h>

#include <linux/interrupt.h>

@@ -17,11 +18,6 @@ extern unsigned int nr_irq;

#define NO_IRQ (-1)

-static inline int irq_canonicalize(int irq)
-{
- return irq;
-}
-
struct pt_regs;
extern void do_IRQ(struct pt_regs *regs);

diff --git a/arch/microblaze/include/asm/mmu.h b/arch/microblaze/include/asm/mmu.h
index 66cad6a..8d6a654 100644
--- a/arch/microblaze/include/asm/mmu.h
+++ b/arch/microblaze/include/asm/mmu.h
@@ -12,12 +12,7 @@
#define _ASM_MICROBLAZE_MMU_H

# ifndef CONFIG_MMU
-# ifndef __ASSEMBLY__
-typedef struct {
- struct vm_list_struct *vmlist;
- unsigned long end_brk;
-} mm_context_t;
-# endif /* __ASSEMBLY__ */
+# include <asm-generic/mmu.h>
# else /* CONFIG_MMU */
# ifdef __KERNEL__
# ifndef __ASSEMBLY__
diff --git a/arch/microblaze/include/asm/mmu_context.h b/arch/microblaze/include/asm/mmu_context.h
index 385fed1..24eab16 100644
--- a/arch/microblaze/include/asm/mmu_context.h
+++ b/arch/microblaze/include/asm/mmu_context.h
@@ -1,5 +1,5 @@
#ifdef CONFIG_MMU
# include "mmu_context_mm.h"
#else
-# include "mmu_context_no.h"
+# include <asm-generic/mmu_context.h>
#endif
diff --git a/arch/microblaze/include/asm/mmu_context_no.h b/arch/microblaze/include/asm/mmu_context_no.h
deleted file mode 100644
index ba55671..0000000
--- a/arch/microblaze/include/asm/mmu_context_no.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2008-2009 Michal Simek <[email protected]>
- * Copyright (C) 2008-2009 PetaLogix
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_MMU_CONTEXT_H
-#define _ASM_MICROBLAZE_MMU_CONTEXT_H
-
-# define init_new_context(tsk, mm) ({ 0; })
-
-# define enter_lazy_tlb(mm, tsk) do {} while (0)
-# define change_mm_context(old, ctx, _pml4) do {} while (0)
-# define destroy_context(mm) do {} while (0)
-# define deactivate_mm(tsk, mm) do {} while (0)
-# define switch_mm(prev, next, tsk) do {} while (0)
-# define activate_mm(prev, next) do {} while (0)
-
-#endif /* _ASM_MICROBLAZE_MMU_CONTEXT_H */
diff --git a/arch/microblaze/include/asm/module.h b/arch/microblaze/include/asm/module.h
index 914565a..7be1347 100644
--- a/arch/microblaze/include/asm/module.h
+++ b/arch/microblaze/include/asm/module.h
@@ -9,6 +9,8 @@
#ifndef _ASM_MICROBLAZE_MODULE_H
#define _ASM_MICROBLAZE_MODULE_H

+#include <asm-generic/module.h>
+
/* Microblaze Relocations */
#define R_MICROBLAZE_NONE 0
#define R_MICROBLAZE_32 1
@@ -24,14 +26,6 @@
/* Keep this the last entry. */
#define R_MICROBLAZE_NUM 11

-struct mod_arch_specific {
- int foo;
-};
-
-#define Elf_Shdr Elf32_Shdr
-#define Elf_Sym Elf32_Sym
-#define Elf_Ehdr Elf32_Ehdr
-
typedef struct { volatile int counter; } module_t;

#endif /* _ASM_MICROBLAZE_MODULE_H */
diff --git a/arch/microblaze/include/asm/parport.h b/arch/microblaze/include/asm/parport.h
new file mode 100644
index 0000000..cf252af
--- /dev/null
+++ b/arch/microblaze/include/asm/parport.h
@@ -0,0 +1 @@
+#include <asm-generic/parport.h>
diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h
index ca03794..9f0df5f 100644
--- a/arch/microblaze/include/asm/pci.h
+++ b/arch/microblaze/include/asm/pci.h
@@ -1 +1 @@
-#include <linux/io.h>
+#include <asm-generic/pci.h>
diff --git a/arch/microblaze/include/asm/scatterlist.h b/arch/microblaze/include/asm/scatterlist.h
dissimilarity index 100%
index 08ff1d0..35d786f 100644
--- a/arch/microblaze/include/asm/scatterlist.h
+++ b/arch/microblaze/include/asm/scatterlist.h
@@ -1,28 +1 @@
-/*
- * Copyright (C) 2008 Michal Simek <[email protected]>
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_SCATTERLIST_H
-#define _ASM_MICROBLAZE_SCATTERLIST_H
-
-struct scatterlist {
-#ifdef CONFIG_DEBUG_SG
- unsigned long sg_magic;
-#endif
- unsigned long page_link;
- dma_addr_t dma_address;
- unsigned int offset;
- unsigned int length;
-};
-
-#define sg_dma_address(sg) ((sg)->dma_address)
-#define sg_dma_len(sg) ((sg)->length)
-
-#define ISA_DMA_THRESHOLD (~0UL)
-
-#endif /* _ASM_MICROBLAZE_SCATTERLIST_H */
+#include <asm-generic/scatterlist.h>
diff --git a/arch/microblaze/include/asm/serial.h b/arch/microblaze/include/asm/serial.h
index 39bfc8c..a0cb0ca 100644
--- a/arch/microblaze/include/asm/serial.h
+++ b/arch/microblaze/include/asm/serial.h
@@ -1,14 +1 @@
-/*
- * Copyright (C) 2009 Michal Simek <[email protected]>
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_SERIAL_H
-#define _ASM_MICROBLAZE_SERIAL_H
-
-# define BASE_BAUD (1843200 / 16)
-
-#endif /* _ASM_MICROBLAZE_SERIAL_H */
+#include <asm-generic/serial.h>
diff --git a/arch/microblaze/include/asm/shmparam.h b/arch/microblaze/include/asm/shmparam.h
index 9f5fc2b..93f30de 100644
--- a/arch/microblaze/include/asm/shmparam.h
+++ b/arch/microblaze/include/asm/shmparam.h
@@ -1,6 +1 @@
-#ifndef _ASM_MICROBLAZE_SHMPARAM_H
-#define _ASM_MICROBLAZE_SHMPARAM_H
-
-#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
-
-#endif /* _ASM_MICROBLAZE_SHMPARAM_H */
+#include <asm-generic/shmparam.h>
diff --git a/arch/microblaze/include/asm/system.h b/arch/microblaze/include/asm/system.h
index c4e3088..b1ed615 100644
--- a/arch/microblaze/include/asm/system.h
+++ b/arch/microblaze/include/asm/system.h
@@ -13,6 +13,9 @@
#include <asm/setup.h>
#include <asm/irqflags.h>

+#include <asm-generic/cmpxchg.h>
+#include <asm-generic/cmpxchg-local.h>
+
struct task_struct;
struct thread_info;

diff --git a/arch/microblaze/include/asm/timex.h b/arch/microblaze/include/asm/timex.h
index 678525d..befcf3d 100644
--- a/arch/microblaze/include/asm/timex.h
+++ b/arch/microblaze/include/asm/timex.h
@@ -9,10 +9,8 @@
#ifndef _ASM_MICROBLAZE_TIMEX_H
#define _ASM_MICROBLAZE_TIMEX_H

-#define CLOCK_TICK_RATE 1000 /* Timer input freq. */
-
-typedef unsigned long cycles_t;
+#include <asm-generic/timex.h>

-#define get_cycles() (0)
+#define CLOCK_TICK_RATE 1000 /* Timer input freq. */

#endif /* _ASM_TIMEX_H */
diff --git a/arch/microblaze/include/asm/vga.h b/arch/microblaze/include/asm/vga.h
index 8b13789..89d82fd 100644
--- a/arch/microblaze/include/asm/vga.h
+++ b/arch/microblaze/include/asm/vga.h
@@ -1 +1 @@
-
+#include <asm-generic/vga.h>
--
1.6.3.1

2009-06-18 17:56:59

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 05/11] microblaze: clean up signal handling

When legacy signal handling is disabled, the
arch/microblaze/kernel/signal.c implementation can
be much simpler, as most of it is handled generically
from kernel/signal.c.

This is also a prerequisite for using the generic
asm/unistd.h, which does not provide __NR_sigreturn,
because this macro is referenced by the current signal.c
implementation.

Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/microblaze/include/asm/signal.h | 166 +------------------------------
arch/microblaze/include/asm/syscalls.h | 11 +--
arch/microblaze/include/asm/unistd.h | 2 -
arch/microblaze/kernel/signal.c | 172 +++++++-------------------------
4 files changed, 39 insertions(+), 312 deletions(-)
rewrite arch/microblaze/include/asm/signal.h (100%)

diff --git a/arch/microblaze/include/asm/signal.h b/arch/microblaze/include/asm/signal.h
dissimilarity index 100%
index 46bc226..7b1573c 100644
--- a/arch/microblaze/include/asm/signal.h
+++ b/arch/microblaze/include/asm/signal.h
@@ -1,165 +1 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- * Yasushi SHOJI <[email protected]>
- * Tetsuya OHKAWA <[email protected]>
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_SIGNAL_H
-#define _ASM_MICROBLAZE_SIGNAL_H
-
-#define SIGHUP 1
-#define SIGINT 2
-#define SIGQUIT 3
-#define SIGILL 4
-#define SIGTRAP 5
-#define SIGABRT 6
-#define SIGIOT 6
-#define SIGBUS 7
-#define SIGFPE 8
-#define SIGKILL 9
-#define SIGUSR1 10
-#define SIGSEGV 11
-#define SIGUSR2 12
-#define SIGPIPE 13
-#define SIGALRM 14
-#define SIGTERM 15
-#define SIGSTKFLT 16
-#define SIGCHLD 17
-#define SIGCONT 18
-#define SIGSTOP 19
-#define SIGTSTP 20
-#define SIGTTIN 21
-#define SIGTTOU 22
-#define SIGURG 23
-#define SIGXCPU 24
-#define SIGXFSZ 25
-#define SIGVTALRM 26
-#define SIGPROF 27
-#define SIGWINCH 28
-#define SIGIO 29
-#define SIGPOLL SIGIO
-/*
-#define SIGLOST 29
-*/
-#define SIGPWR 30
-#define SIGSYS 31
-#define SIGUNUSED 31
-
-/* These should not be considered constants from userland. */
-#define SIGRTMIN 32
-#define SIGRTMAX _NSIG
-
-/*
- * SA_FLAGS values:
- *
- * SA_ONSTACK indicates that a registered stack_t will be used.
- * SA_RESTART flag to get restarting signals (which were the default long ago)
- * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
- * SA_RESETHAND clears the handler when the signal is delivered.
- * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
- * SA_NODEFER prevents the current signal from being masked in the handler.
- *
- * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
- * Unix names RESETHAND and NODEFER respectively.
- */
-#define SA_NOCLDSTOP 0x00000001
-#define SA_NOCLDWAIT 0x00000002
-#define SA_SIGINFO 0x00000004
-#define SA_ONSTACK 0x08000000
-#define SA_RESTART 0x10000000
-#define SA_NODEFER 0x40000000
-#define SA_RESETHAND 0x80000000
-
-#define SA_NOMASK SA_NODEFER
-#define SA_ONESHOT SA_RESETHAND
-
-#define SA_RESTORER 0x04000000
-
-/*
- * sigaltstack controls
- */
-#define SS_ONSTACK 1
-#define SS_DISABLE 2
-
-#define MINSIGSTKSZ 2048
-#define SIGSTKSZ 8192
-
-# ifndef __ASSEMBLY__
-# include <linux/types.h>
-# include <asm-generic/signal-defs.h>
-
-/* Avoid too many header ordering problems. */
-struct siginfo;
-
-# ifdef __KERNEL__
-/*
- * Most things should be clean enough to redefine this at will, if care
- * is taken to make libc match.
- */
-# define _NSIG 64
-# define _NSIG_BPW 32
-# define _NSIG_WORDS (_NSIG / _NSIG_BPW)
-
-typedef unsigned long old_sigset_t; /* at least 32 bits */
-
-typedef struct {
- unsigned long sig[_NSIG_WORDS];
-} sigset_t;
-
-struct old_sigaction {
- __sighandler_t sa_handler;
- old_sigset_t sa_mask;
- unsigned long sa_flags;
- void (*sa_restorer)(void);
-};
-
-struct sigaction {
- __sighandler_t sa_handler;
- unsigned long sa_flags;
- void (*sa_restorer)(void);
- sigset_t sa_mask; /* mask last for extensibility */
-};
-
-struct k_sigaction {
- struct sigaction sa;
-};
-
-# include <asm/sigcontext.h>
-# undef __HAVE_ARCH_SIG_BITOPS
-
-# define ptrace_signal_deliver(regs, cookie) do { } while (0)
-
-# else /* !__KERNEL__ */
-
-/* Here we must cater to libcs that poke about in kernel headers. */
-
-# define NSIG 32
-typedef unsigned long sigset_t;
-
-struct sigaction {
- union {
- __sighandler_t _sa_handler;
- void (*_sa_sigaction)(int, struct siginfo *, void *);
- } _u;
- sigset_t sa_mask;
- unsigned long sa_flags;
- void (*sa_restorer)(void);
-};
-
-# define sa_handler _u._sa_handler
-# define sa_sigaction _u._sa_sigaction
-
-# endif /* __KERNEL__ */
-
-typedef struct sigaltstack {
- void *ss_sp;
- int ss_flags;
- size_t ss_size;
-} stack_t;
-
-# endif /* __ASSEMBLY__ */
-#endif /* _ASM_MICROBLAZE_SIGNAL_H */
+#include <asm-generic/signal.h>
diff --git a/arch/microblaze/include/asm/syscalls.h b/arch/microblaze/include/asm/syscalls.h
index ddea9eb..ea23843 100644
--- a/arch/microblaze/include/asm/syscalls.h
+++ b/arch/microblaze/include/asm/syscalls.h
@@ -26,23 +26,16 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len,
unsigned long fd, off_t offset);

/* from signal.c */
-asmlinkage int sys_sigsuspend(old_sigset_t mask, struct pt_regs *regs);
-
-asmlinkage int sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize,
+asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize,
struct pt_regs *regs);

-asmlinkage int sys_sigaction(int sig, const struct old_sigaction *act,
- struct old_sigaction *oact);
-
asmlinkage long sys_rt_sigaction(int sig, const struct sigaction __user *act,
struct sigaction __user *oact, size_t sigsetsize);

asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
struct pt_regs *regs);

-asmlinkage int sys_sigreturn(struct pt_regs *regs);
-
-asmlinkage int sys_rt_sigreturn(struct pt_regs *regs);
+asmlinkage long sys_rt_sigreturn(struct pt_regs *regs);

#endif /* __KERNEL__ */
#endif /* __ASM_MICROBLAZE_SYSCALLS_H */
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h
index dceba3e..6ce1536 100644
--- a/arch/microblaze/include/asm/unistd.h
+++ b/arch/microblaze/include/asm/unistd.h
@@ -10,5 +10,3 @@
#endif /* __MICROBLAZE_UNISTD_H */

#include <asm-generic/unistd.h>
-
-#undef __ARCH_WANT_SYS_RT_SIGSUSPEND
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
index e663123..2783364 100644
--- a/arch/microblaze/kernel/signal.c
+++ b/arch/microblaze/kernel/signal.c
@@ -45,90 +45,6 @@

asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset, int in_sycall);

-/*
- * Atomically swap in the new signal mask, and wait for a signal.
- */
-asmlinkage int
-sys_sigsuspend(old_sigset_t mask, struct pt_regs *regs)
-{
- sigset_t saveset;
-
- mask &= _BLOCKABLE;
- spin_lock_irq(&current->sighand->siglock);
- saveset = current->blocked;
- siginitset(&current->blocked, mask);
- recalc_sigpending();
- spin_unlock_irq(&current->sighand->siglock);
-
- regs->r3 = -EINTR;
- while (1) {
- current->state = TASK_INTERRUPTIBLE;
- schedule();
- if (do_signal(regs, &saveset, 1))
- return -EINTR;
- }
-}
-
-asmlinkage int
-sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize,
- struct pt_regs *regs)
-{
- sigset_t saveset, newset;
-
- /* XXX: Don't preclude handling different sized sigset_t's. */
- if (sigsetsize != sizeof(sigset_t))
- return -EINVAL;
-
- if (copy_from_user(&newset, unewset, sizeof(newset)))
- return -EFAULT;
- sigdelsetmask(&newset, ~_BLOCKABLE);
- spin_lock_irq(&current->sighand->siglock);
- saveset = current->blocked;
- current->blocked = newset;
- recalc_sigpending();
- spin_unlock_irq(&current->sighand->siglock);
-
- regs->r3 = -EINTR;
- while (1) {
- current->state = TASK_INTERRUPTIBLE;
- schedule();
- if (do_signal(regs, &saveset, 1))
- return -EINTR;
- }
-}
-
-asmlinkage int
-sys_sigaction(int sig, const struct old_sigaction *act,
- struct old_sigaction *oact)
-{
- struct k_sigaction new_ka, old_ka;
- int ret;
-
- if (act) {
- old_sigset_t mask;
- if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
- __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
- __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
- return -EFAULT;
- __get_user(new_ka.sa.sa_flags, &act->sa_flags);
- __get_user(mask, &act->sa_mask);
- siginitset(&new_ka.sa.sa_mask, mask);
- }
-
- ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
-
- if (!ret && oact) {
- if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
- __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
- __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
- return -EFAULT;
- __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
- __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
- }
-
- return ret;
-}
-
asmlinkage long
microblaze_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
struct pt_regs *regs)
@@ -139,13 +55,13 @@ microblaze_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
/*
* Do a signal return; undo the signal stack.
*/
-
struct sigframe {
struct sigcontext sc;
unsigned long extramask[_NSIG_WORDS-1];
unsigned long tramp[2]; /* signal trampoline */
};

+
struct rt_sigframe {
struct siginfo info;
struct ucontext uc;
@@ -176,39 +92,6 @@ static int restore_sigcontext(struct pt_regs *regs,
return err;
}

-asmlinkage int sys_sigreturn(struct pt_regs *regs)
-{
- struct sigframe *frame =
- (struct sigframe *)(regs->r1 + STATE_SAVE_ARG_SPACE);
-
- sigset_t set;
- int rval;
-
- if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
- goto badframe;
-
- if (__get_user(set.sig[0], &frame->sc.oldmask)
- || (_NSIG_WORDS > 1
- && __copy_from_user(&set.sig[1], &frame->extramask,
- sizeof(frame->extramask))))
- goto badframe;
-
- sigdelsetmask(&set, ~_BLOCKABLE);
-
- spin_lock_irq(&current->sighand->siglock);
- current->blocked = set;
- recalc_sigpending();
- spin_unlock_irq(&current->sighand->siglock);
-
- if (restore_sigcontext(regs, &frame->sc, &rval))
- goto badframe;
- return rval;
-
-badframe:
- force_sig(SIGSEGV, current);
- return 0;
-}
-
asmlinkage long microblaze_rt_sigreturn(struct pt_regs *regs)
{
struct rt_sigframe __user *frame =
@@ -324,21 +207,17 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
/* Set up to return from userspace. If provided, use a stub
already in userspace. */
/* minus 8 is offset to cater for "rtsd r15,8" */
- if (ka->sa.sa_flags & SA_RESTORER) {
- regs->r15 = ((unsigned long)ka->sa.sa_restorer)-8;
- } else {
- /* addi r12, r0, __NR_sigreturn */
- err |= __put_user(0x31800000 | __NR_rt_sigreturn ,
- frame->tramp + 0);
- /* brki r14, 0x8 */
- err |= __put_user(0xb9cc0008, frame->tramp + 1);
-
- /* Return from sighandler will jump to the tramp.
- Negative 8 offset because return is rtsd r15, 8 */
- regs->r15 = ((unsigned long)frame->tramp)-8;
-
- __invalidate_cache_sigtramp((unsigned long)frame->tramp);
- }
+ /* addi r12, r0, __NR_sigreturn */
+ err |= __put_user(0x31800000 | __NR_rt_sigreturn ,
+ frame->tramp + 0);
+ /* brki r14, 0x8 */
+ err |= __put_user(0xb9cc0008, frame->tramp + 1);
+
+ /* Return from sighandler will jump to the tramp.
+ Negative 8 offset because return is rtsd r15, 8 */
+ regs->r15 = ((unsigned long)frame->tramp)-8;
+
+ __invalidate_cache_sigtramp((unsigned long)frame->tramp);

if (err)
goto give_sigsegv;
@@ -405,7 +284,7 @@ do_restart:
* OK, we're invoking a handler
*/

-static void
+static int
handle_signal(unsigned long sig, struct k_sigaction *ka,
siginfo_t *info, sigset_t *oldset, struct pt_regs *regs)
{
@@ -442,6 +321,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset, int in_syscall)
siginfo_t info;
int signr;
struct k_sigaction ka;
+
#ifdef DEBUG_SIG
printk(KERN_INFO "do signal: %p %p %d\n", regs, oldset, in_syscall);
printk(KERN_INFO "do signal2: %lx %lx %ld [%lx]\n", regs->pc, regs->r1,
@@ -456,7 +336,9 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset, int in_syscall)
if (kernel_mode(regs))
return 1;

- if (!oldset)
+ if (current_thread_info()->status & TS_RESTORE_SIGMASK)
+ oldset = &current->saved_sigmask;
+ else
oldset = &current->blocked;

signr = get_signal_to_deliver(&info, &ka, regs, NULL);
@@ -464,13 +346,31 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset, int in_syscall)
/* Whee! Actually deliver the signal. */
if (in_syscall)
handle_restart(regs, &ka, 1);
- handle_signal(signr, &ka, &info, oldset, regs);
+ if (handle_signal(signr, &ka, &info, oldset, regs)) {
+ /*
+ * A signal was successfully delivered; the saved
+ * sigmask will have been stored in the signal frame,
+ * and will be restored by sigreturn, so we can simply
+ * clear the TS_RESTORE_SIGMASK flag.
+ */
+ current_thread_info()->status &=
+ ~TS_RESTORE_SIGMASK;
+ }
return 1;
}

if (in_syscall)
handle_restart(regs, NULL, 0);

+ /*
+ * If there's no signal to deliver, we just put the saved sigmask
+ * back.
+ */
+ if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
+ current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
+ sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
+ }
+
/* Did we come from a system call? */
return 0;
}
--
1.6.3.1

2009-06-18 17:57:21

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 11/11] microblaze: remove sys_ipc

The ipc system call is now unused in microblaze,
as the system call table points directly to the
indidual system calls for IPC.

Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/microblaze/kernel/sys_microblaze.c | 99 -------------------------------
1 files changed, 0 insertions(+), 99 deletions(-)

diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c
index 61080a2..5f1e706 100644
--- a/arch/microblaze/kernel/sys_microblaze.c
+++ b/arch/microblaze/kernel/sys_microblaze.c
@@ -34,105 +34,6 @@
#include <linux/unistd.h>

#include <asm/syscalls.h>
-/*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly. This will be remove with new toolchain.
- */
-asmlinkage long
-sys_ipc(uint call, int first, int second, int third, void *ptr, long fifth)
-{
- int version, ret;
-
- version = call >> 16; /* hack for backward compatibility */
- call &= 0xffff;
-
- ret = -EINVAL;
- switch (call) {
- case SEMOP:
- ret = sys_semop(first, (struct sembuf *)ptr, second);
- break;
- case SEMGET:
- ret = sys_semget(first, second, third);
- break;
- case SEMCTL:
- {
- union semun fourth;
-
- if (!ptr)
- break;
- ret = (access_ok(VERIFY_READ, ptr, sizeof(long)) ? 0 : -EFAULT)
- || (get_user(fourth.__pad, (void **)ptr)) ;
- if (ret)
- break;
- ret = sys_semctl(first, second, third, fourth);
- break;
- }
- case MSGSND:
- ret = sys_msgsnd(first, (struct msgbuf *) ptr, second, third);
- break;
- case MSGRCV:
- switch (version) {
- case 0: {
- struct ipc_kludge tmp;
-
- if (!ptr)
- break;
- ret = (access_ok(VERIFY_READ, ptr, sizeof(tmp))
- ? 0 : -EFAULT) || copy_from_user(&tmp,
- (struct ipc_kludge *) ptr, sizeof(tmp));
- if (ret)
- break;
- ret = sys_msgrcv(first, tmp.msgp, second, tmp.msgtyp,
- third);
- break;
- }
- default:
- ret = sys_msgrcv(first, (struct msgbuf *) ptr,
- second, fifth, third);
- break;
- }
- break;
- case MSGGET:
- ret = sys_msgget((key_t) first, second);
- break;
- case MSGCTL:
- ret = sys_msgctl(first, second, (struct msqid_ds *) ptr);
- break;
- case SHMAT:
- switch (version) {
- default: {
- ulong raddr;
- ret = access_ok(VERIFY_WRITE, (ulong *) third,
- sizeof(ulong)) ? 0 : -EFAULT;
- if (ret)
- break;
- ret = do_shmat(first, (char *) ptr, second, &raddr);
- if (ret)
- break;
- ret = put_user(raddr, (ulong *) third);
- break;
- }
- case 1: /* iBCS2 emulator entry point */
- if (!segment_eq(get_fs(), get_ds()))
- break;
- ret = do_shmat(first, (char *) ptr, second,
- (ulong *) third);
- break;
- }
- break;
- case SHMDT:
- ret = sys_shmdt((char *)ptr);
- break;
- case SHMGET:
- ret = sys_shmget(first, second, third);
- break;
- case SHMCTL:
- ret = sys_shmctl(first, second, (struct shmid_ds *) ptr);
- break;
- }
- return ret;
-}

asmlinkage long microblaze_vfork(struct pt_regs *regs)
{
--
1.6.3.1

2009-06-18 17:57:45

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 07/11] microblaze: make syscall_table implementation generic

The syscall table as added to the microblaze architecture
is entirely generic and can be used by all future
architectures as well, so move it to kernel/syscall_table.c.

Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/microblaze/Kconfig | 3 +++
arch/microblaze/kernel/Makefile | 2 +-
kernel/Makefile | 1 +
{arch/microblaze/kernel => kernel}/syscall_table.c | 0
4 files changed, 5 insertions(+), 1 deletions(-)
rename {arch/microblaze/kernel => kernel}/syscall_table.c (100%)

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index b50b845..8b4de19 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -53,6 +53,9 @@ config GENERIC_HARDIRQS_NO__DO_IRQ
config GENERIC_GPIO
def_bool y

+config GENERIC_SYSCALL_TABLE
+ def_bool y
+
config PCI
def_bool n

diff --git a/arch/microblaze/kernel/Makefile b/arch/microblaze/kernel/Makefile
index 62353a9..f4a5e19 100644
--- a/arch/microblaze/kernel/Makefile
+++ b/arch/microblaze/kernel/Makefile
@@ -7,7 +7,7 @@ extra-y := head.o vmlinux.lds
obj-y += exceptions.o \
hw_exception_handler.o init_task.o intc.o irq.o of_device.o \
of_platform.o process.o prom.o prom_parse.o ptrace.o \
- setup.o signal.o sys_microblaze.o timer.o traps.o syscall_table.o
+ setup.o signal.o sys_microblaze.o timer.o traps.o

obj-y += cpu/

diff --git a/kernel/Makefile b/kernel/Makefile
index 9df4501..a3d4fa3 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -98,6 +98,7 @@ obj-$(CONFIG_X86_DS) += trace/
obj-$(CONFIG_SMP) += sched_cpupri.o
obj-$(CONFIG_SLOW_WORK) += slow-work.o
obj-$(CONFIG_PERF_COUNTERS) += perf_counter.o
+obj-$(CONFIG_GENERIC_SYSCALL_TABLE) += syscall_table.o

ifneq ($(CONFIG_SCHED_OMIT_FRAME_POINTER),y)
# According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is
diff --git a/arch/microblaze/kernel/syscall_table.c b/kernel/syscall_table.c
similarity index 100%
rename from arch/microblaze/kernel/syscall_table.c
rename to kernel/syscall_table.c
--
1.6.3.1

2009-06-18 17:57:33

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 02/11] microblaze: remove init_mm

Alexey removed the definition for init_mm from all architectures
but forgot microblaze, which was only recently added.
This fixes the microblaze build by dropping it there as well.

Cc: Alexey Dobriyan <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/microblaze/kernel/init_task.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/arch/microblaze/kernel/init_task.c b/arch/microblaze/kernel/init_task.c
index 48eb9fb..67da225 100644
--- a/arch/microblaze/kernel/init_task.c
+++ b/arch/microblaze/kernel/init_task.c
@@ -18,8 +18,6 @@

static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-EXPORT_SYMBOL(init_mm);

union thread_union init_thread_union
__attribute__((__section__(".data.init_task"))) =
--
1.6.3.1

2009-06-18 18:01:15

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 01/11] ipc: use __ARCH_WANT_IPC_PARSE_VERSION in ipc/util.h

The definition of ipc_parse_version depends on
__ARCH_WANT_IPC_PARSE_VERSION, but the header file
declares it conditionally based on the architecture.

Use the macro consistently to make it easier to add
new architectures.

Signed-off-by: Arnd Bergmann <[email protected]>
Acked-by: Serge Hallyn <[email protected]>
---
ipc/util.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ipc/util.h b/ipc/util.h
index 1187332..f9fe90e 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -128,7 +128,7 @@ void ipc_update_perm(struct ipc64_perm *in, struct kern_ipc_perm *out);
struct kern_ipc_perm *ipcctl_pre_down(struct ipc_ids *ids, int id, int cmd,
struct ipc64_perm *perm, int extra_perm);

-#if defined(__ia64__) || defined(__x86_64__) || defined(__hppa__) || defined(__XTENSA__)
+#ifndef __ARCH_WANT_IPC_PARSE_VERSION
/* On IA-64, we always use the "64-bit version" of the IPC structures. */
# define ipc_parse_version(cmd) IPC_64
#else
--
1.6.3.1

2009-06-18 18:01:28

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 08/11] microblaze: use the generic lib/checksum.c

From: Remis Lima Baima <[email protected]>

The microblaze checksum code is mostly identical to
the asm-generic+lib version, so use that instead.

Signed-off-by: Remis Lima Baima <[email protected]>
---
arch/microblaze/Kconfig | 3 +
arch/microblaze/include/asm/checksum.h | 134 ++++++------------------
arch/microblaze/lib/Makefile | 2 +-
arch/microblaze/lib/checksum.c | 172 --------------------------------
4 files changed, 38 insertions(+), 273 deletions(-)
rewrite arch/microblaze/include/asm/checksum.h (69%)
delete mode 100644 arch/microblaze/lib/checksum.c

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 8b4de19..8ee1c85 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -56,6 +56,9 @@ config GENERIC_GPIO
config GENERIC_SYSCALL_TABLE
def_bool y

+config GENERIC_CSUM
+ def_bool y
+
config PCI
def_bool n

diff --git a/arch/microblaze/include/asm/checksum.h b/arch/microblaze/include/asm/checksum.h
dissimilarity index 69%
index 97ea46b..128bf03 100644
--- a/arch/microblaze/include/asm/checksum.h
+++ b/arch/microblaze/include/asm/checksum.h
@@ -1,100 +1,34 @@
-/*
- * Copyright (C) 2008 Michal Simek <[email protected]>
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_CHECKSUM_H
-#define _ASM_MICROBLAZE_CHECKSUM_H
-
-#include <linux/in6.h>
-
-/*
- * computes the checksum of the TCP/UDP pseudo-header
- * returns a 16-bit checksum, already complemented
- */
-static inline __wsum
-csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
- unsigned short proto, __wsum sum)
-{
- __asm__("add %0, %0, %1\n\t"
- "addc %0, %0, %2\n\t"
- "addc %0, %0, %3\n\t"
- "addc %0, %0, r0\n\t"
- : "+&d" (sum)
- : "d" (saddr), "d" (daddr), "d" (len + proto));
-
- return sum;
-}
-
-/*
- * computes the checksum of a memory block at buff, length len,
- * and adds in "sum" (32-bit)
- *
- * returns a 32-bit number suitable for feeding into itself
- * or csum_tcpudp_magic
- *
- * this function must be called with even lengths, except
- * for the last fragment, which may be odd
- *
- * it's best to have buff aligned on a 32-bit boundary
- */
-extern __wsum csum_partial(const void *buff, int len, __wsum sum);
-
-/*
- * the same as csum_partial, but copies from src while it
- * checksums
- *
- * here even more important to align src and dst on a 32-bit (or even
- * better 64-bit) boundary
- */
-extern __wsum csum_partial_copy(const void *src, void *dst, int len,
- __wsum sum);
-
-/*
- * the same as csum_partial_copy, but copies from user space.
- *
- * here even more important to align src and dst on a 32-bit (or even
- * better 64-bit) boundary
- */
-extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
- int len, __wsum sum, int *csum_err);
-
-#define csum_partial_copy_nocheck(src, dst, len, sum) \
- csum_partial_copy((src), (dst), (len), (sum))
-
-/*
- * This is a version of ip_compute_csum() optimized for IP headers,
- * which always checksum on 4 octet boundaries.
- *
- */
-extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
-
-/*
- * Fold a partial checksum
- */
-static inline __sum16 csum_fold(__wsum csum)
-{
- u32 sum = (__force u32)csum;
- sum = (sum & 0xffff) + (sum >> 16);
- sum = (sum & 0xffff) + (sum >> 16);
- return (__force __sum16)~sum;
-}
-
-static inline __sum16
-csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
- unsigned short proto, __wsum sum)
-{
- return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
-}
-
-/*
- * this routine is used for miscellaneous IP-like checksums, mainly
- * in icmp.c
- */
-extern __sum16 ip_compute_csum(const void *buff, int len);
-
-#endif /* _ASM_MICROBLAZE_CHECKSUM_H */
+/*
+ * Copyright (C) 2008 Michal Simek <[email protected]>
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#ifndef _ASM_MICROBLAZE_CHECKSUM_H
+#define _ASM_MICROBLAZE_CHECKSUM_H
+
+/*
+ * computes the checksum of the TCP/UDP pseudo-header
+ * returns a 16-bit checksum, already complemented
+ */
+#define csum_tcpudp_nofold csum_tcpudp_nofold
+static inline __wsum
+csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
+ unsigned short proto, __wsum sum)
+{
+ __asm__("add %0, %0, %1\n\t"
+ "addc %0, %0, %2\n\t"
+ "addc %0, %0, %3\n\t"
+ "addc %0, %0, r0\n\t"
+ : "+&d" (sum)
+ : "d" (saddr), "d" (daddr), "d" (len + proto));
+
+ return sum;
+}
+
+#include <asm-generic/checksum.h>
+
+#endif /* _ASM_MICROBLAZE_CHECKSUM_H */
diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile
index 71c8cb6..b579db0 100644
--- a/arch/microblaze/lib/Makefile
+++ b/arch/microblaze/lib/Makefile
@@ -2,7 +2,7 @@
# Makefile
#

-lib-y := memset.o checksum.o
+lib-y := memset.o

ifeq ($(CONFIG_OPT_LIB_ASM),y)
lib-y += fastcopy.o
diff --git a/arch/microblaze/lib/checksum.c b/arch/microblaze/lib/checksum.c
deleted file mode 100644
index f08e745..0000000
--- a/arch/microblaze/lib/checksum.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- *
- * INET An implementation of the TCP/IP protocol suite for the LINUX
- * operating system. INET is implemented using the BSD Socket
- * interface as the means of communication with the user level.
- *
- * IP/TCP/UDP checksumming routines
- *
- * Authors: Jorge Cwik, <[email protected]>
- * Arnt Gulbrandsen, <[email protected]>
- * Tom May, <[email protected]>
- * Andreas Schwab, <[email protected]>
- * Lots of code moved from tcp.c and ip.c; see those files
- * for more names.
- *
- * 03/02/96 Jes Sorensen, Andreas Schwab, Roman Hodek:
- * Fixed some nasty bugs, causing some horrible crashes.
- * A: At some points, the sum (%0) was used as
- * length-counter instead of the length counter
- * (%1). Thanks to Roman Hodek for pointing this out.
- * B: GCC seems to mess up if one uses too many
- * data-registers to hold input values and one tries to
- * specify d0 and d1 as scratch registers. Letting gcc
- * choose these registers itself solves the problem.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-/* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access
- kills, so most of the assembly has to go. */
-
-#include <linux/module.h>
-#include <net/checksum.h>
-
-#include <asm/byteorder.h>
-
-static inline unsigned short from32to16(unsigned long x)
-{
- /* add up 16-bit and 16-bit for 16+c bit */
- x = (x & 0xffff) + (x >> 16);
- /* add up carry.. */
- x = (x & 0xffff) + (x >> 16);
- return x;
-}
-
-static unsigned int do_csum(const unsigned char *buff, int len)
-{
- int odd, count;
- unsigned long result = 0;
-
- if (len <= 0)
- goto out;
- odd = 1 & (unsigned long) buff;
- if (odd) {
- result = *buff;
- len--;
- buff++;
- }
- count = len >> 1; /* nr of 16-bit words.. */
- if (count) {
- if (2 & (unsigned long) buff) {
- result += *(unsigned short *) buff;
- count--;
- len -= 2;
- buff += 2;
- }
- count >>= 1; /* nr of 32-bit words.. */
- if (count) {
- unsigned long carry = 0;
- do {
- unsigned long w = *(unsigned long *) buff;
- count--;
- buff += 4;
- result += carry;
- result += w;
- carry = (w > result);
- } while (count);
- result += carry;
- result = (result & 0xffff) + (result >> 16);
- }
- if (len & 2) {
- result += *(unsigned short *) buff;
- buff += 2;
- }
- }
- if (len & 1)
- result += (*buff << 8);
- result = from32to16(result);
- if (odd)
- result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
-out:
- return result;
-}
-
-/*
- * This is a version of ip_compute_csum() optimized for IP headers,
- * which always checksum on 4 octet boundaries.
- */
-__sum16 ip_fast_csum(const void *iph, unsigned int ihl)
-{
- return (__force __sum16)~do_csum(iph, ihl*4);
-}
-EXPORT_SYMBOL(ip_fast_csum);
-
-/*
- * computes the checksum of a memory block at buff, length len,
- * and adds in "sum" (32-bit)
- *
- * returns a 32-bit number suitable for feeding into itself
- * or csum_tcpudp_magic
- *
- * this function must be called with even lengths, except
- * for the last fragment, which may be odd
- *
- * it's best to have buff aligned on a 32-bit boundary
- */
-__wsum csum_partial(const void *buff, int len, __wsum wsum)
-{
- unsigned int sum = (__force unsigned int)wsum;
- unsigned int result = do_csum(buff, len);
-
- /* add in old sum, and carry.. */
- result += sum;
- if (sum > result)
- result += 1;
- return (__force __wsum)result;
-}
-EXPORT_SYMBOL(csum_partial);
-
-/*
- * this routine is used for miscellaneous IP-like checksums, mainly
- * in icmp.c
- */
-__sum16 ip_compute_csum(const void *buff, int len)
-{
- return (__force __sum16)~do_csum(buff, len);
-}
-EXPORT_SYMBOL(ip_compute_csum);
-
-/*
- * copy from fs while checksumming, otherwise like csum_partial
- */
-__wsum
-csum_partial_copy_from_user(const void __user *src, void *dst, int len,
- __wsum sum, int *csum_err)
-{
- int missing;
-
- missing = __copy_from_user(dst, src, len);
- if (missing) {
- memset(dst + len - missing, 0, missing);
- *csum_err = -EFAULT;
- } else
- *csum_err = 0;
-
- return csum_partial(dst, len, sum);
-}
-EXPORT_SYMBOL(csum_partial_copy_from_user);
-
-/*
- * copy from ds while checksumming, otherwise like csum_partial
- */
-__wsum
-csum_partial_copy(const void *src, void *dst, int len, __wsum sum)
-{
- memcpy(dst, src, len);
- return csum_partial(dst, len, sum);
-}
-EXPORT_SYMBOL(csum_partial_copy);
--
1.6.3.1

2009-06-18 18:01:40

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 10/11] microblaze: use generic system.h

From: Remis Lima Baima <[email protected]>

Parts of the microblaze system.h can be removed by
falling back to the asm-generic version.

Signed-off-by: Remis Lima Baima <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/microblaze/include/asm/cmpxchg-local.h | 1 +
arch/microblaze/include/asm/irqflags.h | 2 +-
arch/microblaze/include/asm/system.h | 124 +++++++--------------------
3 files changed, 32 insertions(+), 95 deletions(-)
create mode 100644 arch/microblaze/include/asm/cmpxchg-local.h
rewrite arch/microblaze/include/asm/system.h (67%)

diff --git a/arch/microblaze/include/asm/cmpxchg-local.h b/arch/microblaze/include/asm/cmpxchg-local.h
new file mode 100644
index 0000000..d3358a3
--- /dev/null
+++ b/arch/microblaze/include/asm/cmpxchg-local.h
@@ -0,0 +1 @@
+#include <asm-generic/cmpxchg-local.h>
diff --git a/arch/microblaze/include/asm/irqflags.h b/arch/microblaze/include/asm/irqflags.h
index dea6564..a6dbdee 100644
--- a/arch/microblaze/include/asm/irqflags.h
+++ b/arch/microblaze/include/asm/irqflags.h
@@ -9,7 +9,7 @@
#ifndef _ASM_MICROBLAZE_IRQFLAGS_H
#define _ASM_MICROBLAZE_IRQFLAGS_H

-#include <linux/irqflags.h>
+#include <asm/registers.h>

# if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR

diff --git a/arch/microblaze/include/asm/system.h b/arch/microblaze/include/asm/system.h
dissimilarity index 67%
index b1ed615..a26ef8e 100644
--- a/arch/microblaze/include/asm/system.h
+++ b/arch/microblaze/include/asm/system.h
@@ -1,94 +1,30 @@
-/*
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_SYSTEM_H
-#define _ASM_MICROBLAZE_SYSTEM_H
-
-#include <asm/registers.h>
-#include <asm/setup.h>
-#include <asm/irqflags.h>
-
-#include <asm-generic/cmpxchg.h>
-#include <asm-generic/cmpxchg-local.h>
-
-struct task_struct;
-struct thread_info;
-
-extern struct task_struct *_switch_to(struct thread_info *prev,
- struct thread_info *next);
-
-#define switch_to(prev, next, last) \
- do { \
- (last) = _switch_to(task_thread_info(prev), \
- task_thread_info(next)); \
- } while (0)
-
-#define smp_read_barrier_depends() do {} while (0)
-#define read_barrier_depends() do {} while (0)
-
-#define nop() asm volatile ("nop")
-#define mb() barrier()
-#define rmb() mb()
-#define wmb() mb()
-#define set_mb(var, value) do { var = value; mb(); } while (0)
-#define set_wmb(var, value) do { var = value; wmb(); } while (0)
-
-#define smp_mb() mb()
-#define smp_rmb() rmb()
-#define smp_wmb() wmb()
-
-void show_trace(struct task_struct *task, unsigned long *stack);
-void __bad_xchg(volatile void *ptr, int size);
-
-static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
- int size)
-{
- unsigned long ret;
- unsigned long flags;
-
- switch (size) {
- case 1:
- local_irq_save(flags);
- ret = *(volatile unsigned char *)ptr;
- *(volatile unsigned char *)ptr = x;
- local_irq_restore(flags);
- break;
-
- case 4:
- local_irq_save(flags);
- ret = *(volatile unsigned long *)ptr;
- *(volatile unsigned long *)ptr = x;
- local_irq_restore(flags);
- break;
- default:
- __bad_xchg(ptr, size), ret = 0;
- break;
- }
-
- return ret;
-}
-
-void disable_hlt(void);
-void enable_hlt(void);
-void default_idle(void);
-
-#define xchg(ptr, x) \
- ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
-
-void free_init_pages(char *what, unsigned long begin, unsigned long end);
-void free_initmem(void);
-extern char *klimit;
-extern void ret_from_fork(void);
-
-#ifdef CONFIG_DEBUG_FS
-extern struct dentry *of_debugfs_root;
-#endif
-
-#define arch_align_stack(x) (x)
-
-#endif /* _ASM_MICROBLAZE_SYSTEM_H */
+/*
+ * Copyright (C) 2006 Atmark Techno, Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#ifndef _ASM_MICROBLAZE_SYSTEM_H
+#define _ASM_MICROBLAZE_SYSTEM_H
+
+#define __switch_to _switch_to
+
+#include <asm/irqflags.h>
+#include <asm-generic/system.h>
+
+#ifdef CONFIG_DEBUG_FS
+extern struct dentry *of_debugfs_root;
+#endif
+
+void show_trace(struct task_struct *task, unsigned long *stack);
+void disable_hlt(void);
+void enable_hlt(void);
+void default_idle(void);
+void free_init_pages(char *what, unsigned long begin, unsigned long end);
+void free_initmem(void);
+
+extern char *klimit;
+extern void ret_from_fork(void);
+
+#endif /* _ASM_MICROBLAZE_SYSTEM_H */
--
1.6.3.1

2009-06-18 18:01:53

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 04/11] microblaze: use generic unistd.h syscall list

This makes use of the generic system call list from
asm-generic/unistd.h, and uses the same table to
generate syscall_table.o.

The code is kept in microblaze for now, but could
easily be moved to kernel/syscall_table.c at a
later time when more architectures want to share
it.

Signed-off-by: Arnd Bergmann <[email protected]>
---
arch/microblaze/include/asm/unistd.h | 437 +------------------------------
arch/microblaze/kernel/Makefile | 2 +-
arch/microblaze/kernel/entry-nommu.S | 35 +--
arch/microblaze/kernel/entry.S | 6 -
arch/microblaze/kernel/signal.c | 6 +-
arch/microblaze/kernel/sys_microblaze.c | 6 +-
arch/microblaze/kernel/syscall_table.S | 371 --------------------------
arch/microblaze/kernel/syscall_table.c | 12 +
8 files changed, 44 insertions(+), 831 deletions(-)
rewrite arch/microblaze/include/asm/unistd.h (99%)
delete mode 100644 arch/microblaze/kernel/syscall_table.S
create mode 100644 arch/microblaze/kernel/syscall_table.c

diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h
dissimilarity index 99%
index b5e2f5f..dceba3e 100644
--- a/arch/microblaze/include/asm/unistd.h
+++ b/arch/microblaze/include/asm/unistd.h
@@ -1,423 +1,14 @@
-/*
- * Copyright (C) 2007-2008 Michal Simek <[email protected]>
- * Copyright (C) 2006 Atmark Techno, Inc.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_UNISTD_H
-#define _ASM_MICROBLAZE_UNISTD_H
-
-#define __NR_restart_syscall 0 /* ok */
-#define __NR_exit 1 /* ok */
-#define __NR_fork 2 /* not for no MMU - weird */
-#define __NR_read 3 /* ok */
-#define __NR_write 4 /* ok */
-#define __NR_open 5 /* openat */
-#define __NR_close 6 /* ok */
-#define __NR_waitpid 7 /* waitid */
-#define __NR_creat 8 /* openat */
-#define __NR_link 9 /* linkat */
-#define __NR_unlink 10 /* unlinkat */
-#define __NR_execve 11 /* ok */
-#define __NR_chdir 12 /* ok */
-#define __NR_time 13 /* obsolete -> sys_gettimeofday */
-#define __NR_mknod 14 /* mknodat */
-#define __NR_chmod 15 /* fchmodat */
-#define __NR_lchown 16 /* ok */
-#define __NR_break 17 /* don't know */
-#define __NR_oldstat 18 /* remove */
-#define __NR_lseek 19 /* ok */
-#define __NR_getpid 20 /* ok */
-#define __NR_mount 21 /* ok */
-#define __NR_umount 22 /* ok */ /* use only umount2 */
-#define __NR_setuid 23 /* ok */
-#define __NR_getuid 24 /* ok */
-#define __NR_stime 25 /* obsolete -> sys_settimeofday */
-#define __NR_ptrace 26 /* ok */
-#define __NR_alarm 27 /* obsolete -> sys_setitimer */
-#define __NR_oldfstat 28 /* remove */
-#define __NR_pause 29 /* obsolete -> sys_rt_sigtimedwait */
-#define __NR_utime 30 /* obsolete -> sys_utimesat */
-#define __NR_stty 31 /* remove */
-#define __NR_gtty 32 /* remove */
-#define __NR_access 33 /* faccessat */
-/* can be implemented by sys_setpriority */
-#define __NR_nice 34
-#define __NR_ftime 35 /* remove */
-#define __NR_sync 36 /* ok */
-#define __NR_kill 37 /* ok */
-#define __NR_rename 38 /* renameat */
-#define __NR_mkdir 39 /* mkdirat */
-#define __NR_rmdir 40 /* unlinkat */
-#define __NR_dup 41 /* ok */
-#define __NR_pipe 42 /* ok */
-#define __NR_times 43 /* ok */
-#define __NR_prof 44 /* remove */
-#define __NR_brk 45 /* ok -mmu, nommu specific */
-#define __NR_setgid 46 /* ok */
-#define __NR_getgid 47 /* ok */
-#define __NR_signal 48 /* obsolete -> sys_rt_sigaction */
-#define __NR_geteuid 49 /* ok */
-#define __NR_getegid 50 /* ok */
-#define __NR_acct 51 /* add it and then I can disable it */
-#define __NR_umount2 52 /* remove */
-#define __NR_lock 53 /* remove */
-#define __NR_ioctl 54 /* ok */
-#define __NR_fcntl 55 /* ok -> 64bit version*/
-#define __NR_mpx 56 /* remove */
-#define __NR_setpgid 57 /* ok */
-#define __NR_ulimit 58 /* remove */
-#define __NR_oldolduname 59 /* remove */
-#define __NR_umask 60 /* ok */
-#define __NR_chroot 61 /* ok */
-#define __NR_ustat 62 /* obsolete -> statfs64 */
-#define __NR_dup2 63 /* ok */
-#define __NR_getppid 64 /* ok */
-#define __NR_getpgrp 65 /* obsolete -> sys_getpgid */
-#define __NR_setsid 66 /* ok */
-#define __NR_sigaction 67 /* obsolete -> rt_sigaction */
-#define __NR_sgetmask 68 /* obsolete -> sys_rt_sigprocmask */
-#define __NR_ssetmask 69 /* obsolete ->sys_rt_sigprocmask */
-#define __NR_setreuid 70 /* ok */
-#define __NR_setregid 71 /* ok */
-#define __NR_sigsuspend 72 /* obsolete -> rt_sigsuspend */
-#define __NR_sigpending 73 /* obsolete -> sys_rt_sigpending */
-#define __NR_sethostname 74 /* ok */
-#define __NR_setrlimit 75 /* ok */
-#define __NR_getrlimit 76 /* ok Back compatible 2G limited rlimit */
-#define __NR_getrusage 77 /* ok */
-#define __NR_gettimeofday 78 /* ok */
-#define __NR_settimeofday 79 /* ok */
-#define __NR_getgroups 80 /* ok */
-#define __NR_setgroups 81 /* ok */
-#define __NR_select 82 /* obsolete -> sys_pselect7 */
-#define __NR_symlink 83 /* symlinkat */
-#define __NR_oldlstat 84 /* remove */
-#define __NR_readlink 85 /* obsolete -> sys_readlinkat */
-#define __NR_uselib 86 /* remove */
-#define __NR_swapon 87 /* ok */
-#define __NR_reboot 88 /* ok */
-#define __NR_readdir 89 /* remove ? */
-#define __NR_mmap 90 /* obsolete -> sys_mmap2 */
-#define __NR_munmap 91 /* ok - mmu and nommu */
-#define __NR_truncate 92 /* ok or truncate64 */
-#define __NR_ftruncate 93 /* ok or ftruncate64 */
-#define __NR_fchmod 94 /* ok */
-#define __NR_fchown 95 /* ok */
-#define __NR_getpriority 96 /* ok */
-#define __NR_setpriority 97 /* ok */
-#define __NR_profil 98 /* remove */
-#define __NR_statfs 99 /* ok or statfs64 */
-#define __NR_fstatfs 100 /* ok or fstatfs64 */
-#define __NR_ioperm 101 /* remove */
-#define __NR_socketcall 102 /* remove */
-#define __NR_syslog 103 /* ok */
-#define __NR_setitimer 104 /* ok */
-#define __NR_getitimer 105 /* ok */
-#define __NR_stat 106 /* remove */
-#define __NR_lstat 107 /* remove */
-#define __NR_fstat 108 /* remove */
-#define __NR_olduname 109 /* remove */
-#define __NR_iopl 110 /* remove */
-#define __NR_vhangup 111 /* ok */
-#define __NR_idle 112 /* remove */
-#define __NR_vm86old 113 /* remove */
-#define __NR_wait4 114 /* obsolete -> waitid */
-#define __NR_swapoff 115 /* ok */
-#define __NR_sysinfo 116 /* ok */
-#define __NR_ipc 117 /* remove - direct call */
-#define __NR_fsync 118 /* ok */
-#define __NR_sigreturn 119 /* obsolete -> sys_rt_sigreturn */
-#define __NR_clone 120 /* ok */
-#define __NR_setdomainname 121 /* ok */
-#define __NR_uname 122 /* remove */
-#define __NR_modify_ldt 123 /* remove */
-#define __NR_adjtimex 124 /* ok */
-#define __NR_mprotect 125 /* remove */
-#define __NR_sigprocmask 126 /* obsolete -> sys_rt_sigprocmask */
-#define __NR_create_module 127 /* remove */
-#define __NR_init_module 128 /* ok */
-#define __NR_delete_module 129 /* ok */
-#define __NR_get_kernel_syms 130 /* remove */
-#define __NR_quotactl 131 /* ok */
-#define __NR_getpgid 132 /* ok */
-#define __NR_fchdir 133 /* ok */
-#define __NR_bdflush 134 /* remove */
-#define __NR_sysfs 135 /* needed for busybox */
-#define __NR_personality 136 /* ok */
-#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
-#define __NR_setfsuid 138 /* ok */
-#define __NR_setfsgid 139 /* ok */
-#define __NR__llseek 140 /* remove only lseek */
-#define __NR_getdents 141 /* ok or getdents64 */
-#define __NR__newselect 142 /* remove */
-#define __NR_flock 143 /* ok */
-#define __NR_msync 144 /* remove */
-#define __NR_readv 145 /* ok */
-#define __NR_writev 146 /* ok */
-#define __NR_getsid 147 /* ok */
-#define __NR_fdatasync 148 /* ok */
-#define __NR__sysctl 149 /* remove */
-#define __NR_mlock 150 /* ok - nommu or mmu */
-#define __NR_munlock 151 /* ok - nommu or mmu */
-#define __NR_mlockall 152 /* ok - nommu or mmu */
-#define __NR_munlockall 153 /* ok - nommu or mmu */
-#define __NR_sched_setparam 154 /* ok */
-#define __NR_sched_getparam 155 /* ok */
-#define __NR_sched_setscheduler 156 /* ok */
-#define __NR_sched_getscheduler 157 /* ok */
-#define __NR_sched_yield 158 /* ok */
-#define __NR_sched_get_priority_max 159 /* ok */
-#define __NR_sched_get_priority_min 160 /* ok */
-#define __NR_sched_rr_get_interval 161 /* ok */
-#define __NR_nanosleep 162 /* ok */
-#define __NR_mremap 163 /* ok - nommu or mmu */
-#define __NR_setresuid 164 /* ok */
-#define __NR_getresuid 165 /* ok */
-#define __NR_vm86 166 /* remove */
-#define __NR_query_module 167 /* ok */
-#define __NR_poll 168 /* obsolete -> sys_ppoll */
-#define __NR_nfsservctl 169 /* ok */
-#define __NR_setresgid 170 /* ok */
-#define __NR_getresgid 171 /* ok */
-#define __NR_prctl 172 /* ok */
-#define __NR_rt_sigreturn 173 /* ok */
-#define __NR_rt_sigaction 174 /* ok */
-#define __NR_rt_sigprocmask 175 /* ok */
-#define __NR_rt_sigpending 176 /* ok */
-#define __NR_rt_sigtimedwait 177 /* ok */
-#define __NR_rt_sigqueueinfo 178 /* ok */
-#define __NR_rt_sigsuspend 179 /* ok */
-#define __NR_pread64 180 /* ok */
-#define __NR_pwrite64 181 /* ok */
-#define __NR_chown 182 /* obsolete -> fchownat */
-#define __NR_getcwd 183 /* ok */
-#define __NR_capget 184 /* ok */
-#define __NR_capset 185 /* ok */
-#define __NR_sigaltstack 186 /* remove */
-#define __NR_sendfile 187 /* ok -> exist 64bit version*/
-#define __NR_getpmsg 188 /* remove */
-/* remove - some people actually want streams */
-#define __NR_putpmsg 189
-/* for noMMU - group with clone -> maybe remove */
-#define __NR_vfork 190
-#define __NR_ugetrlimit 191 /* remove - SuS compliant getrlimit */
-#define __NR_mmap2 192 /* ok */
-#define __NR_truncate64 193 /* ok */
-#define __NR_ftruncate64 194 /* ok */
-#define __NR_stat64 195 /* remove _ARCH_WANT_STAT64 */
-#define __NR_lstat64 196 /* remove _ARCH_WANT_STAT64 */
-#define __NR_fstat64 197 /* remove _ARCH_WANT_STAT64 */
-#define __NR_lchown32 198 /* ok - without 32 */
-#define __NR_getuid32 199 /* ok - without 32 */
-#define __NR_getgid32 200 /* ok - without 32 */
-#define __NR_geteuid32 201 /* ok - without 32 */
-#define __NR_getegid32 202 /* ok - without 32 */
-#define __NR_setreuid32 203 /* ok - without 32 */
-#define __NR_setregid32 204 /* ok - without 32 */
-#define __NR_getgroups32 205 /* ok - without 32 */
-#define __NR_setgroups32 206 /* ok - without 32 */
-#define __NR_fchown32 207 /* ok - without 32 */
-#define __NR_setresuid32 208 /* ok - without 32 */
-#define __NR_getresuid32 209 /* ok - without 32 */
-#define __NR_setresgid32 210 /* ok - without 32 */
-#define __NR_getresgid32 211 /* ok - without 32 */
-#define __NR_chown32 212 /* ok - without 32 -obsolete -> fchownat */
-#define __NR_setuid32 213 /* ok - without 32 */
-#define __NR_setgid32 214 /* ok - without 32 */
-#define __NR_setfsuid32 215 /* ok - without 32 */
-#define __NR_setfsgid32 216 /* ok - without 32 */
-#define __NR_pivot_root 217 /* ok */
-#define __NR_mincore 218 /* ok */
-#define __NR_madvise 219 /* ok */
-#define __NR_getdents64 220 /* ok */
-#define __NR_fcntl64 221 /* ok */
-/* 223 is unused */
-#define __NR_gettid 224 /* ok */
-#define __NR_readahead 225 /* ok */
-#define __NR_setxattr 226 /* ok */
-#define __NR_lsetxattr 227 /* ok */
-#define __NR_fsetxattr 228 /* ok */
-#define __NR_getxattr 229 /* ok */
-#define __NR_lgetxattr 230 /* ok */
-#define __NR_fgetxattr 231 /* ok */
-#define __NR_listxattr 232 /* ok */
-#define __NR_llistxattr 233 /* ok */
-#define __NR_flistxattr 234 /* ok */
-#define __NR_removexattr 235 /* ok */
-#define __NR_lremovexattr 236 /* ok */
-#define __NR_fremovexattr 237 /* ok */
-#define __NR_tkill 238 /* ok */
-#define __NR_sendfile64 239 /* ok */
-#define __NR_futex 240 /* ok */
-#define __NR_sched_setaffinity 241 /* ok */
-#define __NR_sched_getaffinity 242 /* ok */
-#define __NR_set_thread_area 243 /* remove */
-#define __NR_get_thread_area 244 /* remove */
-#define __NR_io_setup 245 /* ok */
-#define __NR_io_destroy 246 /* ok */
-#define __NR_io_getevents 247 /* ok */
-#define __NR_io_submit 248 /* ok */
-#define __NR_io_cancel 249 /* ok */
-#define __NR_fadvise64 250 /* remove -> sys_fadvise64_64 */
-/* 251 is available for reuse (was briefly sys_set_zone_reclaim) */
-#define __NR_exit_group 252 /* ok */
-#define __NR_lookup_dcookie 253 /* ok */
-#define __NR_epoll_create 254 /* ok */
-#define __NR_epoll_ctl 255 /* ok */
-#define __NR_epoll_wait 256 /* obsolete -> sys_epoll_pwait */
-#define __NR_remap_file_pages 257 /* only for mmu */
-#define __NR_set_tid_address 258 /* ok */
-#define __NR_timer_create 259 /* ok */
-#define __NR_timer_settime (__NR_timer_create+1) /* 260 */ /* ok */
-#define __NR_timer_gettime (__NR_timer_create+2) /* 261 */ /* ok */
-#define __NR_timer_getoverrun (__NR_timer_create+3) /* 262 */ /* ok */
-#define __NR_timer_delete (__NR_timer_create+4) /* 263 */ /* ok */
-#define __NR_clock_settime (__NR_timer_create+5) /* 264 */ /* ok */
-#define __NR_clock_gettime (__NR_timer_create+6) /* 265 */ /* ok */
-#define __NR_clock_getres (__NR_timer_create+7) /* 266 */ /* ok */
-#define __NR_clock_nanosleep (__NR_timer_create+8) /* 267 */ /* ok */
-#define __NR_statfs64 268 /* ok */
-#define __NR_fstatfs64 269 /* ok */
-#define __NR_tgkill 270 /* ok */
-#define __NR_utimes 271 /* obsolete -> sys_futimesat */
-#define __NR_fadvise64_64 272 /* ok */
-#define __NR_vserver 273 /* ok */
-#define __NR_mbind 274 /* only for mmu */
-#define __NR_get_mempolicy 275 /* only for mmu */
-#define __NR_set_mempolicy 276 /* only for mmu */
-#define __NR_mq_open 277 /* ok */
-#define __NR_mq_unlink (__NR_mq_open+1) /* 278 */ /* ok */
-#define __NR_mq_timedsend (__NR_mq_open+2) /* 279 */ /* ok */
-#define __NR_mq_timedreceive (__NR_mq_open+3) /* 280 */ /* ok */
-#define __NR_mq_notify (__NR_mq_open+4) /* 281 */ /* ok */
-#define __NR_mq_getsetattr (__NR_mq_open+5) /* 282 */ /* ok */
-#define __NR_kexec_load 283 /* ok */
-#define __NR_waitid 284 /* ok */
-/* #define __NR_sys_setaltroot 285 */
-#define __NR_add_key 286 /* ok */
-#define __NR_request_key 287 /* ok */
-#define __NR_keyctl 288 /* ok */
-#define __NR_ioprio_set 289 /* ok */
-#define __NR_ioprio_get 290 /* ok */
-#define __NR_inotify_init 291 /* ok */
-#define __NR_inotify_add_watch 292 /* ok */
-#define __NR_inotify_rm_watch 293 /* ok */
-#define __NR_migrate_pages 294 /* mmu */
-#define __NR_openat 295 /* ok */
-#define __NR_mkdirat 296 /* ok */
-#define __NR_mknodat 297 /* ok */
-#define __NR_fchownat 298 /* ok */
-#define __NR_futimesat 299 /* obsolete -> sys_utimesat */
-#define __NR_fstatat64 300 /* stat64 */
-#define __NR_unlinkat 301 /* ok */
-#define __NR_renameat 302 /* ok */
-#define __NR_linkat 303 /* ok */
-#define __NR_symlinkat 304 /* ok */
-#define __NR_readlinkat 305 /* ok */
-#define __NR_fchmodat 306 /* ok */
-#define __NR_faccessat 307 /* ok */
-#define __NR_pselect6 308 /* obsolete -> sys_pselect7 */
-#define __NR_ppoll 309 /* ok */
-#define __NR_unshare 310 /* ok */
-#define __NR_set_robust_list 311 /* ok */
-#define __NR_get_robust_list 312 /* ok */
-#define __NR_splice 313 /* ok */
-#define __NR_sync_file_range 314 /* ok */
-#define __NR_tee 315 /* ok */
-#define __NR_vmsplice 316 /* ok */
-#define __NR_move_pages 317 /* mmu */
-#define __NR_getcpu 318 /* ok */
-#define __NR_epoll_pwait 319 /* ok */
-#define __NR_utimensat 320 /* ok */
-#define __NR_signalfd 321 /* ok */
-#define __NR_timerfd_create 322 /* ok */
-#define __NR_eventfd 323 /* ok */
-#define __NR_fallocate 324 /* ok */
-#define __NR_semtimedop 325 /* ok - semaphore group */
-#define __NR_timerfd_settime 326 /* ok */
-#define __NR_timerfd_gettime 327 /* ok */
-/* sysv ipc syscalls */
-#define __NR_semctl 328 /* ok */
-#define __NR_semget 329 /* ok */
-#define __NR_semop 330 /* ok */
-#define __NR_msgctl 331 /* ok */
-#define __NR_msgget 332 /* ok */
-#define __NR_msgrcv 333 /* ok */
-#define __NR_msgsnd 334 /* ok */
-#define __NR_shmat 335 /* ok */
-#define __NR_shmctl 336 /* ok */
-#define __NR_shmdt 337 /* ok */
-#define __NR_shmget 338 /* ok */
-
-
-#define __NR_signalfd4 339 /* new */
-#define __NR_eventfd2 340 /* new */
-#define __NR_epoll_create1 341 /* new */
-#define __NR_dup3 342 /* new */
-#define __NR_pipe2 343 /* new */
-#define __NR_inotify_init1 344 /* new */
-#define __NR_socket 345 /* new */
-#define __NR_socketpair 346 /* new */
-#define __NR_bind 347 /* new */
-#define __NR_listen 348 /* new */
-#define __NR_accept 349 /* new */
-#define __NR_connect 350 /* new */
-#define __NR_getsockname 351 /* new */
-#define __NR_getpeername 352 /* new */
-#define __NR_sendto 353 /* new */
-#define __NR_send 354 /* new */
-#define __NR_recvfrom 355 /* new */
-#define __NR_recv 356 /* new */
-#define __NR_setsockopt 357 /* new */
-#define __NR_getsockopt 358 /* new */
-#define __NR_shutdown 359 /* new */
-#define __NR_sendmsg 360 /* new */
-#define __NR_recvmsg 361 /* new */
-#define __NR_accept04 362 /* new */
-#define __NR_preadv 363 /* new */
-#define __NR_pwritev 364 /* new */
-
-#define __NR_syscalls 365
-
-#ifdef __KERNEL__
-#ifndef __ASSEMBLY__
-
-#define __ARCH_WANT_IPC_PARSE_VERSION
-/* #define __ARCH_WANT_OLD_READDIR */
-/* #define __ARCH_WANT_OLD_STAT */
-#define __ARCH_WANT_STAT64
-#define __ARCH_WANT_SYS_ALARM
-#define __ARCH_WANT_SYS_GETHOSTNAME
-#define __ARCH_WANT_SYS_PAUSE
-#define __ARCH_WANT_SYS_SGETMASK
-#define __ARCH_WANT_SYS_SIGNAL
-#define __ARCH_WANT_SYS_TIME
-#define __ARCH_WANT_SYS_UTIME
-#define __ARCH_WANT_SYS_WAITPID
-#define __ARCH_WANT_SYS_SOCKETCALL
-#define __ARCH_WANT_SYS_FADVISE64
-#define __ARCH_WANT_SYS_GETPGRP
-#define __ARCH_WANT_SYS_LLSEEK
-#define __ARCH_WANT_SYS_NICE
-/* #define __ARCH_WANT_SYS_OLD_GETRLIMIT */
-#define __ARCH_WANT_SYS_OLDUMOUNT
-#define __ARCH_WANT_SYS_SIGPENDING
-#define __ARCH_WANT_SYS_SIGPROCMASK
-#define __ARCH_WANT_SYS_RT_SIGACTION
-/* #define __ARCH_WANT_SYS_RT_SIGSUSPEND */
-
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
-
-#endif /* __ASSEMBLY__ */
-#endif /* __KERNEL__ */
-#endif /* _ASM_MICROBLAZE_UNISTD_H */
+#ifndef __MICROBLAZE_UNISTD_H
+#define __MICROBLAZE_UNISTD_H
+
+#define __ARCH_HAVE_MMU
+#define __ARCH_WANT_SYSCALL_NO_AT
+#define __ARCH_WANT_SYSCALL_NO_FLAGS
+#define __ARCH_WANT_SYSCALL_OFF_T
+#define __ARCH_WANT_SYSCALL_DEPRECATED
+
+#endif /* __MICROBLAZE_UNISTD_H */
+
+#include <asm-generic/unistd.h>
+
+#undef __ARCH_WANT_SYS_RT_SIGSUSPEND
diff --git a/arch/microblaze/kernel/Makefile b/arch/microblaze/kernel/Makefile
index f4a5e19..62353a9 100644
--- a/arch/microblaze/kernel/Makefile
+++ b/arch/microblaze/kernel/Makefile
@@ -7,7 +7,7 @@ extra-y := head.o vmlinux.lds
obj-y += exceptions.o \
hw_exception_handler.o init_task.o intc.o irq.o of_device.o \
of_platform.o process.o prom.o prom_parse.o ptrace.o \
- setup.o signal.o sys_microblaze.o timer.o traps.o
+ setup.o signal.o sys_microblaze.o timer.o traps.o syscall_table.o

obj-y += cpu/

diff --git a/arch/microblaze/kernel/entry-nommu.S b/arch/microblaze/kernel/entry-nommu.S
index 1fce6b8..673949b 100644
--- a/arch/microblaze/kernel/entry-nommu.S
+++ b/arch/microblaze/kernel/entry-nommu.S
@@ -551,34 +551,26 @@ no_work_pending:
rtid r14, 0
nop

-sys_vfork_wrapper:
- brid sys_vfork
+ENTRY(sys_vfork)
+ brid microblaze_vfork
addk r5, r1, r0

-sys_clone_wrapper:
- brid sys_clone
+ENTRY(sys_clone)
+ brid microblaze_clone
addk r7, r1, r0

-sys_execve_wrapper:
- brid sys_execve
+ENTRY(sys_execve)
+ brid microblaze_execve
addk r8, r1, r0

-sys_sigreturn_wrapper:
- brid sys_sigreturn
- addk r5, r1, r0
+ENTRY(sys_sigaltstack)
+ brid microblaze_sigaltstack
+ addk r7, r1, r0

-sys_rt_sigreturn_wrapper:
- brid sys_rt_sigreturn
+ENTRY(sys_rt_sigreturn)
+ brid microblaze_rt_sigreturn
addk r5, r1, r0

-sys_sigsuspend_wrapper:
- brid sys_rt_sigsuspend
- addk r6, r1, r0
-
-sys_rt_sigsuspend_wrapper:
- brid sys_rt_sigsuspend
- addk r7, r1, r0
-
/* Interrupt vector table */
.section .init.ivt, "ax"
.org 0x0
@@ -589,8 +581,3 @@ sys_rt_sigsuspend_wrapper:
brai _hw_exception_handler
.org 0x60
brai _debug_exception
-
-.section .rodata,"a"
-#include "syscall_table.S"
-
-syscall_table_size=(.-sys_call_table)
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S
index 91a0e7b..3e96c89 100644
--- a/arch/microblaze/kernel/entry.S
+++ b/arch/microblaze/kernel/entry.S
@@ -1108,9 +1108,3 @@ ENTRY(_break)

.org 0x60
brai TOPHYS(_debug_exception); /* debug trap handler*/
-
-.section .rodata,"a"
-#include "syscall_table.S"
-
-syscall_table_size=(.-sys_call_table)
-
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
index 4c0e652..e663123 100644
--- a/arch/microblaze/kernel/signal.c
+++ b/arch/microblaze/kernel/signal.c
@@ -129,8 +129,8 @@ sys_sigaction(int sig, const struct old_sigaction *act,
return ret;
}

-asmlinkage int
-sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
+asmlinkage long
+microblaze_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
struct pt_regs *regs)
{
return do_sigaltstack(uss, uoss, regs->r1);
@@ -209,7 +209,7 @@ badframe:
return 0;
}

-asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
+asmlinkage long microblaze_rt_sigreturn(struct pt_regs *regs)
{
struct rt_sigframe __user *frame =
(struct rt_sigframe __user *)(regs->r1 + STATE_SAVE_ARG_SPACE);
diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c
index 31905ff..d668518 100644
--- a/arch/microblaze/kernel/sys_microblaze.c
+++ b/arch/microblaze/kernel/sys_microblaze.c
@@ -134,20 +134,20 @@ sys_ipc(uint call, int first, int second, int third, void *ptr, long fifth)
return ret;
}

-asmlinkage int sys_vfork(struct pt_regs *regs)
+asmlinkage int microblaze_vfork(struct pt_regs *regs)
{
return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->r1,
regs, 0, NULL, NULL);
}

-asmlinkage int sys_clone(int flags, unsigned long stack, struct pt_regs *regs)
+asmlinkage int microblaze_clone(int flags, unsigned long stack, struct pt_regs *regs)
{
if (!stack)
stack = regs->r1;
return do_fork(flags, stack, regs, 0, NULL, NULL);
}

-asmlinkage int sys_execve(char __user *filenamei, char __user *__user *argv,
+asmlinkage int microblaze_execve(char __user *filenamei, char __user *__user *argv,
char __user *__user *envp, struct pt_regs *regs)
{
int error;
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S
deleted file mode 100644
index 376d178..0000000
--- a/arch/microblaze/kernel/syscall_table.S
+++ /dev/null
@@ -1,371 +0,0 @@
-ENTRY(sys_call_table)
- .long sys_restart_syscall /* 0 - old "setup()" system call,
- * used for restarting */
- .long sys_exit
-#ifdef CONFIG_MMU
- .long sys_fork_wrapper
-#else
- .long sys_ni_syscall
-#endif
- .long sys_read
- .long sys_write
- .long sys_open /* 5 */
- .long sys_close
- .long sys_waitpid
- .long sys_creat
- .long sys_link
- .long sys_unlink /* 10 */
- .long sys_execve_wrapper
- .long sys_chdir
- .long sys_time
- .long sys_mknod
- .long sys_chmod /* 15 */
- .long sys_lchown
- .long sys_ni_syscall /* old break syscall holder */
- .long sys_ni_syscall /* old stat */
- .long sys_lseek
- .long sys_getpid /* 20 */
- .long sys_mount
- .long sys_oldumount
- .long sys_setuid
- .long sys_getuid
- .long sys_stime /* 25 */
- .long sys_ptrace
- .long sys_alarm
- .long sys_ni_syscall /* oldfstat */
- .long sys_pause
- .long sys_utime /* 30 */
- .long sys_ni_syscall /* old stty syscall holder */
- .long sys_ni_syscall /* old gtty syscall holder */
- .long sys_access
- .long sys_nice
- .long sys_ni_syscall /* 35 - old ftime syscall holder */
- .long sys_sync
- .long sys_kill
- .long sys_rename
- .long sys_mkdir
- .long sys_rmdir /* 40 */
- .long sys_dup
- .long sys_pipe
- .long sys_times
- .long sys_ni_syscall /* old prof syscall holder */
- .long sys_brk /* 45 */
- .long sys_setgid
- .long sys_getgid
- .long sys_signal
- .long sys_geteuid
- .long sys_getegid /* 50 */
- .long sys_acct
- .long sys_umount /* recycled never used phys() */
- .long sys_ni_syscall /* old lock syscall holder */
- .long sys_ioctl
- .long sys_fcntl /* 55 */
- .long sys_ni_syscall /* old mpx syscall holder */
- .long sys_setpgid
- .long sys_ni_syscall /* old ulimit syscall holder */
- .long sys_ni_syscall /* olduname */
- .long sys_umask /* 60 */
- .long sys_chroot
- .long sys_ustat
- .long sys_dup2
- .long sys_getppid
- .long sys_getpgrp /* 65 */
- .long sys_setsid
- .long sys_sigaction
- .long sys_sgetmask
- .long sys_ssetmask
- .long sys_setreuid /* 70 */
- .long sys_setregid
- .long sys_sigsuspend_wrapper
- .long sys_sigpending
- .long sys_sethostname
- .long sys_setrlimit /* 75 */
- .long sys_ni_syscall /* old_getrlimit */
- .long sys_getrusage
- .long sys_gettimeofday
- .long sys_settimeofday
- .long sys_getgroups /* 80 */
- .long sys_setgroups
- .long sys_ni_syscall /* old_select */
- .long sys_symlink
- .long sys_ni_syscall /* oldlstat */
- .long sys_readlink /* 85 */
- .long sys_uselib
- .long sys_swapon
- .long sys_reboot
- .long sys_ni_syscall /* old_readdir */
- .long sys_mmap /* 90 */ /* old_mmap */
- .long sys_munmap
- .long sys_truncate
- .long sys_ftruncate
- .long sys_fchmod
- .long sys_fchown /* 95 */
- .long sys_getpriority
- .long sys_setpriority
- .long sys_ni_syscall /* old profil syscall holder */
- .long sys_statfs
- .long sys_fstatfs /* 100 */
- .long sys_ni_syscall /* ioperm */
- .long sys_socketcall
- .long sys_syslog /* operation with system console */
- .long sys_setitimer
- .long sys_getitimer /* 105 */
- .long sys_newstat
- .long sys_newlstat
- .long sys_newfstat
- .long sys_ni_syscall /* uname */
- .long sys_ni_syscall /* 110 */ /* iopl */
- .long sys_vhangup
- .long sys_ni_syscall /* old "idle" system call */
- .long sys_ni_syscall /* old sys_vm86old */
- .long sys_wait4
- .long sys_swapoff /* 115 */
- .long sys_sysinfo
- .long sys_ipc
- .long sys_fsync
- .long sys_sigreturn_wrapper
- .long sys_clone_wrapper /* 120 */
- .long sys_setdomainname
- .long sys_newuname
- .long sys_ni_syscall /* modify_ldt */
- .long sys_adjtimex
- .long sys_mprotect /* 125: sys_mprotect */
- .long sys_sigprocmask
- .long sys_ni_syscall /* old "create_module" */
- .long sys_init_module
- .long sys_delete_module
- .long sys_ni_syscall /* 130: old "get_kernel_syms" */
- .long sys_quotactl
- .long sys_getpgid
- .long sys_fchdir
- .long sys_bdflush
- .long sys_sysfs /* 135 */
- .long sys_personality
- .long sys_ni_syscall /* reserved for afs_syscall */
- .long sys_setfsuid
- .long sys_setfsgid
- .long sys_llseek /* 140 */
- .long sys_getdents
- .long sys_select
- .long sys_flock
- .long sys_msync
- .long sys_readv /* 145 */
- .long sys_writev
- .long sys_getsid
- .long sys_fdatasync
- .long sys_sysctl
- .long sys_mlock /* 150: sys_mlock */
- .long sys_munlock
- .long sys_mlockall
- .long sys_munlockall
- .long sys_sched_setparam
- .long sys_sched_getparam /* 155 */
- .long sys_sched_setscheduler
- .long sys_sched_getscheduler
- .long sys_sched_yield
- .long sys_sched_get_priority_max
- .long sys_sched_get_priority_min /* 160 */
- .long sys_sched_rr_get_interval
- .long sys_nanosleep
- .long sys_mremap
- .long sys_setresuid
- .long sys_getresuid /* 165 */
- .long sys_ni_syscall /* sys_vm86 */
- .long sys_ni_syscall /* Old sys_query_module */
- .long sys_poll
- .long sys_nfsservctl
- .long sys_setresgid /* 170 */
- .long sys_getresgid
- .long sys_prctl
- .long sys_rt_sigreturn_wrapper
- .long sys_rt_sigaction
- .long sys_rt_sigprocmask /* 175 */
- .long sys_rt_sigpending
- .long sys_rt_sigtimedwait
- .long sys_rt_sigqueueinfo
- .long sys_rt_sigsuspend_wrapper
- .long sys_pread64 /* 180 */
- .long sys_pwrite64
- .long sys_chown
- .long sys_getcwd
- .long sys_capget
- .long sys_capset /* 185 */
- .long sys_ni_syscall /* sigaltstack */
- .long sys_sendfile
- .long sys_ni_syscall /* reserved for streams1 */
- .long sys_ni_syscall /* reserved for streams2 */
- .long sys_vfork_wrapper /* 190 */
- .long sys_getrlimit
- .long sys_mmap2 /* mmap2 */
- .long sys_truncate64
- .long sys_ftruncate64
- .long sys_stat64 /* 195 */
- .long sys_lstat64
- .long sys_fstat64
- .long sys_lchown
- .long sys_getuid
- .long sys_getgid /* 200 */
- .long sys_geteuid
- .long sys_getegid
- .long sys_setreuid
- .long sys_setregid
- .long sys_getgroups /* 205 */
- .long sys_setgroups
- .long sys_fchown
- .long sys_setresuid
- .long sys_getresuid
- .long sys_setresgid /* 210 */
- .long sys_getresgid
- .long sys_chown
- .long sys_setuid
- .long sys_setgid
- .long sys_setfsuid /* 215 */
- .long sys_setfsgid
- .long sys_pivot_root
- .long sys_mincore
- .long sys_madvise
- .long sys_getdents64 /* 220 */
- .long sys_fcntl64
- .long sys_ni_syscall /* reserved for TUX */
- .long sys_ni_syscall
- .long sys_gettid
- .long sys_readahead /* 225 */
- .long sys_setxattr
- .long sys_lsetxattr
- .long sys_fsetxattr
- .long sys_getxattr
- .long sys_lgetxattr /* 230 */
- .long sys_fgetxattr
- .long sys_listxattr
- .long sys_llistxattr
- .long sys_flistxattr
- .long sys_removexattr /* 235 */
- .long sys_lremovexattr
- .long sys_fremovexattr
- .long sys_tkill
- .long sys_sendfile64
- .long sys_futex /* 240 */
- .long sys_sched_setaffinity
- .long sys_sched_getaffinity
- .long sys_ni_syscall /* set_thread_area */
- .long sys_ni_syscall /* get_thread_area */
- .long sys_io_setup /* 245 */
- .long sys_io_destroy
- .long sys_io_getevents
- .long sys_io_submit
- .long sys_io_cancel
- .long sys_fadvise64 /* 250 */
- .long sys_ni_syscall
- .long sys_exit_group
- .long sys_lookup_dcookie
- .long sys_epoll_create
- .long sys_epoll_ctl /* 255 */
- .long sys_epoll_wait
- .long sys_remap_file_pages
- .long sys_set_tid_address
- .long sys_timer_create
- .long sys_timer_settime /* 260 */
- .long sys_timer_gettime
- .long sys_timer_getoverrun
- .long sys_timer_delete
- .long sys_clock_settime
- .long sys_clock_gettime /* 265 */
- .long sys_clock_getres
- .long sys_clock_nanosleep
- .long sys_statfs64
- .long sys_fstatfs64
- .long sys_tgkill /* 270 */
- .long sys_utimes
- .long sys_fadvise64_64
- .long sys_ni_syscall /* sys_vserver */
- .long sys_mbind
- .long sys_get_mempolicy
- .long sys_set_mempolicy
- .long sys_mq_open
- .long sys_mq_unlink
- .long sys_mq_timedsend
- .long sys_mq_timedreceive /* 280 */
- .long sys_mq_notify
- .long sys_mq_getsetattr
- .long sys_kexec_load
- .long sys_waitid
- .long sys_ni_syscall /* 285 */ /* available */
- .long sys_add_key
- .long sys_request_key
- .long sys_keyctl
- .long sys_ioprio_set
- .long sys_ioprio_get /* 290 */
- .long sys_inotify_init
- .long sys_inotify_add_watch
- .long sys_inotify_rm_watch
- .long sys_ni_syscall /* sys_migrate_pages */
- .long sys_openat /* 295 */
- .long sys_mkdirat
- .long sys_mknodat
- .long sys_fchownat
- .long sys_ni_syscall
- .long sys_fstatat64 /* 300 */
- .long sys_unlinkat
- .long sys_renameat
- .long sys_linkat
- .long sys_symlinkat
- .long sys_readlinkat /* 305 */
- .long sys_fchmodat
- .long sys_faccessat
- .long sys_ni_syscall /* pselect6 */
- .long sys_ni_syscall /* sys_ppoll */
- .long sys_unshare /* 310 */
- .long sys_set_robust_list
- .long sys_get_robust_list
- .long sys_splice
- .long sys_sync_file_range
- .long sys_tee /* 315 */
- .long sys_vmsplice
- .long sys_move_pages
- .long sys_getcpu
- .long sys_epoll_pwait
- .long sys_utimensat /* 320 */
- .long sys_signalfd
- .long sys_timerfd_create
- .long sys_eventfd
- .long sys_fallocate
- .long sys_semtimedop /* 325 */
- .long sys_timerfd_settime
- .long sys_timerfd_gettime
- .long sys_semctl
- .long sys_semget
- .long sys_semop /* 330 */
- .long sys_msgctl
- .long sys_msgget
- .long sys_msgrcv
- .long sys_msgsnd
- .long sys_shmat /* 335 */
- .long sys_shmctl
- .long sys_shmdt
- .long sys_shmget
- .long sys_signalfd4 /* new syscall */
- .long sys_eventfd2 /* 340 */
- .long sys_epoll_create1
- .long sys_dup3
- .long sys_pipe2
- .long sys_inotify_init1
- .long sys_socket /* 345 */
- .long sys_socketpair
- .long sys_bind
- .long sys_listen
- .long sys_accept
- .long sys_connect /* 350 */
- .long sys_getsockname
- .long sys_getpeername
- .long sys_sendto
- .long sys_send
- .long sys_recvfrom /* 355 */
- .long sys_recv
- .long sys_setsockopt
- .long sys_getsockopt
- .long sys_shutdown
- .long sys_sendmsg /* 360 */
- .long sys_recvmsg
- .long sys_ni_syscall
- .long sys_ni_syscall
- .long sys_ni_syscall
diff --git a/arch/microblaze/kernel/syscall_table.c b/arch/microblaze/kernel/syscall_table.c
new file mode 100644
index 0000000..287369b
--- /dev/null
+++ b/arch/microblaze/kernel/syscall_table.c
@@ -0,0 +1,12 @@
+#include <linux/syscalls.h>
+#include <linux/signal.h>
+#include <linux/unistd.h>
+
+#include <asm/syscalls.h>
+
+#undef __SYSCALL
+#define __SYSCALL(nr, call) [nr] = (call),
+
+void *sys_call_table[__NR_syscalls] = {
+#include <asm/unistd.h>
+};
--
1.6.3.1

2009-06-18 22:31:33

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 01/11] ipc: use __ARCH_WANT_IPC_PARSE_VERSION in ipc/util.h

On Thursday 18 June 2009, Arnd Bergmann wrote:
> The definition of ipc_parse_version depends on
> __ARCH_WANT_IPC_PARSE_VERSION, but the header file
> declares it conditionally based on the architecture.
>
> Use the macro consistently to make it easier to add
> new architectures.
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Acked-by: Serge Hallyn <[email protected]>

Michal, you can ignore this one now, it just went in.

Arnd <><

2009-06-20 01:13:06

by Johannes Weiner

[permalink] [raw]
Subject: [patch] ipc: unbreak 32-bit shmctl/semctl/msgctl

31a985f "ipc: use __ARCH_WANT_IPC_PARSE_VERSION in ipc/util.h" would
choose the implementation of ipc_parse_version() based on a symbol
defined in <asm/unistd.h>.

But it failed to also include this header and thus broke
IPC_64-passing 32-bit userspace because the flag wasn't masked out
properly anymore and the command not understood.

Include <linux/unistd.h> to give the architecture a chance to ask for
the no-no-op ipc_parse_version().

Signed-off-by: Johannes Weiner <[email protected]>
---
ipc/util.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/ipc/util.h b/ipc/util.h
index ab3ebf2..764b51a 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -10,6 +10,7 @@
#ifndef _IPC_UTIL_H
#define _IPC_UTIL_H

+#include <linux/unistd.h>
#include <linux/err.h>

#define SEQ_MULTIPLIER (IPCMNI)
--
1.6.3.2

2009-06-20 08:21:35

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [patch] ipc: unbreak 32-bit shmctl/semctl/msgctl

On Saturday 20 June 2009 01:09:39 am Johannes Weiner wrote:
> 31a985f "ipc: use __ARCH_WANT_IPC_PARSE_VERSION in ipc/util.h" would
> choose the implementation of ipc_parse_version() based on a symbol
> defined in <asm/unistd.h>.
>
> But it failed to also include this header and thus broke
> IPC_64-passing 32-bit userspace because the flag wasn't masked out
> properly anymore and the command not understood.
>
> Include <linux/unistd.h> to give the architecture a chance to ask for
> the no-no-op ipc_parse_version().
>
> Signed-off-by: Johannes Weiner <[email protected]>

Acked-by: Arnd Bergmann <[email protected]>

Obviously fixes the bug I introduced, sorry for the trouble and thanks
for fixing it!

2009-06-21 19:04:58

by Johannes Weiner

[permalink] [raw]
Subject: Re: [patch] ipc: unbreak 32-bit shmctl/semctl/msgctl

On Sat, Jun 20, 2009 at 08:20:56AM +0000, Arnd Bergmann wrote:
> On Saturday 20 June 2009 01:09:39 am Johannes Weiner wrote:
> > 31a985f "ipc: use __ARCH_WANT_IPC_PARSE_VERSION in ipc/util.h" would
> > choose the implementation of ipc_parse_version() based on a symbol
> > defined in <asm/unistd.h>.
> >
> > But it failed to also include this header and thus broke
> > IPC_64-passing 32-bit userspace because the flag wasn't masked out
> > properly anymore and the command not understood.
> >
> > Include <linux/unistd.h> to give the architecture a chance to ask for
> > the no-no-op ipc_parse_version().
> >
> > Signed-off-by: Johannes Weiner <[email protected]>
>
> Acked-by: Arnd Bergmann <[email protected]>
>
> Obviously fixes the bug I introduced, sorry for the trouble and thanks
> for fixing it!

Linus, could you apply this patch?

OTOH, breaking mplayer on x86_32 is probably the way to push 64-bit as
the driving factor in adoption of new technology seems to be porn.

Hannes

---
From: Johannes Weiner <[email protected]>
Date: Sat, 20 Jun 2009 02:23:29 +0200
Subject: [PATCH] ipc: unbreak 32-bit shmctl/semctl/msgctl

31a985f "ipc: use __ARCH_WANT_IPC_PARSE_VERSION in ipc/util.h" would
choose the implementation of ipc_parse_version() based on a symbol
defined in <asm/unistd.h>.

But it failed to also include this header and thus broke
IPC_64-passing 32-bit userspace because the flag wasn't masked out
properly anymore and the command not understood.

Include <linux/unistd.h> to give the architecture a chance to ask for
the no-no-op ipc_parse_version().

Signed-off-by: Johannes Weiner <[email protected]>
Acked-by: Arnd Bergmann <[email protected]>
---
ipc/util.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/ipc/util.h b/ipc/util.h
index ab3ebf2..764b51a 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -10,6 +10,7 @@
#ifndef _IPC_UTIL_H
#define _IPC_UTIL_H

+#include <linux/unistd.h>
#include <linux/err.h>

#define SEQ_MULTIPLIER (IPCMNI)
--
1.6.3.2

2009-07-01 11:20:27

by Michal Simek

[permalink] [raw]
Subject: Re: [microblaze-uclinux] [PATCH 10/11] microblaze: use generic system.h

Hi,

this patch can't be applied because generic implementation expect pointer to task struct
but microblaze low level code expect thread_info. I have one patch for MMU kernel which fixed it
but I don't have it for noMMU kernel.

Thanks,
Michal


Arnd Bergmann wrote:
> From: Remis Lima Baima <[email protected]>
>
> Parts of the microblaze system.h can be removed by
> falling back to the asm-generic version.
>
> Signed-off-by: Remis Lima Baima <[email protected]>
> Signed-off-by: Arnd Bergmann <[email protected]>
> ---
> arch/microblaze/include/asm/cmpxchg-local.h | 1 +
> arch/microblaze/include/asm/irqflags.h | 2 +-
> arch/microblaze/include/asm/system.h | 124 +++++++--------------------
> 3 files changed, 32 insertions(+), 95 deletions(-)
> create mode 100644 arch/microblaze/include/asm/cmpxchg-local.h
> rewrite arch/microblaze/include/asm/system.h (67%)
>
> diff --git a/arch/microblaze/include/asm/cmpxchg-local.h b/arch/microblaze/include/asm/cmpxchg-local.h
> new file mode 100644
> index 0000000..d3358a3
> --- /dev/null
> +++ b/arch/microblaze/include/asm/cmpxchg-local.h
> @@ -0,0 +1 @@
> +#include <asm-generic/cmpxchg-local.h>
> diff --git a/arch/microblaze/include/asm/irqflags.h b/arch/microblaze/include/asm/irqflags.h
> index dea6564..a6dbdee 100644
> --- a/arch/microblaze/include/asm/irqflags.h
> +++ b/arch/microblaze/include/asm/irqflags.h
> @@ -9,7 +9,7 @@
> #ifndef _ASM_MICROBLAZE_IRQFLAGS_H
> #define _ASM_MICROBLAZE_IRQFLAGS_H
>
> -#include <linux/irqflags.h>
> +#include <asm/registers.h>
>
> # if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
>
> diff --git a/arch/microblaze/include/asm/system.h b/arch/microblaze/include/asm/system.h
> dissimilarity index 67%
> index b1ed615..a26ef8e 100644
> --- a/arch/microblaze/include/asm/system.h
> +++ b/arch/microblaze/include/asm/system.h
> @@ -1,94 +1,30 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_SYSTEM_H
> -#define _ASM_MICROBLAZE_SYSTEM_H
> -
> -#include <asm/registers.h>
> -#include <asm/setup.h>
> -#include <asm/irqflags.h>
> -
> -#include <asm-generic/cmpxchg.h>
> -#include <asm-generic/cmpxchg-local.h>
> -
> -struct task_struct;
> -struct thread_info;
> -
> -extern struct task_struct *_switch_to(struct thread_info *prev,
> - struct thread_info *next);
> -
> -#define switch_to(prev, next, last) \
> - do { \
> - (last) = _switch_to(task_thread_info(prev), \
> - task_thread_info(next)); \
> - } while (0)
> -
> -#define smp_read_barrier_depends() do {} while (0)
> -#define read_barrier_depends() do {} while (0)
> -
> -#define nop() asm volatile ("nop")
> -#define mb() barrier()
> -#define rmb() mb()
> -#define wmb() mb()
> -#define set_mb(var, value) do { var = value; mb(); } while (0)
> -#define set_wmb(var, value) do { var = value; wmb(); } while (0)
> -
> -#define smp_mb() mb()
> -#define smp_rmb() rmb()
> -#define smp_wmb() wmb()
> -
> -void show_trace(struct task_struct *task, unsigned long *stack);
> -void __bad_xchg(volatile void *ptr, int size);
> -
> -static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
> - int size)
> -{
> - unsigned long ret;
> - unsigned long flags;
> -
> - switch (size) {
> - case 1:
> - local_irq_save(flags);
> - ret = *(volatile unsigned char *)ptr;
> - *(volatile unsigned char *)ptr = x;
> - local_irq_restore(flags);
> - break;
> -
> - case 4:
> - local_irq_save(flags);
> - ret = *(volatile unsigned long *)ptr;
> - *(volatile unsigned long *)ptr = x;
> - local_irq_restore(flags);
> - break;
> - default:
> - __bad_xchg(ptr, size), ret = 0;
> - break;
> - }
> -
> - return ret;
> -}
> -
> -void disable_hlt(void);
> -void enable_hlt(void);
> -void default_idle(void);
> -
> -#define xchg(ptr, x) \
> - ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
> -
> -void free_init_pages(char *what, unsigned long begin, unsigned long end);
> -void free_initmem(void);
> -extern char *klimit;
> -extern void ret_from_fork(void);
> -
> -#ifdef CONFIG_DEBUG_FS
> -extern struct dentry *of_debugfs_root;
> -#endif
> -
> -#define arch_align_stack(x) (x)
> -
> -#endif /* _ASM_MICROBLAZE_SYSTEM_H */
> +/*
> + * Copyright (C) 2006 Atmark Techno, Inc.
> + *
> + * This file is subject to the terms and conditions of the GNU General Public
> + * License. See the file "COPYING" in the main directory of this archive
> + * for more details.
> + */
> +#ifndef _ASM_MICROBLAZE_SYSTEM_H
> +#define _ASM_MICROBLAZE_SYSTEM_H
> +
> +#define __switch_to _switch_to
> +
> +#include <asm/irqflags.h>
> +#include <asm-generic/system.h>
> +
> +#ifdef CONFIG_DEBUG_FS
> +extern struct dentry *of_debugfs_root;
> +#endif
> +
> +void show_trace(struct task_struct *task, unsigned long *stack);
> +void disable_hlt(void);
> +void enable_hlt(void);
> +void default_idle(void);
> +void free_init_pages(char *what, unsigned long begin, unsigned long end);
> +void free_initmem(void);
> +
> +extern char *klimit;
> +extern void ret_from_fork(void);
> +
> +#endif /* _ASM_MICROBLAZE_SYSTEM_H */

--
Michal Simek, Ing. (M.Eng)
w: http://www.monstr.eu p: +42-0-721842854

2009-07-01 11:34:55

by Michal Simek

[permalink] [raw]
Subject: Re: [microblaze-uclinux] [PATCH 03/11] microblaze: fall back on generic header files for the ABI

Added to next branch for test.

I had to do one change.
Microblaze needs __kernel_mode_t as short.

+ I removed __kernel_size_t and I'll recompile toolchain
for removing warning messages

Thanks,
Michal

Arnd Bergmann wrote:
> Almost all of the ABI relevant header files now have generic
> versions, so use those now in order to reduce the amount
> of architecture specific code.
>
> Signed-off-by: Arnd Bergmann <[email protected]>
> ---
> arch/microblaze/include/asm/ioctls.h | 92 +-------------
> arch/microblaze/include/asm/ipcbuf.h | 37 +-----
> arch/microblaze/include/asm/mman.h | 26 +----
> arch/microblaze/include/asm/msgbuf.h | 32 +-----
> arch/microblaze/include/asm/param.h | 31 +-----
> arch/microblaze/include/asm/posix_types.h | 94 +++----------
> arch/microblaze/include/asm/sembuf.h | 35 +-----
> arch/microblaze/include/asm/shmbuf.h | 43 +------
> arch/microblaze/include/asm/siginfo.h | 14 --
> arch/microblaze/include/asm/socket.h | 70 +----------
> arch/microblaze/include/asm/sockios.h | 24 +----
> arch/microblaze/include/asm/stat.h | 69 +----------
> arch/microblaze/include/asm/swab.h | 9 +-
> arch/microblaze/include/asm/termbits.h | 204 +----------------------------
> arch/microblaze/include/asm/termios.h | 89 +-------------
> arch/microblaze/include/asm/types.h | 39 +------
> arch/microblaze/include/asm/ucontext.h | 23 +---
> 17 files changed, 36 insertions(+), 895 deletions(-)
> rewrite arch/microblaze/include/asm/ioctls.h (100%)
> rewrite arch/microblaze/include/asm/ipcbuf.h (100%)
> rewrite arch/microblaze/include/asm/mman.h (96%)
> rewrite arch/microblaze/include/asm/msgbuf.h (100%)
> rewrite arch/microblaze/include/asm/param.h (100%)
> rewrite arch/microblaze/include/asm/posix_types.h (96%)
> rewrite arch/microblaze/include/asm/sembuf.h (100%)
> rewrite arch/microblaze/include/asm/shmbuf.h (100%)
> rewrite arch/microblaze/include/asm/socket.h (100%)
> rewrite arch/microblaze/include/asm/sockios.h (100%)
> rewrite arch/microblaze/include/asm/stat.h (100%)
> rewrite arch/microblaze/include/asm/termbits.h (100%)
> rewrite arch/microblaze/include/asm/termios.h (100%)
> rewrite arch/microblaze/include/asm/types.h (100%)
> rewrite arch/microblaze/include/asm/ucontext.h (100%)
>
> diff --git a/arch/microblaze/include/asm/ioctls.h b/arch/microblaze/include/asm/ioctls.h
> dissimilarity index 100%
> index 03582b2..ec34c76 100644
> --- a/arch/microblaze/include/asm/ioctls.h
> +++ b/arch/microblaze/include/asm/ioctls.h
> @@ -1,91 +1 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_IOCTLS_H
> -#define _ASM_MICROBLAZE_IOCTLS_H
> -
> -#include <linux/ioctl.h>
> -
> -/* 0x54 is just a magic number to make these relatively unique ('T') */
> -
> -#define TCGETS 0x5401
> -#define TCSETS 0x5402
> -#define TCSETSW 0x5403
> -#define TCSETSF 0x5404
> -#define TCGETA 0x5405
> -#define TCSETA 0x5406
> -#define TCSETAW 0x5407
> -#define TCSETAF 0x5408
> -#define TCSBRK 0x5409
> -#define TCXONC 0x540A
> -#define TCFLSH 0x540B
> -#define TIOCEXCL 0x540C
> -#define TIOCNXCL 0x540D
> -#define TIOCSCTTY 0x540E
> -#define TIOCGPGRP 0x540F
> -#define TIOCSPGRP 0x5410
> -#define TIOCOUTQ 0x5411
> -#define TIOCSTI 0x5412
> -#define TIOCGWINSZ 0x5413
> -#define TIOCSWINSZ 0x5414
> -#define TIOCMGET 0x5415
> -#define TIOCMBIS 0x5416
> -#define TIOCMBIC 0x5417
> -#define TIOCMSET 0x5418
> -#define TIOCGSOFTCAR 0x5419
> -#define TIOCSSOFTCAR 0x541A
> -#define FIONREAD 0x541B
> -#define TIOCINQ FIONREAD
> -#define TIOCLINUX 0x541C
> -#define TIOCCONS 0x541D
> -#define TIOCGSERIAL 0x541E
> -#define TIOCSSERIAL 0x541F
> -#define TIOCPKT 0x5420
> -#define FIONBIO 0x5421
> -#define TIOCNOTTY 0x5422
> -#define TIOCSETD 0x5423
> -#define TIOCGETD 0x5424
> -#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
> -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */
> -#define TIOCSBRK 0x5427 /* BSD compatibility */
> -#define TIOCCBRK 0x5428 /* BSD compatibility */
> -#define TIOCGSID 0x5429 /* Return the session ID of FD */
> -/* Get Pty Number (of pty-mux device) */
> -#define TIOCGPTN _IOR('T', 0x30, unsigned int)
> -#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
> -
> -#define FIONCLEX 0x5450 /* these numbers need to be adjusted. */
> -#define FIOCLEX 0x5451
> -#define FIOASYNC 0x5452
> -#define TIOCSERCONFIG 0x5453
> -#define TIOCSERGWILD 0x5454
> -#define TIOCSERSWILD 0x5455
> -#define TIOCGLCKTRMIOS 0x5456
> -#define TIOCSLCKTRMIOS 0x5457
> -#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
> -#define TIOCSERGETLSR 0x5459 /* Get line status register */
> -#define TIOCSERGETMULTI 0x545A /* Get multiport config */
> -#define TIOCSERSETMULTI 0x545B /* Set multiport config */
> -
> -#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
> -#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
> -
> -#define FIOQSIZE 0x545E
> -
> -/* Used for packet mode */
> -#define TIOCPKT_DATA 0
> -#define TIOCPKT_FLUSHREAD 1
> -#define TIOCPKT_FLUSHWRITE 2
> -#define TIOCPKT_STOP 4
> -#define TIOCPKT_START 8
> -#define TIOCPKT_NOSTOP 16
> -#define TIOCPKT_DOSTOP 32
> -
> -#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
> -
> -#endif /* _ASM_MICROBLAZE_IOCTLS_H */
> +#include <asm-generic/ioctls.h>
> diff --git a/arch/microblaze/include/asm/ipcbuf.h b/arch/microblaze/include/asm/ipcbuf.h
> dissimilarity index 100%
> index b056fa4..84c7e51 100644
> --- a/arch/microblaze/include/asm/ipcbuf.h
> +++ b/arch/microblaze/include/asm/ipcbuf.h
> @@ -1,36 +1 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_IPCBUF_H
> -#define _ASM_MICROBLAZE_IPCBUF_H
> -
> -/*
> - * The user_ipc_perm structure for microblaze architecture.
> - * Note extra padding because this structure is passed back and forth
> - * between kernel and user space.
> - *
> - * Pad space is left for:
> - * - 32-bit mode_t and seq
> - * - 2 miscellaneous 32-bit values
> - */
> -
> -struct ipc64_perm {
> - __kernel_key_t key;
> - __kernel_uid32_t uid;
> - __kernel_gid32_t gid;
> - __kernel_uid32_t cuid;
> - __kernel_gid32_t cgid;
> - __kernel_mode_t mode;
> - unsigned short __pad1;
> - unsigned short seq;
> - unsigned short __pad2;
> - unsigned long __unused1;
> - unsigned long __unused2;
> -};
> -
> -#endif /* _ASM_MICROBLAZE_IPCBUF_H */
> +#include <asm-generic/ipcbuf.h>
> diff --git a/arch/microblaze/include/asm/mman.h b/arch/microblaze/include/asm/mman.h
> dissimilarity index 96%
> index 4914b13..8eebf89 100644
> --- a/arch/microblaze/include/asm/mman.h
> +++ b/arch/microblaze/include/asm/mman.h
> @@ -1,25 +1 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_MMAN_H
> -#define _ASM_MICROBLAZE_MMAN_H
> -
> -#include <asm-generic/mman.h>
> -
> -#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 /* pages are locked */
> -#define MAP_NORESERVE 0x4000 /* don't check for reservations */
> -#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
> -#define MAP_NONBLOCK 0x10000 /* do not block on IO */
> -
> -#define MCL_CURRENT 1 /* lock all current mappings */
> -#define MCL_FUTURE 2 /* lock all future mappings */
> -
> -#endif /* _ASM_MICROBLAZE_MMAN_H */
> +#include <asm-generic/mman.h>
> diff --git a/arch/microblaze/include/asm/msgbuf.h b/arch/microblaze/include/asm/msgbuf.h
> dissimilarity index 100%
> index 09dd970..809134c 100644
> --- a/arch/microblaze/include/asm/msgbuf.h
> +++ b/arch/microblaze/include/asm/msgbuf.h
> @@ -1,31 +1 @@
> -#ifndef _ASM_MICROBLAZE_MSGBUF_H
> -#define _ASM_MICROBLAZE_MSGBUF_H
> -
> -/*
> - * The msqid64_ds structure for microblaze architecture.
> - * Note extra padding because this structure is passed back and forth
> - * between kernel and user space.
> - *
> - * Pad space is left for:
> - * - 64-bit time_t to solve y2038 problem
> - * - 2 miscellaneous 32-bit values
> - */
> -
> -struct msqid64_ds {
> - struct ipc64_perm msg_perm;
> - __kernel_time_t msg_stime; /* last msgsnd time */
> - unsigned long __unused1;
> - __kernel_time_t msg_rtime; /* last msgrcv time */
> - unsigned long __unused2;
> - __kernel_time_t msg_ctime; /* last change time */
> - unsigned long __unused3;
> - unsigned long msg_cbytes; /* current number of bytes on queue */
> - unsigned long msg_qnum; /* number of messages in queue */
> - unsigned long msg_qbytes; /* max number of bytes on queue */
> - __kernel_pid_t msg_lspid; /* pid of last msgsnd */
> - __kernel_pid_t msg_lrpid; /* last receive pid */
> - unsigned long __unused4;
> - unsigned long __unused5;
> -};
> -
> -#endif /* _ASM_MICROBLAZE_MSGBUF_H */
> +#include <asm-generic/msgbuf.h>
> diff --git a/arch/microblaze/include/asm/param.h b/arch/microblaze/include/asm/param.h
> dissimilarity index 100%
> index 8c538a4..965d454 100644
> --- a/arch/microblaze/include/asm/param.h
> +++ b/arch/microblaze/include/asm/param.h
> @@ -1,30 +1 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_PARAM_H
> -#define _ASM_MICROBLAZE_PARAM_H
> -
> -#ifdef __KERNEL__
> -#define HZ CONFIG_HZ /* internal kernel timer frequency */
> -#define USER_HZ 100 /* for user interfaces in "ticks" */
> -#define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */
> -#endif /* __KERNEL__ */
> -
> -#ifndef HZ
> -#define HZ 100
> -#endif
> -
> -#define EXEC_PAGESIZE 4096
> -
> -#ifndef NOGROUP
> -#define NOGROUP (-1)
> -#endif
> -
> -#define MAXHOSTNAMELEN 64 /* max length of hostname */
> -
> -#endif /* _ASM_MICROBLAZE_PARAM_H */
> +#include <asm-generic/param.h>
> diff --git a/arch/microblaze/include/asm/posix_types.h b/arch/microblaze/include/asm/posix_types.h
> dissimilarity index 96%
> index 8c758b2..e890d6c 100644
> --- a/arch/microblaze/include/asm/posix_types.h
> +++ b/arch/microblaze/include/asm/posix_types.h
> @@ -1,73 +1,21 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_POSIX_TYPES_H
> -#define _ASM_MICROBLAZE_POSIX_TYPES_H
> -
> -/*
> - * This file is generally used by user-level software, so you need to
> - * be a little careful about namespace pollution etc. Also, we cannot
> - * assume GCC is being used.
> - */
> -
> -typedef unsigned long __kernel_ino_t;
> -typedef unsigned short __kernel_mode_t;
> -typedef unsigned int __kernel_nlink_t;
> -typedef long __kernel_off_t;
> -typedef int __kernel_pid_t;
> -typedef unsigned int __kernel_ipc_pid_t;
> -typedef unsigned int __kernel_uid_t;
> -typedef unsigned int __kernel_gid_t;
> -typedef unsigned long __kernel_size_t;
> -typedef long __kernel_ssize_t;
> -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;
> -typedef unsigned short __kernel_gid16_t;
> -typedef unsigned int __kernel_uid32_t;
> -typedef unsigned int __kernel_gid32_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 {
> -#if defined(__KERNEL__) || defined(__USE_ALL)
> - int val[2];
> -#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
> - int __val[2];
> -#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
> -} __kernel_fsid_t;
> -
> -#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
> -
> -#undef __FD_SET
> -#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
> -
> -#undef __FD_CLR
> -#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
> -
> -#undef __FD_ISSET
> -#define __FD_ISSET(d, set) (!!((set)->fds_bits[__FDELT(d)] & __FDMASK(d)))
> -
> -#undef __FD_ZERO
> -#define __FD_ZERO(fdsetp) (memset(fdsetp, 0, sizeof(*(fd_set *)fdsetp)))
> -
> -#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
> -
> -#endif /* _ASM_MICROBLAZE_POSIX_TYPES_H */
> +#ifndef __ASM_MICRBLAZE_POSIX_TYPES_H
> +#define __ASM_MICRBLAZE_POSIX_TYPES_H
> +
> +/*
> + * Our tool chain uses 'unsigned long' for size_t,
> + * so the kernel should too. If there is a chance
> + * to update the tool chain, that should probably
> + * be done so it does the same as most of the
> + * other architectures.
> + *
> + * Overriding this mostly has the effect of
> + * avoiding compiler warnings.
> + */
> +typedef unsigned long __kernel_size_t;
> +typedef long __kernel_ssize_t;
> +typedef long __kernel_ptrdiff_t;
> +#define __kernel_size_t __kernel_size_t
> +
> +#include <asm-generic/posix_types.h>
> +
> +#endif /* __ASM_MICRBLAZE_POSIX_TYPES_H */
> diff --git a/arch/microblaze/include/asm/sembuf.h b/arch/microblaze/include/asm/sembuf.h
> dissimilarity index 100%
> index b804ed7..7673b83 100644
> --- a/arch/microblaze/include/asm/sembuf.h
> +++ b/arch/microblaze/include/asm/sembuf.h
> @@ -1,34 +1 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_SEMBUF_H
> -#define _ASM_MICROBLAZE_SEMBUF_H
> -
> -/*
> - * The semid64_ds structure for microblaze architecture.
> - * Note extra padding because this structure is passed back and forth
> - * between kernel and user space.
> - *
> - * Pad space is left for:
> - * - 64-bit time_t to solve y2038 problem
> - * - 2 miscellaneous 32-bit values
> - */
> -
> -struct semid64_ds {
> - struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
> - __kernel_time_t sem_otime; /* last semop time */
> - unsigned long __unused1;
> - __kernel_time_t sem_ctime; /* last change time */
> - unsigned long __unused2;
> - unsigned long sem_nsems; /* no. of semaphores in array */
> - unsigned long __unused3;
> - unsigned long __unused4;
> -};
> -
> -
> -#endif /* _ASM_MICROBLAZE_SEMBUF_H */
> +#include <asm-generic/sembuf.h>
> diff --git a/arch/microblaze/include/asm/shmbuf.h b/arch/microblaze/include/asm/shmbuf.h
> dissimilarity index 100%
> index f829c58..83c05fc 100644
> --- a/arch/microblaze/include/asm/shmbuf.h
> +++ b/arch/microblaze/include/asm/shmbuf.h
> @@ -1,42 +1 @@
> -#ifndef _ASM_MICROBLAZE_SHMBUF_H
> -#define _ASM_MICROBLAZE_SHMBUF_H
> -
> -/*
> - * The shmid64_ds structure for microblaze architecture.
> - * Note extra padding because this structure is passed back and forth
> - * between kernel and user space.
> - *
> - * Pad space is left for:
> - * - 64-bit time_t to solve y2038 problem
> - * - 2 miscellaneous 32-bit values
> - */
> -
> -struct shmid64_ds {
> - struct ipc64_perm shm_perm; /* operation perms */
> - size_t shm_segsz; /* size of segment (bytes) */
> - __kernel_time_t shm_atime; /* last attach time */
> - unsigned long __unused1;
> - __kernel_time_t shm_dtime; /* last detach time */
> - unsigned long __unused2;
> - __kernel_time_t shm_ctime; /* last change time */
> - unsigned long __unused3;
> - __kernel_pid_t shm_cpid; /* pid of creator */
> - __kernel_pid_t shm_lpid; /* pid of last operator */
> - unsigned long shm_nattch; /* no. of current attaches */
> - unsigned long __unused4;
> - unsigned long __unused5;
> -};
> -
> -struct shminfo64 {
> - unsigned long shmmax;
> - unsigned long shmmin;
> - unsigned long shmmni;
> - unsigned long shmseg;
> - unsigned long shmall;
> - unsigned long __unused1;
> - unsigned long __unused2;
> - unsigned long __unused3;
> - unsigned long __unused4;
> -};
> -
> -#endif /* _ASM_MICROBLAZE_SHMBUF_H */
> +#include <asm-generic/shmbuf.h>
> diff --git a/arch/microblaze/include/asm/siginfo.h b/arch/microblaze/include/asm/siginfo.h
> index f162911..0815d29 100644
> --- a/arch/microblaze/include/asm/siginfo.h
> +++ b/arch/microblaze/include/asm/siginfo.h
> @@ -1,15 +1 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_SIGINFO_H
> -#define _ASM_MICROBLAZE_SIGINFO_H
> -
> -#include <linux/types.h>
> #include <asm-generic/siginfo.h>
> -
> -#endif /* _ASM_MICROBLAZE_SIGINFO_H */
> diff --git a/arch/microblaze/include/asm/socket.h b/arch/microblaze/include/asm/socket.h
> dissimilarity index 100%
> index 8259368..6b71384 100644
> --- a/arch/microblaze/include/asm/socket.h
> +++ b/arch/microblaze/include/asm/socket.h
> @@ -1,69 +1 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_SOCKET_H
> -#define _ASM_MICROBLAZE_SOCKET_H
> -
> -#include <asm/sockios.h>
> -
> -/* For setsockoptions(2) */
> -#define SOL_SOCKET 1
> -
> -#define SO_DEBUG 1
> -#define SO_REUSEADDR 2
> -#define SO_TYPE 3
> -#define SO_ERROR 4
> -#define SO_DONTROUTE 5
> -#define SO_BROADCAST 6
> -#define SO_SNDBUF 7
> -#define SO_RCVBUF 8
> -#define SO_SNDBUFFORCE 32
> -#define SO_RCVBUFFORCE 33
> -#define SO_KEEPALIVE 9
> -#define SO_OOBINLINE 10
> -#define SO_NO_CHECK 11
> -#define SO_PRIORITY 12
> -#define SO_LINGER 13
> -#define SO_BSDCOMPAT 14
> -/* To add :#define SO_REUSEPORT 15 */
> -#define SO_PASSCRED 16
> -#define SO_PEERCRED 17
> -#define SO_RCVLOWAT 18
> -#define SO_SNDLOWAT 19
> -#define SO_RCVTIMEO 20
> -#define SO_SNDTIMEO 21
> -
> -/* Security levels - as per NRL IPv6 - don't actually do anything */
> -#define SO_SECURITY_AUTHENTICATION 22
> -#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
> -#define SO_SECURITY_ENCRYPTION_NETWORK 24
> -
> -#define SO_BINDTODEVICE 25
> -
> -/* Socket filtering */
> -#define SO_ATTACH_FILTER 26
> -#define SO_DETACH_FILTER 27
> -
> -#define SO_PEERNAME 28
> -#define SO_TIMESTAMP 29
> -#define SCM_TIMESTAMP SO_TIMESTAMP
> -
> -#define SO_ACCEPTCONN 30
> -
> -#define SO_PEERSEC 31
> -#define SO_PASSSEC 34
> -
> -#define SO_TIMESTAMPNS 35
> -#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
> -
> -#define SO_MARK 36
> -
> -#define SO_TIMESTAMPING 37
> -#define SCM_TIMESTAMPING SO_TIMESTAMPING
> -
> -#endif /* _ASM_MICROBLAZE_SOCKET_H */
> +#include <asm-generic/socket.h>
> diff --git a/arch/microblaze/include/asm/sockios.h b/arch/microblaze/include/asm/sockios.h
> dissimilarity index 100%
> index 9fff57a..def6d47 100644
> --- a/arch/microblaze/include/asm/sockios.h
> +++ b/arch/microblaze/include/asm/sockios.h
> @@ -1,23 +1 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_SOCKIOS_H
> -#define _ASM_MICROBLAZE_SOCKIOS_H
> -
> -#include <linux/ioctl.h>
> -
> -/* Socket-level I/O control calls. */
> -#define FIOSETOWN 0x8901
> -#define SIOCSPGRP 0x8902
> -#define FIOGETOWN 0x8903
> -#define SIOCGPGRP 0x8904
> -#define SIOCATMARK 0x8905
> -#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
> -#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
> -
> -#endif /* _ASM_MICROBLAZE_SOCKIOS_H */
> +#include <asm-generic/sockios.h>
> diff --git a/arch/microblaze/include/asm/stat.h b/arch/microblaze/include/asm/stat.h
> dissimilarity index 100%
> index a15f775..3dc90fa 100644
> --- a/arch/microblaze/include/asm/stat.h
> +++ b/arch/microblaze/include/asm/stat.h
> @@ -1,68 +1 @@
> -/*
> - * Microblaze stat structure
> - *
> - * Copyright (C) 2001,02,03 NEC Electronics Corporation
> - * Copyright (C) 2001,02,03 Miles Bader <[email protected]>
> - *
> - * This file is subject to the terms and conditions of the GNU General
> - * Public License. See the file COPYING in the main directory of this
> - * archive for more details.
> - *
> - * Written by Miles Bader <[email protected]>
> - */
> -
> -#ifndef _ASM_MICROBLAZE_STAT_H
> -#define _ASM_MICROBLAZE_STAT_H
> -
> -#include <linux/posix_types.h>
> -
> -#define STAT_HAVE_NSEC 1
> -
> -struct stat {
> - unsigned long st_dev;
> - unsigned long st_ino;
> - unsigned int st_mode;
> - unsigned int st_nlink;
> - unsigned int st_uid;
> - unsigned int st_gid;
> - unsigned long st_rdev;
> - unsigned long __pad1;
> - long st_size;
> - int st_blksize;
> - int __pad2;
> - long st_blocks;
> - int st_atime;
> - unsigned int st_atime_nsec;
> - int st_mtime;
> - unsigned int st_mtime_nsec;
> - int st_ctime;
> - unsigned int st_ctime_nsec;
> - unsigned long __unused4;
> - unsigned long __unused5;
> -};
> -
> -struct stat64 {
> - 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. */
> - int st_atime; /* Time of last access. */
> - unsigned int st_atime_nsec;
> - int st_mtime; /* Time of last modification. */
> - unsigned int st_mtime_nsec;
> - int st_ctime; /* Time of last status change. */
> - unsigned int st_ctime_nsec;
> - unsigned int __unused4;
> - unsigned int __unused5;
> -};
> -
> -#endif /* _ASM_MICROBLAZE_STAT_H */
> -
> +#include <asm-generic/stat.h>
> diff --git a/arch/microblaze/include/asm/swab.h b/arch/microblaze/include/asm/swab.h
> index b375d7b..7847e56 100644
> --- a/arch/microblaze/include/asm/swab.h
> +++ b/arch/microblaze/include/asm/swab.h
> @@ -1,8 +1 @@
> -#ifndef _ASM_MICROBLAZE_SWAB_H
> -#define _ASM_MICROBLAZE_SWAB_H
> -
> -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
> -#define __SWAB_64_THRU_32__
> -#endif
> -
> -#endif /* _ASM_MICROBLAZE_SWAB_H */
> +#include <asm-generic/swab.h>
> diff --git a/arch/microblaze/include/asm/termbits.h b/arch/microblaze/include/asm/termbits.h
> dissimilarity index 100%
> index a1b64bc..3935b10 100644
> --- a/arch/microblaze/include/asm/termbits.h
> +++ b/arch/microblaze/include/asm/termbits.h
> @@ -1,203 +1 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_TERMBITS_H
> -#define _ASM_MICROBLAZE_TERMBITS_H
> -
> -#include <linux/posix_types.h>
> -
> -typedef unsigned char cc_t;
> -typedef unsigned int speed_t;
> -typedef unsigned int tcflag_t;
> -
> -#define NCCS 19
> -struct termios {
> - tcflag_t c_iflag; /* input mode flags */
> - tcflag_t c_oflag; /* output mode flags */
> - tcflag_t c_cflag; /* control mode flags */
> - tcflag_t c_lflag; /* local mode flags */
> - cc_t c_line; /* line discipline */
> - cc_t c_cc[NCCS]; /* control characters */
> -};
> -
> -struct ktermios {
> - tcflag_t c_iflag; /* input mode flags */
> - tcflag_t c_oflag; /* output mode flags */
> - tcflag_t c_cflag; /* control mode flags */
> - tcflag_t c_lflag; /* local mode flags */
> - cc_t c_line; /* line discipline */
> - cc_t c_cc[NCCS]; /* control characters */
> - speed_t c_ispeed; /* input speed */
> - speed_t c_ospeed; /* output speed */
> -};
> -
> -/* c_cc characters */
> -
> -#define VINTR 0
> -#define VQUIT 1
> -#define VERASE 2
> -#define VKILL 3
> -#define VEOF 4
> -#define VTIME 5
> -#define VMIN 6
> -#define VSWTC 7
> -#define VSTART 8
> -#define VSTOP 9
> -#define VSUSP 10
> -#define VEOL 11
> -#define VREPRINT 12
> -#define VDISCARD 13
> -#define VWERASE 14
> -#define VLNEXT 15
> -#define VEOL2 16
> -
> -/* c_iflag bits */
> -
> -#define IGNBRK 0000001
> -#define BRKINT 0000002
> -#define IGNPAR 0000004
> -#define PARMRK 0000010
> -#define INPCK 0000020
> -#define ISTRIP 0000040
> -#define INLCR 0000100
> -#define IGNCR 0000200
> -#define ICRNL 0000400
> -#define IUCLC 0001000
> -#define IXON 0002000
> -#define IXANY 0004000
> -#define IXOFF 0010000
> -#define IMAXBEL 0020000
> -#define IUTF8 0040000
> -
> -/* c_oflag bits */
> -
> -#define OPOST 0000001
> -#define OLCUC 0000002
> -#define ONLCR 0000004
> -#define OCRNL 0000010
> -#define ONOCR 0000020
> -#define ONLRET 0000040
> -#define OFILL 0000100
> -#define OFDEL 0000200
> -#define NLDLY 0000400
> -#define NL0 0000000
> -#define NL1 0000400
> -#define CRDLY 0003000
> -#define CR0 0000000
> -#define CR1 0001000
> -#define CR2 0002000
> -#define CR3 0003000
> -#define TABDLY 0014000
> -#define TAB0 0000000
> -#define TAB1 0004000
> -#define TAB2 0010000
> -#define TAB3 0014000
> -#define XTABS 0014000
> -#define BSDLY 0020000
> -#define BS0 0000000
> -#define BS1 0020000
> -#define VTDLY 0040000
> -#define VT0 0000000
> -#define VT1 0040000
> -#define FFDLY 0100000
> -#define FF0 0000000
> -#define FF1 0100000
> -
> -/* c_cflag bit meaning */
> -
> -#define CBAUD 0010017
> -#define B0 0000000 /* hang up */
> -#define B50 0000001
> -#define B75 0000002
> -#define B110 0000003
> -#define B134 0000004
> -#define B150 0000005
> -#define B200 0000006
> -#define B300 0000007
> -#define B600 0000010
> -#define B1200 0000011
> -#define B1800 0000012
> -#define B2400 0000013
> -#define B4800 0000014
> -#define B9600 0000015
> -#define B19200 0000016
> -#define B38400 0000017
> -#define EXTA B19200
> -#define EXTB B38400
> -#define CSIZE 0000060
> -#define CS5 0000000
> -#define CS6 0000020
> -#define CS7 0000040
> -#define CS8 0000060
> -#define CSTOPB 0000100
> -#define CREAD 0000200
> -#define PARENB 0000400
> -#define PARODD 0001000
> -#define HUPCL 0002000
> -#define CLOCAL 0004000
> -#define CBAUDEX 0010000
> -#define B57600 0010001
> -#define B115200 0010002
> -#define B230400 0010003
> -#define B460800 0010004
> -#define B500000 0010005
> -#define B576000 0010006
> -#define B921600 0010007
> -#define BOTHER 0010000
> -#define B1000000 0010010
> -#define B1152000 0010011
> -#define B1500000 0010012
> -#define B2000000 0010013
> -#define B2500000 0010014
> -#define B3000000 0010015
> -#define B3500000 0010016
> -#define B4000000 0010017
> -#define CIBAUD 002003600000 /* input baud rate (not used) */
> -#define CMSPAR 010000000000 /* mark or space (stick) parity */
> -#define CRTSCTS 020000000000 /* flow control */
> -
> -#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
> -
> -/* c_lflag bits */
> -
> -#define ISIG 0000001
> -#define ICANON 0000002
> -#define XCASE 0000004
> -#define ECHO 0000010
> -#define ECHOE 0000020
> -#define ECHOK 0000040
> -#define ECHONL 0000100
> -#define NOFLSH 0000200
> -#define TOSTOP 0000400
> -#define ECHOCTL 0001000
> -#define ECHOPRT 0002000
> -#define ECHOKE 0004000
> -#define FLUSHO 0010000
> -#define PENDIN 0040000
> -#define IEXTEN 0100000
> -
> -/* tcflow() and TCXONC use these */
> -
> -#define TCOOFF 0
> -#define TCOON 1
> -#define TCIOFF 2
> -#define TCION 3
> -
> -/* tcflush() and TCFLSH use these */
> -
> -#define TCIFLUSH 0
> -#define TCOFLUSH 1
> -#define TCIOFLUSH 2
> -
> -/* tcsetattr uses these */
> -
> -#define TCSANOW 0
> -#define TCSADRAIN 1
> -#define TCSAFLUSH 2
> -
> -#endif /* _ASM_MICROBLAZE_TERMBITS_H */
> +#include <asm-generic/termbits.h>
> diff --git a/arch/microblaze/include/asm/termios.h b/arch/microblaze/include/asm/termios.h
> dissimilarity index 100%
> index 47a46d1..280d78a 100644
> --- a/arch/microblaze/include/asm/termios.h
> +++ b/arch/microblaze/include/asm/termios.h
> @@ -1,88 +1 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_TERMIOS_H
> -#define _ASM_MICROBLAZE_TERMIOS_H
> -
> -#include <linux/string.h>
> -#include <asm/termbits.h>
> -#include <asm/ioctls.h>
> -
> -struct winsize {
> - unsigned short ws_row;
> - unsigned short ws_col;
> - unsigned short ws_xpixel;
> - unsigned short ws_ypixel;
> -};
> -
> -#define NCC 8
> -struct termio {
> - unsigned short c_iflag; /* input mode flags */
> - unsigned short c_oflag; /* output mode flags */
> - unsigned short c_cflag; /* control mode flags */
> - unsigned short c_lflag; /* local mode flags */
> - unsigned char c_line; /* line discipline */
> - unsigned char c_cc[NCC]; /* control characters */
> -};
> -
> -#ifdef __KERNEL__
> -/* intr=^C quit=^| erase=del kill=^U
> - eof=^D vtime=\0 vmin=\1 sxtc=\0
> - start=^Q stop=^S susp=^Z eol=\0
> - reprint=^R discard=^U werase=^W lnext=^V
> - eol2=\0
> -*/
> -#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
> -#endif
> -
> -/* Modem lines */
> -
> -#define TIOCM_LE 0x001
> -#define TIOCM_DTR 0x002
> -#define TIOCM_RTS 0x004
> -#define TIOCM_ST 0x008
> -#define TIOCM_SR 0x010
> -#define TIOCM_CTS 0x020
> -#define TIOCM_CAR 0x040
> -#define TIOCM_RNG 0x080
> -#define TIOCM_DSR 0x100
> -#define TIOCM_CD TIOCM_CAR
> -#define TIOCM_RI TIOCM_RNG
> -#define TIOCM_OUT1 0x2000
> -#define TIOCM_OUT2 0x4000
> -#define TIOCM_LOOP 0x8000
> -
> -/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
> -
> -/* Line disciplines */
> -
> -#define N_TTY 0
> -#define N_SLIP 1
> -#define N_MOUSE 2
> -#define N_PPP 3
> -#define N_STRIP 4
> -#define N_AX25 5
> -#define N_X25 6 /* X.25 async */
> -#define N_6PACK 7
> -#define N_MASC 8 /* Reserved for Mobitex module <[email protected]> */
> -#define N_R3964 9 /* Reserved for Simatic R3964 module */
> -#define N_PROFIBUS_FDL 10 /* Reserved for Profibus <[email protected]> */
> -#define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */
> -#define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards
> - about SMS messages */
> -#define N_HDLC 13 /* synchronous HDLC */
> -#define N_SYNC_PPP 14
> -#define N_HCI 15 /* Bluetooth HCI UART */
> -
> -#ifdef __KERNEL__
> -
> -#include <asm-generic/termios-base.h>
> -
> -#endif /* __KERNEL__ */
> -
> -#endif /* _ASM_MICROBLAZE_TERMIOS_H */
> +#include <asm-generic/termios.h>
> diff --git a/arch/microblaze/include/asm/types.h b/arch/microblaze/include/asm/types.h
> dissimilarity index 100%
> index bebc018..b9e79bc 100644
> --- a/arch/microblaze/include/asm/types.h
> +++ b/arch/microblaze/include/asm/types.h
> @@ -1,38 +1 @@
> -/*
> - * Copyright (C) Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_TYPES_H
> -#define _ASM_MICROBLAZE_TYPES_H
> -
> -/*
> - * This file is never included by application software unless
> - * explicitly requested (e.g., via linux/types.h) in which case the
> - * application is Linux specific so (user-) name space pollution is
> - * not a major issue. However, for interoperability, libraries still
> - * need to be careful to avoid a name clashes.
> - */
> -
> -#include <asm-generic/int-ll64.h>
> -
> -# ifndef __ASSEMBLY__
> -
> -typedef unsigned short umode_t;
> -
> -/*
> - * These aren't exported outside the kernel to avoid name space clashes
> - */
> -# ifdef __KERNEL__
> -# define BITS_PER_LONG 32
> -
> -/* Dma addresses are 32-bits wide. */
> -
> -typedef u32 dma_addr_t;
> -
> -# endif/* __KERNEL__ */
> -# endif /* __ASSEMBLY__ */
> -#endif /* _ASM_MICROBLAZE_TYPES_H */
> +#include <asm-generic/types.h>
> diff --git a/arch/microblaze/include/asm/ucontext.h b/arch/microblaze/include/asm/ucontext.h
> dissimilarity index 100%
> index 11f6bb3..9bc07b9 100644
> --- a/arch/microblaze/include/asm/ucontext.h
> +++ b/arch/microblaze/include/asm/ucontext.h
> @@ -1,22 +1 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_UCONTEXT_H
> -#define _ASM_MICROBLAZE_UCONTEXT_H
> -
> -#include <asm/sigcontext.h>
> -
> -struct ucontext {
> - unsigned long uc_flags;
> - struct ucontext *uc_link;
> - stack_t uc_stack;
> - struct sigcontext uc_mcontext;
> - sigset_t uc_sigmask; /* mask last for extensibility */
> -};
> -
> -#endif /* _ASM_MICROBLAZE_UCONTEXT_H */
> +#include <asm-generic/ucontext.h>

--
Michal Simek, Ing. (M.Eng)
w: http://www.monstr.eu p: +42-0-721842854

2009-07-01 11:35:33

by Michal Simek

[permalink] [raw]
Subject: Re: [microblaze-uclinux] [PATCH 08/11] microblaze: use the generic lib/checksum.c

added to next branch for test.

Thanks,
Michal

Arnd Bergmann wrote:
> From: Remis Lima Baima <[email protected]>
>
> The microblaze checksum code is mostly identical to
> the asm-generic+lib version, so use that instead.
>
> Signed-off-by: Remis Lima Baima <[email protected]>
> ---
> arch/microblaze/Kconfig | 3 +
> arch/microblaze/include/asm/checksum.h | 134 ++++++------------------
> arch/microblaze/lib/Makefile | 2 +-
> arch/microblaze/lib/checksum.c | 172 --------------------------------
> 4 files changed, 38 insertions(+), 273 deletions(-)
> rewrite arch/microblaze/include/asm/checksum.h (69%)
> delete mode 100644 arch/microblaze/lib/checksum.c
>
> diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
> index 8b4de19..8ee1c85 100644
> --- a/arch/microblaze/Kconfig
> +++ b/arch/microblaze/Kconfig
> @@ -56,6 +56,9 @@ config GENERIC_GPIO
> config GENERIC_SYSCALL_TABLE
> def_bool y
>
> +config GENERIC_CSUM
> + def_bool y
> +
> config PCI
> def_bool n
>
> diff --git a/arch/microblaze/include/asm/checksum.h b/arch/microblaze/include/asm/checksum.h
> dissimilarity index 69%
> index 97ea46b..128bf03 100644
> --- a/arch/microblaze/include/asm/checksum.h
> +++ b/arch/microblaze/include/asm/checksum.h
> @@ -1,100 +1,34 @@
> -/*
> - * Copyright (C) 2008 Michal Simek <[email protected]>
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_CHECKSUM_H
> -#define _ASM_MICROBLAZE_CHECKSUM_H
> -
> -#include <linux/in6.h>
> -
> -/*
> - * computes the checksum of the TCP/UDP pseudo-header
> - * returns a 16-bit checksum, already complemented
> - */
> -static inline __wsum
> -csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
> - unsigned short proto, __wsum sum)
> -{
> - __asm__("add %0, %0, %1\n\t"
> - "addc %0, %0, %2\n\t"
> - "addc %0, %0, %3\n\t"
> - "addc %0, %0, r0\n\t"
> - : "+&d" (sum)
> - : "d" (saddr), "d" (daddr), "d" (len + proto));
> -
> - return sum;
> -}
> -
> -/*
> - * computes the checksum of a memory block at buff, length len,
> - * and adds in "sum" (32-bit)
> - *
> - * returns a 32-bit number suitable for feeding into itself
> - * or csum_tcpudp_magic
> - *
> - * this function must be called with even lengths, except
> - * for the last fragment, which may be odd
> - *
> - * it's best to have buff aligned on a 32-bit boundary
> - */
> -extern __wsum csum_partial(const void *buff, int len, __wsum sum);
> -
> -/*
> - * the same as csum_partial, but copies from src while it
> - * checksums
> - *
> - * here even more important to align src and dst on a 32-bit (or even
> - * better 64-bit) boundary
> - */
> -extern __wsum csum_partial_copy(const void *src, void *dst, int len,
> - __wsum sum);
> -
> -/*
> - * the same as csum_partial_copy, but copies from user space.
> - *
> - * here even more important to align src and dst on a 32-bit (or even
> - * better 64-bit) boundary
> - */
> -extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
> - int len, __wsum sum, int *csum_err);
> -
> -#define csum_partial_copy_nocheck(src, dst, len, sum) \
> - csum_partial_copy((src), (dst), (len), (sum))
> -
> -/*
> - * This is a version of ip_compute_csum() optimized for IP headers,
> - * which always checksum on 4 octet boundaries.
> - *
> - */
> -extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
> -
> -/*
> - * Fold a partial checksum
> - */
> -static inline __sum16 csum_fold(__wsum csum)
> -{
> - u32 sum = (__force u32)csum;
> - sum = (sum & 0xffff) + (sum >> 16);
> - sum = (sum & 0xffff) + (sum >> 16);
> - return (__force __sum16)~sum;
> -}
> -
> -static inline __sum16
> -csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
> - unsigned short proto, __wsum sum)
> -{
> - return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
> -}
> -
> -/*
> - * this routine is used for miscellaneous IP-like checksums, mainly
> - * in icmp.c
> - */
> -extern __sum16 ip_compute_csum(const void *buff, int len);
> -
> -#endif /* _ASM_MICROBLAZE_CHECKSUM_H */
> +/*
> + * Copyright (C) 2008 Michal Simek <[email protected]>
> + * Copyright (C) 2006 Atmark Techno, Inc.
> + *
> + * This file is subject to the terms and conditions of the GNU General Public
> + * License. See the file "COPYING" in the main directory of this archive
> + * for more details.
> + */
> +
> +#ifndef _ASM_MICROBLAZE_CHECKSUM_H
> +#define _ASM_MICROBLAZE_CHECKSUM_H
> +
> +/*
> + * computes the checksum of the TCP/UDP pseudo-header
> + * returns a 16-bit checksum, already complemented
> + */
> +#define csum_tcpudp_nofold csum_tcpudp_nofold
> +static inline __wsum
> +csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
> + unsigned short proto, __wsum sum)
> +{
> + __asm__("add %0, %0, %1\n\t"
> + "addc %0, %0, %2\n\t"
> + "addc %0, %0, %3\n\t"
> + "addc %0, %0, r0\n\t"
> + : "+&d" (sum)
> + : "d" (saddr), "d" (daddr), "d" (len + proto));
> +
> + return sum;
> +}
> +
> +#include <asm-generic/checksum.h>
> +
> +#endif /* _ASM_MICROBLAZE_CHECKSUM_H */
> diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile
> index 71c8cb6..b579db0 100644
> --- a/arch/microblaze/lib/Makefile
> +++ b/arch/microblaze/lib/Makefile
> @@ -2,7 +2,7 @@
> # Makefile
> #
>
> -lib-y := memset.o checksum.o
> +lib-y := memset.o
>
> ifeq ($(CONFIG_OPT_LIB_ASM),y)
> lib-y += fastcopy.o
> diff --git a/arch/microblaze/lib/checksum.c b/arch/microblaze/lib/checksum.c
> deleted file mode 100644
> index f08e745..0000000
> --- a/arch/microblaze/lib/checksum.c
> +++ /dev/null
> @@ -1,172 +0,0 @@
> -/*
> - *
> - * INET An implementation of the TCP/IP protocol suite for the LINUX
> - * operating system. INET is implemented using the BSD Socket
> - * interface as the means of communication with the user level.
> - *
> - * IP/TCP/UDP checksumming routines
> - *
> - * Authors: Jorge Cwik, <[email protected]>
> - * Arnt Gulbrandsen, <[email protected]>
> - * Tom May, <[email protected]>
> - * Andreas Schwab, <[email protected]>
> - * Lots of code moved from tcp.c and ip.c; see those files
> - * for more names.
> - *
> - * 03/02/96 Jes Sorensen, Andreas Schwab, Roman Hodek:
> - * Fixed some nasty bugs, causing some horrible crashes.
> - * A: At some points, the sum (%0) was used as
> - * length-counter instead of the length counter
> - * (%1). Thanks to Roman Hodek for pointing this out.
> - * B: GCC seems to mess up if one uses too many
> - * data-registers to hold input values and one tries to
> - * specify d0 and d1 as scratch registers. Letting gcc
> - * choose these registers itself solves the problem.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version
> - * 2 of the License, or (at your option) any later version.
> - */
> -
> -/* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access
> - kills, so most of the assembly has to go. */
> -
> -#include <linux/module.h>
> -#include <net/checksum.h>
> -
> -#include <asm/byteorder.h>
> -
> -static inline unsigned short from32to16(unsigned long x)
> -{
> - /* add up 16-bit and 16-bit for 16+c bit */
> - x = (x & 0xffff) + (x >> 16);
> - /* add up carry.. */
> - x = (x & 0xffff) + (x >> 16);
> - return x;
> -}
> -
> -static unsigned int do_csum(const unsigned char *buff, int len)
> -{
> - int odd, count;
> - unsigned long result = 0;
> -
> - if (len <= 0)
> - goto out;
> - odd = 1 & (unsigned long) buff;
> - if (odd) {
> - result = *buff;
> - len--;
> - buff++;
> - }
> - count = len >> 1; /* nr of 16-bit words.. */
> - if (count) {
> - if (2 & (unsigned long) buff) {
> - result += *(unsigned short *) buff;
> - count--;
> - len -= 2;
> - buff += 2;
> - }
> - count >>= 1; /* nr of 32-bit words.. */
> - if (count) {
> - unsigned long carry = 0;
> - do {
> - unsigned long w = *(unsigned long *) buff;
> - count--;
> - buff += 4;
> - result += carry;
> - result += w;
> - carry = (w > result);
> - } while (count);
> - result += carry;
> - result = (result & 0xffff) + (result >> 16);
> - }
> - if (len & 2) {
> - result += *(unsigned short *) buff;
> - buff += 2;
> - }
> - }
> - if (len & 1)
> - result += (*buff << 8);
> - result = from32to16(result);
> - if (odd)
> - result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
> -out:
> - return result;
> -}
> -
> -/*
> - * This is a version of ip_compute_csum() optimized for IP headers,
> - * which always checksum on 4 octet boundaries.
> - */
> -__sum16 ip_fast_csum(const void *iph, unsigned int ihl)
> -{
> - return (__force __sum16)~do_csum(iph, ihl*4);
> -}
> -EXPORT_SYMBOL(ip_fast_csum);
> -
> -/*
> - * computes the checksum of a memory block at buff, length len,
> - * and adds in "sum" (32-bit)
> - *
> - * returns a 32-bit number suitable for feeding into itself
> - * or csum_tcpudp_magic
> - *
> - * this function must be called with even lengths, except
> - * for the last fragment, which may be odd
> - *
> - * it's best to have buff aligned on a 32-bit boundary
> - */
> -__wsum csum_partial(const void *buff, int len, __wsum wsum)
> -{
> - unsigned int sum = (__force unsigned int)wsum;
> - unsigned int result = do_csum(buff, len);
> -
> - /* add in old sum, and carry.. */
> - result += sum;
> - if (sum > result)
> - result += 1;
> - return (__force __wsum)result;
> -}
> -EXPORT_SYMBOL(csum_partial);
> -
> -/*
> - * this routine is used for miscellaneous IP-like checksums, mainly
> - * in icmp.c
> - */
> -__sum16 ip_compute_csum(const void *buff, int len)
> -{
> - return (__force __sum16)~do_csum(buff, len);
> -}
> -EXPORT_SYMBOL(ip_compute_csum);
> -
> -/*
> - * copy from fs while checksumming, otherwise like csum_partial
> - */
> -__wsum
> -csum_partial_copy_from_user(const void __user *src, void *dst, int len,
> - __wsum sum, int *csum_err)
> -{
> - int missing;
> -
> - missing = __copy_from_user(dst, src, len);
> - if (missing) {
> - memset(dst + len - missing, 0, missing);
> - *csum_err = -EFAULT;
> - } else
> - *csum_err = 0;
> -
> - return csum_partial(dst, len, sum);
> -}
> -EXPORT_SYMBOL(csum_partial_copy_from_user);
> -
> -/*
> - * copy from ds while checksumming, otherwise like csum_partial
> - */
> -__wsum
> -csum_partial_copy(const void *src, void *dst, int len, __wsum sum)
> -{
> - memcpy(dst, src, len);
> - return csum_partial(dst, len, sum);
> -}
> -EXPORT_SYMBOL(csum_partial_copy);

--
Michal Simek, Ing. (M.Eng)
w: http://www.monstr.eu p: +42-0-721842854

2009-07-01 11:35:58

by Michal Simek

[permalink] [raw]
Subject: Re: [microblaze-uclinux] [PATCH 09/11] microblaze: convert all simple headers to use asm-generic

Added to next branch for testing.

Thanks,
Michal

Arnd Bergmann wrote:
> From: Remis Lima Baima <[email protected]>
>
> All the simple microblaze header files were adapted to use their
> asm-generic implementations. These files are more simple and were quite
> straightforward to change.
>
> fb.h, vga.h and parport.h previously did not exist, using
> the generic version makes it possible to build more drivers
> successfully in allyesonfig.
>
> Signed-off-by: Remis Lima Baima <[email protected]>
> Signed-off-by: Arnd Bergmann <[email protected]>
> ---
> arch/microblaze/include/asm/atomic.h | 147 ++++---------------------
> arch/microblaze/include/asm/bitops.h | 28 +-----
> arch/microblaze/include/asm/bug.h | 14 ---
> arch/microblaze/include/asm/bugs.h | 18 +---
> arch/microblaze/include/asm/fb.h | 1 +
> arch/microblaze/include/asm/hardirq.h | 14 +--
> arch/microblaze/include/asm/irq.h | 6 +-
> arch/microblaze/include/asm/mmu.h | 7 +-
> arch/microblaze/include/asm/mmu_context.h | 2 +-
> arch/microblaze/include/asm/mmu_context_no.h | 23 ----
> arch/microblaze/include/asm/module.h | 10 +--
> arch/microblaze/include/asm/parport.h | 1 +
> arch/microblaze/include/asm/pci.h | 2 +-
> arch/microblaze/include/asm/scatterlist.h | 29 +-----
> arch/microblaze/include/asm/serial.h | 15 +---
> arch/microblaze/include/asm/shmparam.h | 7 +-
> arch/microblaze/include/asm/system.h | 3 +
> arch/microblaze/include/asm/timex.h | 6 +-
> arch/microblaze/include/asm/vga.h | 2 +-
> 19 files changed, 45 insertions(+), 290 deletions(-)
> rewrite arch/microblaze/include/asm/atomic.h (84%)
> rewrite arch/microblaze/include/asm/bitops.h (95%)
> create mode 100644 arch/microblaze/include/asm/fb.h
> delete mode 100644 arch/microblaze/include/asm/mmu_context_no.h
> create mode 100644 arch/microblaze/include/asm/parport.h
> rewrite arch/microblaze/include/asm/scatterlist.h (100%)
>
> diff --git a/arch/microblaze/include/asm/atomic.h b/arch/microblaze/include/asm/atomic.h
> dissimilarity index 84%
> index 0de612a..6d2e1d4 100644
> --- a/arch/microblaze/include/asm/atomic.h
> +++ b/arch/microblaze/include/asm/atomic.h
> @@ -1,123 +1,24 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_ATOMIC_H
> -#define _ASM_MICROBLAZE_ATOMIC_H
> -
> -#include <linux/types.h>
> -#include <linux/compiler.h> /* likely */
> -#include <asm/system.h> /* local_irq_XXX and friends */
> -
> -#define ATOMIC_INIT(i) { (i) }
> -#define atomic_read(v) ((v)->counter)
> -#define atomic_set(v, i) (((v)->counter) = (i))
> -
> -#define atomic_inc(v) (atomic_add_return(1, (v)))
> -#define atomic_dec(v) (atomic_sub_return(1, (v)))
> -
> -#define atomic_add(i, v) (atomic_add_return(i, (v)))
> -#define atomic_sub(i, v) (atomic_sub_return(i, (v)))
> -
> -#define atomic_inc_return(v) (atomic_add_return(1, (v)))
> -#define atomic_dec_return(v) (atomic_sub_return(1, (v)))
> -
> -#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
> -#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
> -
> -#define atomic_inc_not_zero(v) (atomic_add_unless((v), 1, 0))
> -
> -#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0)
> -
> -static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
> -{
> - int ret;
> - unsigned long flags;
> -
> - local_irq_save(flags);
> - ret = v->counter;
> - if (likely(ret == old))
> - v->counter = new;
> - local_irq_restore(flags);
> -
> - return ret;
> -}
> -
> -static inline int atomic_add_unless(atomic_t *v, int a, int u)
> -{
> - int c, old;
> -
> - c = atomic_read(v);
> - while (c != u && (old = atomic_cmpxchg((v), c, c + a)) != c)
> - c = old;
> - return c != u;
> -}
> -
> -static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
> -{
> - unsigned long flags;
> -
> - local_irq_save(flags);
> - *addr &= ~mask;
> - local_irq_restore(flags);
> -}
> -
> -/**
> - * atomic_add_return - add and return
> - * @i: integer value to add
> - * @v: pointer of type atomic_t
> - *
> - * Atomically adds @i to @v and returns @i + @v
> - */
> -static inline int atomic_add_return(int i, atomic_t *v)
> -{
> - unsigned long flags;
> - int val;
> -
> - local_irq_save(flags);
> - val = v->counter;
> - v->counter = val += i;
> - local_irq_restore(flags);
> -
> - return val;
> -}
> -
> -static inline int atomic_sub_return(int i, atomic_t *v)
> -{
> - return atomic_add_return(-i, v);
> -}
> -
> -/*
> - * Atomically test *v and decrement if it is greater than 0.
> - * The function returns the old value of *v minus 1.
> - */
> -static inline int atomic_dec_if_positive(atomic_t *v)
> -{
> - unsigned long flags;
> - int res;
> -
> - local_irq_save(flags);
> - res = v->counter - 1;
> - if (res >= 0)
> - v->counter = res;
> - local_irq_restore(flags);
> -
> - return res;
> -}
> -
> -#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
> -#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
> -
> -/* Atomic operations are already serializing */
> -#define smp_mb__before_atomic_dec() barrier()
> -#define smp_mb__after_atomic_dec() barrier()
> -#define smp_mb__before_atomic_inc() barrier()
> -#define smp_mb__after_atomic_inc() barrier()
> -
> -#include <asm-generic/atomic-long.h>
> -
> -#endif /* _ASM_MICROBLAZE_ATOMIC_H */
> +#ifndef _ASM_MICROBLAZE_ATOMIC_H
> +#define _ASM_MICROBLAZE_ATOMIC_H
> +
> +#include <asm-generic/atomic.h>
> +
> +/*
> + * Atomically test *v and decrement if it is greater than 0.
> + * The function returns the old value of *v minus 1.
> + */
> +static inline int atomic_dec_if_positive(atomic_t *v)
> +{
> + unsigned long flags;
> + int res;
> +
> + local_irq_save(flags);
> + res = v->counter - 1;
> + if (res >= 0)
> + v->counter = res;
> + local_irq_restore(flags);
> +
> + return res;
> +}
> +
> +#endif /* _ASM_MICROBLAZE_ATOMIC_H */
> diff --git a/arch/microblaze/include/asm/bitops.h b/arch/microblaze/include/asm/bitops.h
> dissimilarity index 95%
> index d6df1fd..a72468f 100644
> --- a/arch/microblaze/include/asm/bitops.h
> +++ b/arch/microblaze/include/asm/bitops.h
> @@ -1,27 +1 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_BITOPS_H
> -#define _ASM_MICROBLAZE_BITOPS_H
> -
> -/*
> - * Copyright 1992, Linus Torvalds.
> - */
> -
> -#include <asm/byteorder.h> /* swab32 */
> -#include <asm/system.h> /* save_flags */
> -
> -/*
> - * clear_bit() doesn't provide any barrier for the compiler.
> - */
> -#define smp_mb__before_clear_bit() barrier()
> -#define smp_mb__after_clear_bit() barrier()
> -#include <asm-generic/bitops.h>
> -#include <asm-generic/bitops/__fls.h>
> -
> -#endif /* _ASM_MICROBLAZE_BITOPS_H */
> +#include <asm-generic/bitops.h>
> diff --git a/arch/microblaze/include/asm/bug.h b/arch/microblaze/include/asm/bug.h
> index 8eb2cdd..b12fd89 100644
> --- a/arch/microblaze/include/asm/bug.h
> +++ b/arch/microblaze/include/asm/bug.h
> @@ -1,15 +1 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_BUG_H
> -#define _ASM_MICROBLAZE_BUG_H
> -
> -#include <linux/kernel.h>
> #include <asm-generic/bug.h>
> -
> -#endif /* _ASM_MICROBLAZE_BUG_H */
> diff --git a/arch/microblaze/include/asm/bugs.h b/arch/microblaze/include/asm/bugs.h
> index f2c6593..61791e1 100644
> --- a/arch/microblaze/include/asm/bugs.h
> +++ b/arch/microblaze/include/asm/bugs.h
> @@ -1,17 +1 @@
> -/*
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_BUGS_H
> -#define _ASM_MICROBLAZE_BUGS_H
> -
> -static inline void check_bugs(void)
> -{
> - /* nothing to do */
> -}
> -
> -#endif /* _ASM_MICROBLAZE_BUGS_H */
> +#include <asm-generic/bugs.h>
> diff --git a/arch/microblaze/include/asm/fb.h b/arch/microblaze/include/asm/fb.h
> new file mode 100644
> index 0000000..3a4988e
> --- /dev/null
> +++ b/arch/microblaze/include/asm/fb.h
> @@ -0,0 +1 @@
> +#include <asm-generic/fb.h>
> diff --git a/arch/microblaze/include/asm/hardirq.h b/arch/microblaze/include/asm/hardirq.h
> index 0f2d6b0..41e1e1a 100644
> --- a/arch/microblaze/include/asm/hardirq.h
> +++ b/arch/microblaze/include/asm/hardirq.h
> @@ -9,21 +9,11 @@
> #ifndef _ASM_MICROBLAZE_HARDIRQ_H
> #define _ASM_MICROBLAZE_HARDIRQ_H
>
> -#include <linux/cache.h>
> -#include <linux/irq.h>
> -#include <asm/irq.h>
> -#include <asm/current.h>
> -#include <linux/ptrace.h>
> -
> /* should be defined in each interrupt controller driver */
> extern unsigned int get_irq(struct pt_regs *regs);
>
> -typedef struct {
> - unsigned int __softirq_pending;
> -} ____cacheline_aligned irq_cpustat_t;
> -
> +#define ack_bad_irq ack_bad_irq
> void ack_bad_irq(unsigned int irq);
> -
> -#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
> +#include <asm-generic/hardirq.h>
>
> #endif /* _ASM_MICROBLAZE_HARDIRQ_H */
> diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h
> index db515de..90f0505 100644
> --- a/arch/microblaze/include/asm/irq.h
> +++ b/arch/microblaze/include/asm/irq.h
> @@ -10,6 +10,7 @@
> #define _ASM_MICROBLAZE_IRQ_H
>
> #define NR_IRQS 32
> +#include <asm-generic/irq.h>
>
> #include <linux/interrupt.h>
>
> @@ -17,11 +18,6 @@ extern unsigned int nr_irq;
>
> #define NO_IRQ (-1)
>
> -static inline int irq_canonicalize(int irq)
> -{
> - return irq;
> -}
> -
> struct pt_regs;
> extern void do_IRQ(struct pt_regs *regs);
>
> diff --git a/arch/microblaze/include/asm/mmu.h b/arch/microblaze/include/asm/mmu.h
> index 66cad6a..8d6a654 100644
> --- a/arch/microblaze/include/asm/mmu.h
> +++ b/arch/microblaze/include/asm/mmu.h
> @@ -12,12 +12,7 @@
> #define _ASM_MICROBLAZE_MMU_H
>
> # ifndef CONFIG_MMU
> -# ifndef __ASSEMBLY__
> -typedef struct {
> - struct vm_list_struct *vmlist;
> - unsigned long end_brk;
> -} mm_context_t;
> -# endif /* __ASSEMBLY__ */
> +# include <asm-generic/mmu.h>
> # else /* CONFIG_MMU */
> # ifdef __KERNEL__
> # ifndef __ASSEMBLY__
> diff --git a/arch/microblaze/include/asm/mmu_context.h b/arch/microblaze/include/asm/mmu_context.h
> index 385fed1..24eab16 100644
> --- a/arch/microblaze/include/asm/mmu_context.h
> +++ b/arch/microblaze/include/asm/mmu_context.h
> @@ -1,5 +1,5 @@
> #ifdef CONFIG_MMU
> # include "mmu_context_mm.h"
> #else
> -# include "mmu_context_no.h"
> +# include <asm-generic/mmu_context.h>
> #endif
> diff --git a/arch/microblaze/include/asm/mmu_context_no.h b/arch/microblaze/include/asm/mmu_context_no.h
> deleted file mode 100644
> index ba55671..0000000
> --- a/arch/microblaze/include/asm/mmu_context_no.h
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -/*
> - * Copyright (C) 2008-2009 Michal Simek <[email protected]>
> - * Copyright (C) 2008-2009 PetaLogix
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_MMU_CONTEXT_H
> -#define _ASM_MICROBLAZE_MMU_CONTEXT_H
> -
> -# define init_new_context(tsk, mm) ({ 0; })
> -
> -# define enter_lazy_tlb(mm, tsk) do {} while (0)
> -# define change_mm_context(old, ctx, _pml4) do {} while (0)
> -# define destroy_context(mm) do {} while (0)
> -# define deactivate_mm(tsk, mm) do {} while (0)
> -# define switch_mm(prev, next, tsk) do {} while (0)
> -# define activate_mm(prev, next) do {} while (0)
> -
> -#endif /* _ASM_MICROBLAZE_MMU_CONTEXT_H */
> diff --git a/arch/microblaze/include/asm/module.h b/arch/microblaze/include/asm/module.h
> index 914565a..7be1347 100644
> --- a/arch/microblaze/include/asm/module.h
> +++ b/arch/microblaze/include/asm/module.h
> @@ -9,6 +9,8 @@
> #ifndef _ASM_MICROBLAZE_MODULE_H
> #define _ASM_MICROBLAZE_MODULE_H
>
> +#include <asm-generic/module.h>
> +
> /* Microblaze Relocations */
> #define R_MICROBLAZE_NONE 0
> #define R_MICROBLAZE_32 1
> @@ -24,14 +26,6 @@
> /* Keep this the last entry. */
> #define R_MICROBLAZE_NUM 11
>
> -struct mod_arch_specific {
> - int foo;
> -};
> -
> -#define Elf_Shdr Elf32_Shdr
> -#define Elf_Sym Elf32_Sym
> -#define Elf_Ehdr Elf32_Ehdr
> -
> typedef struct { volatile int counter; } module_t;
>
> #endif /* _ASM_MICROBLAZE_MODULE_H */
> diff --git a/arch/microblaze/include/asm/parport.h b/arch/microblaze/include/asm/parport.h
> new file mode 100644
> index 0000000..cf252af
> --- /dev/null
> +++ b/arch/microblaze/include/asm/parport.h
> @@ -0,0 +1 @@
> +#include <asm-generic/parport.h>
> diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h
> index ca03794..9f0df5f 100644
> --- a/arch/microblaze/include/asm/pci.h
> +++ b/arch/microblaze/include/asm/pci.h
> @@ -1 +1 @@
> -#include <linux/io.h>
> +#include <asm-generic/pci.h>
> diff --git a/arch/microblaze/include/asm/scatterlist.h b/arch/microblaze/include/asm/scatterlist.h
> dissimilarity index 100%
> index 08ff1d0..35d786f 100644
> --- a/arch/microblaze/include/asm/scatterlist.h
> +++ b/arch/microblaze/include/asm/scatterlist.h
> @@ -1,28 +1 @@
> -/*
> - * Copyright (C) 2008 Michal Simek <[email protected]>
> - * Copyright (C) 2006 Atmark Techno, Inc.
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_SCATTERLIST_H
> -#define _ASM_MICROBLAZE_SCATTERLIST_H
> -
> -struct scatterlist {
> -#ifdef CONFIG_DEBUG_SG
> - unsigned long sg_magic;
> -#endif
> - unsigned long page_link;
> - dma_addr_t dma_address;
> - unsigned int offset;
> - unsigned int length;
> -};
> -
> -#define sg_dma_address(sg) ((sg)->dma_address)
> -#define sg_dma_len(sg) ((sg)->length)
> -
> -#define ISA_DMA_THRESHOLD (~0UL)
> -
> -#endif /* _ASM_MICROBLAZE_SCATTERLIST_H */
> +#include <asm-generic/scatterlist.h>
> diff --git a/arch/microblaze/include/asm/serial.h b/arch/microblaze/include/asm/serial.h
> index 39bfc8c..a0cb0ca 100644
> --- a/arch/microblaze/include/asm/serial.h
> +++ b/arch/microblaze/include/asm/serial.h
> @@ -1,14 +1 @@
> -/*
> - * Copyright (C) 2009 Michal Simek <[email protected]>
> - *
> - * This file is subject to the terms and conditions of the GNU General Public
> - * License. See the file "COPYING" in the main directory of this archive
> - * for more details.
> - */
> -
> -#ifndef _ASM_MICROBLAZE_SERIAL_H
> -#define _ASM_MICROBLAZE_SERIAL_H
> -
> -# define BASE_BAUD (1843200 / 16)
> -
> -#endif /* _ASM_MICROBLAZE_SERIAL_H */
> +#include <asm-generic/serial.h>
> diff --git a/arch/microblaze/include/asm/shmparam.h b/arch/microblaze/include/asm/shmparam.h
> index 9f5fc2b..93f30de 100644
> --- a/arch/microblaze/include/asm/shmparam.h
> +++ b/arch/microblaze/include/asm/shmparam.h
> @@ -1,6 +1 @@
> -#ifndef _ASM_MICROBLAZE_SHMPARAM_H
> -#define _ASM_MICROBLAZE_SHMPARAM_H
> -
> -#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
> -
> -#endif /* _ASM_MICROBLAZE_SHMPARAM_H */
> +#include <asm-generic/shmparam.h>
> diff --git a/arch/microblaze/include/asm/system.h b/arch/microblaze/include/asm/system.h
> index c4e3088..b1ed615 100644
> --- a/arch/microblaze/include/asm/system.h
> +++ b/arch/microblaze/include/asm/system.h
> @@ -13,6 +13,9 @@
> #include <asm/setup.h>
> #include <asm/irqflags.h>
>
> +#include <asm-generic/cmpxchg.h>
> +#include <asm-generic/cmpxchg-local.h>
> +
> struct task_struct;
> struct thread_info;
>
> diff --git a/arch/microblaze/include/asm/timex.h b/arch/microblaze/include/asm/timex.h
> index 678525d..befcf3d 100644
> --- a/arch/microblaze/include/asm/timex.h
> +++ b/arch/microblaze/include/asm/timex.h
> @@ -9,10 +9,8 @@
> #ifndef _ASM_MICROBLAZE_TIMEX_H
> #define _ASM_MICROBLAZE_TIMEX_H
>
> -#define CLOCK_TICK_RATE 1000 /* Timer input freq. */
> -
> -typedef unsigned long cycles_t;
> +#include <asm-generic/timex.h>
>
> -#define get_cycles() (0)
> +#define CLOCK_TICK_RATE 1000 /* Timer input freq. */
>
> #endif /* _ASM_TIMEX_H */
> diff --git a/arch/microblaze/include/asm/vga.h b/arch/microblaze/include/asm/vga.h
> index 8b13789..89d82fd 100644
> --- a/arch/microblaze/include/asm/vga.h
> +++ b/arch/microblaze/include/asm/vga.h
> @@ -1 +1 @@
> -
> +#include <asm-generic/vga.h>

--
Michal Simek, Ing. (M.Eng)
w: http://www.monstr.eu p: +42-0-721842854

2009-07-01 11:40:16

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [microblaze-uclinux] [PATCH 10/11] microblaze: use generic system.h

On Wednesday 01 July 2009, Michal Simek wrote:
> this patch can't be applied because generic implementation expect pointer to task struct
> but microblaze low level code expect thread_info. I have one patch for MMU kernel which fixed it
> but I don't have it for noMMU kernel.

Ok, just leave it out for now then, it's not important because it does not impact the ABI.

Maybe I should allow overriding switch_to() in the generic file?

Arnd <><
---
asm-generic: make parts of system.h optional

The asm-generic/system.h file was originally meant as an example, but by
letting the architecture override some of its contents, it immediately
becomes much more useful.

Signed-off-by: Arnd Bergmann <[email protected]>

--- a/include/asm-generic/system.h
+++ b/include/asm-generic/system.h
@@ -24,6 +24,7 @@

struct task_struct;

+#ifndef switch_to
/* context switching is now performed out-of-line in switch_to.S */
extern struct task_struct *__switch_to(struct task_struct *,
struct task_struct *);
@@ -31,10 +32,15 @@ extern struct task_struct *__switch_to(struct task_struct *,
do { \
((last) = __switch_to((prev), (next))); \
} while (0)
+#endif

+#ifndef arch_align_stack
#define arch_align_stack(x) (x)
+#endif

+#ifndef nop
#define nop() asm volatile ("nop")
+#define nop

#endif /* !__ASSEMBLY__ */

@@ -46,9 +52,11 @@ extern struct task_struct *__switch_to(struct task_struct *,
* This implementation only contains a compiler barrier.
*/

+#ifndef mb()
#define mb() asm volatile ("": : :"memory")
#define rmb() mb()
#define wmb() asm volatile ("": : :"memory")
+#endif

#ifdef CONFIG_SMP
#define smp_mb() mb()

2009-07-01 11:42:35

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [microblaze-uclinux] [PATCH 03/11] microblaze: fall back on generic header files for the ABI

On Wednesday 01 July 2009, Michal Simek wrote:
> Added to next branch for test.
>
> I had to do one change.
> Microblaze needs __kernel_mode_t as short.

Can you explain why that is needed? Should I change the default in the generic file?

> + I removed __kernel_size_t and I'll recompile toolchain
> for removing warning messages

Ah, good.

Arnd <><

2009-07-01 11:51:50

by Michal Simek

[permalink] [raw]
Subject: Re: [microblaze-uclinux] [PATCH 10/11] microblaze: use generic system.h



Arnd Bergmann wrote:
> On Wednesday 01 July 2009, Michal Simek wrote:
>> this patch can't be applied because generic implementation expect pointer to task struct
>> but microblaze low level code expect thread_info. I have one patch for MMU kernel which fixed it
>> but I don't have it for noMMU kernel.
>
> Ok, just leave it out for now then, it's not important because it does not impact the ABI.
>
> Maybe I should allow overriding switch_to() in the generic file?

I thought about too. Some archs use task pointer some of them thread pointer.

Michal

>
> Arnd <><
> ---
> asm-generic: make parts of system.h optional
>
> The asm-generic/system.h file was originally meant as an example, but by
> letting the architecture override some of its contents, it immediately
> becomes much more useful.
>
> Signed-off-by: Arnd Bergmann <[email protected]>
>
> --- a/include/asm-generic/system.h
> +++ b/include/asm-generic/system.h
> @@ -24,6 +24,7 @@
>
> struct task_struct;
>
> +#ifndef switch_to
> /* context switching is now performed out-of-line in switch_to.S */
> extern struct task_struct *__switch_to(struct task_struct *,
> struct task_struct *);
> @@ -31,10 +32,15 @@ extern struct task_struct *__switch_to(struct task_struct *,
> do { \
> ((last) = __switch_to((prev), (next))); \
> } while (0)
> +#endif
>
> +#ifndef arch_align_stack
> #define arch_align_stack(x) (x)
> +#endif
>
> +#ifndef nop
> #define nop() asm volatile ("nop")
> +#define nop
>
> #endif /* !__ASSEMBLY__ */
>
> @@ -46,9 +52,11 @@ extern struct task_struct *__switch_to(struct task_struct *,
> * This implementation only contains a compiler barrier.
> */
>
> +#ifndef mb()
> #define mb() asm volatile ("": : :"memory")
> #define rmb() mb()
> #define wmb() asm volatile ("": : :"memory")
> +#endif
>
> #ifdef CONFIG_SMP
> #define smp_mb() mb()
> ___________________________
> microblaze-uclinux mailing list
> [email protected]
> Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
> Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
>
>

--
Michal Simek, Ing. (M.Eng)
w: http://www.monstr.eu p: +42-0-721842854

2009-07-01 12:10:17

by Michal Simek

[permalink] [raw]
Subject: Re: [microblaze-uclinux] [PATCH 03/11] microblaze: fall back on generic header files for the ABI



Arnd Bergmann wrote:
> On Wednesday 01 July 2009, Michal Simek wrote:
>> Added to next branch for test.
>>
>> I had to do one change.
>> Microblaze needs __kernel_mode_t as short.
>
> Can you explain why that is needed? Should I change the default in the generic file?

I did this change because of problem with inconsistency between kernel/glibc.

Current our glibc ipc_perm struct - mode is short - that's why I have setup kernel_mode_t to short too.

/* Data structure used to pass permission information to IPC operations. */
struct ipc_perm
{
__key_t __key; /* Key. */
__uid_t uid; /* Owner's user ID. */
__gid_t gid; /* Owner's group ID. */
__uid_t cuid; /* Creator's user ID. */
__gid_t cgid; /* Creator's group ID. */
unsigned short int mode; /* Read/write permission. */
unsigned short int __seq; /* Sequence number. */
unsigned short int __pad1;
unsigned long int __unused1;
unsigned long int __unused2;
};

Does it make more sense to define it as int?

Michal

>
>> + I removed __kernel_size_t and I'll recompile toolchain
>> for removing warning messages
>
> Ah, good.
>
> Arnd <><
> ___________________________
> microblaze-uclinux mailing list
> [email protected]
> Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
> Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
>
>

--
Michal Simek, Ing. (M.Eng)
w: http://www.monstr.eu p: +42-0-721842854

2009-07-01 13:42:18

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [microblaze-uclinux] [PATCH 03/11] microblaze: fall back on generic header files for the ABI

On Wednesday 01 July 2009, Michal Simek wrote:
> I did this change because of problem with inconsistency between kernel/glibc.
>
> Current our glibc ipc_perm struct - mode is short - that's why I have setup kernel_mode_t to short too.
>
> /* Data structure used to pass permission information to IPC operations. */
> struct ipc_perm
> {
> __key_t __key; /* Key. */
> __uid_t uid; /* Owner's user ID. */
> __gid_t gid; /* Owner's group ID. */
> __uid_t cuid; /* Creator's user ID. */
> __gid_t cgid; /* Creator's group ID. */
> unsigned short int mode; /* Read/write permission. */
> unsigned short int __seq; /* Sequence number. */
> unsigned short int __pad1;
> unsigned long int __unused1;
> unsigned long int __unused2;
> };
>
> Does it make more sense to define it as int?

It's more complex than this.

AFAICT, it does not matter at all whether you define it as 16 or 32 bits,
as long as it all fits together. For the generic ABI, I used 32 bits where
they were commonly used by some architectures, because there are processors
that can more efficiently access 32 bit words than 16 bit words.

One major reason for starting the asm-generic ABI definitions was to make
sure that all architectures that don't have their ABI set in stone can
use the exact same ABI, and if you change just a small thing, you would still
diverge from the common ABI.

Now the definition you give above matches neither the one from your current
kernel header nor the one from the asm-generic file, because of the location
of the padding. Worse, the __pad1 field actually causes implicit padding instead
of preventing it.

I think you should just update your glibc files to match the generic kernel
headers, because changing the ABI means that you have to change other parts
of glibc anyway and to recompile every single user space program anyway.
Doing one more change won't hurt that much either.

Arnd <><

2009-07-01 22:52:39

by John Williams

[permalink] [raw]
Subject: Re: [microblaze-uclinux] [PATCH 03/11] microblaze: fall back on generic header files for the ABI

Hi Michal, Arnd,

On Wed, Jul 1, 2009 at 9:34 PM, Michal Simek<[email protected]> wrote:
> Added to next branch for test.
>
> I had to do one change.
> Microblaze needs __kernel_mode_t as short.
>
> + I removed __kernel_size_t and I'll recompile toolchain
> for removing warning messages

We need to be a little bit mindful here regarding which of the
asm-generic changes we merge immediately.

Ones that do not change the ABI at all, but simply pull from
asm-generic instead of asm-microblaze are obviously fine (identical
structures, bitfields etc).

However, we've just "broken" the ABI in 2.6.31, if we merge further
ABI breakage in 2.6.32 it's more pain and confusion.

So, unless we can merge and validate this ABI breakage during the
2.6.31-rc cycle, I think we need to hold on changes that would break
the ABI again, so soon.

Longer term there will be a complete redo of glibc up to the latest
version, which will obviously require a new toolchain for users - I
think that is the right place to do the next round of ABI breakage.

Any thoughts?

John
--
John Williams, PhD, B.Eng, B.IT
PetaLogix - Linux Solutions for a Reconfigurable World
w: http://www.petalogix.com p: +61-7-30090663 f: +61-7-30090663

2009-07-02 09:36:28

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [microblaze-uclinux] [PATCH 03/11] microblaze: fall back on generic header files for the ABI

On Thursday 02 July 2009, John Williams wrote:
> However, we've just "broken" the ABI in 2.6.31, if we merge further
> ABI breakage in 2.6.32 it's more pain and confusion.
>
> So, unless we can merge and validate this ABI breakage during the
> 2.6.31-rc cycle, I think we need to hold on changes that would break
> the ABI again, so soon.
>
> Longer term there will be a complete redo of glibc up to the latest
> version, which will obviously require a new toolchain for users - I
> think that is the right place to do the next round of ABI breakage.
>
> Any thoughts?

Normally the rule is to never break the ABI at all, even in a major
update of glibc.

Initially I had hoped that we could do the change before 2.6.30 and
I worked hard on getting the ABI patches to you early enough for
that. After that failed, I made sure that you had everything in
place for 2.6.31 and I believed that Michal said he would integrate
that in the microblaze-mmu merge, before you actually start seeing
users on the mainline kernel.

If we don't get that into 2.6.31 any more (and the chances
have slimmed down a lot after the end of the merge window), I
think we should just declare complete failure and not touch
the ABI any more, however broken it may be.

In over 14 months, not even the most basic fixes to the ABI
that I mentioned in the first review have been applied:

On Tuesday 15 April 2008, Michal Simek wrote:
> Arnd Bergmann wrote:
> > * Your syscall ABI is largely obsolete. A third of the syscalls you
> > define should not even be there in the first place as they have been
> > replaced by newer versions. E.g. you have select, _newselect and pselect6,
> > where just pselect6 would be sufficient -- you don't need to worry about
> > backwards compatibility if you don't have existing code. A good start
> > would be to take the arch/blackfin syscall list and further reduce it
> > from there. Further examples are:
> > - replace socketcall with separate syscall entry points
> > - replace ipc with a separate entry points
> > - remove all the legacy signal handling from arch/microblaze/kernel/signal.c
> > - remove sys_mmap, sys_olduname and sys_vfork
> > - finally define a generic sys_mmap2 and sys_uname in kernel/ so you don't
> > need another copy in arch/microblaze/kernel
> > - Use 64 bit off_t, and 32 bit uid_t, gid_t etc.
>
> This kernel don't need to keep backward compatibility. No one will port to
> previous version. I'll look at your points and I'll send you what I do.

Arnd <><

2009-07-03 05:55:25

by Michal Simek

[permalink] [raw]
Subject: Re: [microblaze-uclinux] [PATCH 03/11] microblaze: fall back on generic header files for the ABI



Arnd Bergmann wrote:
> On Thursday 02 July 2009, John Williams wrote:
>> However, we've just "broken" the ABI in 2.6.31, if we merge further
>> ABI breakage in 2.6.32 it's more pain and confusion.
>>
>> So, unless we can merge and validate this ABI breakage during the
>> 2.6.31-rc cycle, I think we need to hold on changes that would break
>> the ABI again, so soon.
>>
>> Longer term there will be a complete redo of glibc up to the latest
>> version, which will obviously require a new toolchain for users - I
>> think that is the right place to do the next round of ABI breakage.
>>
>> Any thoughts?
>
> Normally the rule is to never break the ABI at all, even in a major
> update of glibc.
>
> Initially I had hoped that we could do the change before 2.6.30 and
> I worked hard on getting the ABI patches to you early enough for
> that. After that failed, I made sure that you had everything in
> place for 2.6.31 and I believed that Michal said he would integrate
> that in the microblaze-mmu merge, before you actually start seeing
> users on the mainline kernel.

we are talking about minor change - I know it break ABI a little bit
but don't be scared with it.
Two changes - first ssize_t is no problem - just warning messages
Second change kernel_mode_t from short to int breaks only ipc structures.
We are working on solving problem about another IPC trouble. I found a problem with
some syscalls which needs to be fixed in kernel and glibc - we will need newest toolchain
for it in any case. John just wanted to be sure that we will have working correct version.
I added most of your patches to my next branch for testing. I expect that Stephen merge it to next soon.

Thanks for your work,
Michal


>
> If we don't get that into 2.6.31 any more (and the chances
> have slimmed down a lot after the end of the merge window), I
> think we should just declare complete failure and not touch
> the ABI any more, however broken it may be.
>
> In over 14 months, not even the most basic fixes to the ABI
> that I mentioned in the first review have been applied:
>
> On Tuesday 15 April 2008, Michal Simek wrote:
>> Arnd Bergmann wrote:
>>> * Your syscall ABI is largely obsolete. A third of the syscalls you
>>> define should not even be there in the first place as they have been
>>> replaced by newer versions. E.g. you have select, _newselect and pselect6,
>>> where just pselect6 would be sufficient -- you don't need to worry about
>>> backwards compatibility if you don't have existing code. A good start
>>> would be to take the arch/blackfin syscall list and further reduce it
>>> from there. Further examples are:
>>> - replace socketcall with separate syscall entry points
>>> - replace ipc with a separate entry points
>>> - remove all the legacy signal handling from arch/microblaze/kernel/signal.c
>>> - remove sys_mmap, sys_olduname and sys_vfork
>>> - finally define a generic sys_mmap2 and sys_uname in kernel/ so you don't
>>> need another copy in arch/microblaze/kernel
>>> - Use 64 bit off_t, and 32 bit uid_t, gid_t etc.
>> This kernel don't need to keep backward compatibility. No one will port to
>> previous version. I'll look at your points and I'll send you what I do.
>
> Arnd <><
> ___________________________
> microblaze-uclinux mailing list
> [email protected]
> Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
> Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
>
>

--
Michal Simek, Ing. (M.Eng)
w: http://www.monstr.eu p: +42-0-721842854

2009-07-03 17:16:43

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [microblaze-uclinux] [PATCH 03/11] microblaze: fall back on generic header files for the ABI

On Friday 03 July 2009, Michal Simek wrote:
>
> > Initially I had hoped that we could do the change before 2.6.30 and
> > I worked hard on getting the ABI patches to you early enough for
> > that. After that failed, I made sure that you had everything in
> > place for 2.6.31 and I believed that Michal said he would integrate
> > that in the microblaze-mmu merge, before you actually start seeing
> > users on the mainline kernel.
>
> we are talking about minor change - I know it break ABI a little bit
> but don't be scared with it.

The data structures are all compatible by now, with this one exception.
__kernel_mode_t is easy enough to fix in the generic headers if it
really helps.

My frustration is only about the system call list, which has
not been fixed, and which will cause a significant ABI break
once you change it. If you are lucky, most applications will still
work after you install a matching libc, but you still get a
cross-dependency between libc and the kernel.

This means you may not want to really use the generic syscall numbers,
but at least you should make sure that your table is consistent.
FWIW, below you find a list of inconsistencies.

Arnd <><

System calls that have a number but are missing an entry in your sys_call_table:

sys_preadv
sys_pwritev
sys_pselect6
sys_ppoll
sys_sigaltstack
sys_migrate_pages /* not needed */
sys_futimesat /* not needed */

System call numbers you might need for binary compatiblily and
should have removed earlier:
__NR_waitpid
__NR_stime
__NR_nice
__NR_oldstat
__NR_oldfstat
__NR_oldlstat
__NR_sigaction
__NR_sgetmask
__NR_ssetmask
__NR_sigsuspend
__NR_sigpending
__NR_socketcall
__NR_readdir
__NR_sigreturn
__NR_sigprocmask
__NR_ipc
__NR_sysfs

Numbers that you really really should simply not #define, with no
chance of breaking anything:
__NR_break
__NR_stty
__NR_gtty
__NR_ftime
__NR_prof
__NR_lock
__NR_mpx
__NR_ulimit
__NR_oldolduname
__NR_profil
__NR_ioperm
__NR_olduname
__NR_iopl
__NR_idle
__NR_vm86old
__NR_modify_ldt
__NR_create_module
__NR_get_kernel_syms
__NR_afs_syscall
__NR__newselect
__NR_vm86
__NR_query_module
__NR_getpmsg
__NR_putpmsg
__NR_ugetrlimit
__NR_set_thread_area
__NR_get_thread_area
__NR_vserver
__NR_accept04 /* typo? */

Duplicate system call numbers:
__NR_lchown32
__NR_getuid32
__NR_getgid32
__NR_geteuid32
__NR_getegid32
__NR_setreuid32
__NR_setregid32
__NR_getgroups32
__NR_setgroups32
__NR_fchown32
__NR_setresuid32
__NR_getresuid32
__NR_setresgid32
__NR_getresgid32
__NR_chown32
__NR_setuid32
__NR_setgid32
__NR_setfsuid32
__NR_setfsgid32

Arnd <><