2009-06-09 06:38:45

by Chen Liqin

[permalink] [raw]
Subject: [PATCH 18/27] score: create head files uaccess.h unaligned.h unistd.h user.h

>From dccb8b53daf3a5a6e312aabcabdab42b558f95e6 Mon Sep 17 00:00:00 2001
From: Chen Liqin <[email protected]>
Date: Tue, 9 Jun 2009 13:43:15 +0800
Subject: [PATCH 18/27] score: create head files uaccess.h unaligned.h
unistd.h user.h


Signed-off-by: Chen Liqin <[email protected]>
---
arch/score/include/asm/uaccess.h | 27 +++++++++++++++++++++++++++
arch/score/include/asm/unaligned.h | 11 +++++++++++
arch/score/include/asm/unistd.h | 12 ++++++++++++
arch/score/include/asm/user.h | 4 ++++
4 files changed, 54 insertions(+), 0 deletions(-)
create mode 100644 arch/score/include/asm/uaccess.h
create mode 100644 arch/score/include/asm/unaligned.h
create mode 100644 arch/score/include/asm/unistd.h
create mode 100644 arch/score/include/asm/user.h

diff --git a/arch/score/include/asm/uaccess.h
b/arch/score/include/asm/uaccess.h
new file mode 100644
index 0000000..43ce28a
--- /dev/null
+++ b/arch/score/include/asm/uaccess.h
@@ -0,0 +1,27 @@
+#ifndef _ASM_SCORE_UACCESS_H
+#define _ASM_SCORE_UACCESS_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.
+ */
+struct pt_regs;
+extern int fixup_exception(struct pt_regs *regs);
+
+#ifndef __ASSEMBLY__
+
+#define __range_ok(addr, size) \
+ ((((unsigned long)(addr) >= 0x80000000) \
+ || ((unsigned long)(size) > 0x80000000) \
+ || (((unsigned long)(addr) + (unsigned long)(size)) >
0x80000000)))
+
+#define __access_ok(addr, size) \
+ (__range_ok((addr), (size)) == 0)
+
+#include <asm-generic/uaccess.h>
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_SCORE_UACCESS_H */
diff --git a/arch/score/include/asm/unaligned.h
b/arch/score/include/asm/unaligned.h
new file mode 100644
index 0000000..4b8fec0
--- /dev/null
+++ b/arch/score/include/asm/unaligned.h
@@ -0,0 +1,11 @@
+#ifndef _ASM_SCORE_UNALIGNED_H
+#define _ASM_SCORE_UNALIGNED_H
+
+#include <linux/unaligned/le_struct.h>
+#include <linux/unaligned/be_byteshift.h>
+#include <linux/unaligned/generic.h>
+
+#define get_unaligned __get_unaligned_le
+#define put_unaligned __put_unaligned_le
+
+#endif /* _ASM_SCORE_UNALIGNED_H */
diff --git a/arch/score/include/asm/unistd.h
b/arch/score/include/asm/unistd.h
new file mode 100644
index 0000000..0cbfef8
--- /dev/null
+++ b/arch/score/include/asm/unistd.h
@@ -0,0 +1,12 @@
+#ifndef _ASM_SCORE_UNISTD_H
+#define _ASM_SCORE_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
+
+#include <asm-generic/unistd.h>
+
+#endif /* _ASM_SCORE_UNISTD_H */
diff --git a/arch/score/include/asm/user.h b/arch/score/include/asm/user.h
new file mode 100644
index 0000000..3cf7572
--- /dev/null
+++ b/arch/score/include/asm/user.h
@@ -0,0 +1,4 @@
+#ifndef _ASM_SCORE_USER_H
+#define _ASM_SCORE_USER_H
+
+#endif /* _ASM_SCORE_USER_H */
--
1.6.2


2009-06-09 17:46:32

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 18/27] score: create head files uaccess.h unaligned.h unistd.h user.h

On Tuesday 09 June 2009, [email protected] wrote:

> diff --git a/arch/score/include/asm/unaligned.h
> b/arch/score/include/asm/unaligned.h
> new file mode 100644
> index 0000000..4b8fec0
> --- /dev/null
> +++ b/arch/score/include/asm/unaligned.h
> @@ -0,0 +1,11 @@
> +#ifndef _ASM_SCORE_UNALIGNED_H
> +#define _ASM_SCORE_UNALIGNED_H
> +
> +#include <linux/unaligned/le_struct.h>
> +#include <linux/unaligned/be_byteshift.h>
> +#include <linux/unaligned/generic.h>
> +
> +#define get_unaligned __get_unaligned_le
> +#define put_unaligned __put_unaligned_le
> +
> +#endif /* _ASM_SCORE_UNALIGNED_H */

Any reason not to use the asm-generic version of this file?
If it didn't work, that is probably a bug in my code, not
yours, but they really look compatible.

> diff --git a/arch/score/include/asm/unistd.h
> b/arch/score/include/asm/unistd.h
> new file mode 100644
> index 0000000..0cbfef8
> --- /dev/null
> +++ b/arch/score/include/asm/unistd.h
> @@ -0,0 +1,12 @@
> +#ifndef _ASM_SCORE_UNISTD_H
> +#define _ASM_SCORE_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
> +
> +#include <asm-generic/unistd.h>

I realize that this is the code I added to microblaze in my tree.
However, the four __ARCH_WANT_SYSCALL_* definitions are really
only meant as a transitional helper to get your code ported
from the older ABI. They should be removed from your file in
order to get the short system call list. Have you tried this?

In order to get there, you probably need to add a lot of wrappers
to libc along the lines of

int unlink(const char *pathname)
{
return unlinkat(AT_FDCWD, pathname, 0);
}

Arnd <><