summaryrefslogtreecommitdiffstats
path: root/arch/mips/lib
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-04-29 21:13:14 +0000
committer <ralf@linux-mips.org>1997-04-29 21:13:14 +0000
commit19c9bba94152148523ba0f7ef7cffe3d45656b11 (patch)
tree40b1cb534496a7f1ca0f5c314a523c69f1fee464 /arch/mips/lib
parent7206675c40394c78a90e74812bbdbf8cf3cca1be (diff)
Import of Linux/MIPS 2.1.36
Diffstat (limited to 'arch/mips/lib')
-rw-r--r--arch/mips/lib/checksum.c25
-rw-r--r--arch/mips/lib/dump_tlb.c1
-rw-r--r--arch/mips/lib/memcpy.S1
-rw-r--r--arch/mips/lib/strlen_user.S2
-rw-r--r--arch/mips/lib/strncpy_user.S2
-rw-r--r--arch/mips/lib/tags.c3
6 files changed, 26 insertions, 8 deletions
diff --git a/arch/mips/lib/checksum.c b/arch/mips/lib/checksum.c
index dd1583892..ee48f659a 100644
--- a/arch/mips/lib/checksum.c
+++ b/arch/mips/lib/checksum.c
@@ -16,6 +16,7 @@
*/
#include <net/checksum.h>
#include <asm/string.h>
+#include <asm/uaccess.h>
static inline unsigned short from32to16(unsigned long x)
{
@@ -93,16 +94,34 @@ unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum)
* copy while checksumming, otherwise like csum_partial
*/
unsigned int csum_partial_copy(const char *src, char *dst,
- int len, unsigned int sum)
+ int len, unsigned int sum)
{
/*
* It's 2:30 am and I don't feel like doing it real ...
* This is lots slower than the real thing (tm)
- *
- * XXX This may nuke the kernel for unaligned src addresses!!!
*/
sum = csum_partial(src, len, sum);
memcpy(dst, src, len);
return sum;
}
+
+/*
+ * Copy from userspace and compute checksum. If we catch an exception
+ * then zero the rest of the buffer.
+ */
+unsigned int csum_partial_copy_from_user (const char *src, char *dst,
+ int len, unsigned int sum,
+ int *err_ptr)
+{
+ int *dst_err_ptr=NULL;
+ int missing;
+
+ missing = copy_from_user(dst, src, len);
+ if (missing) {
+ memset(dst + len - missing, 0, missing);
+ *err_ptr = -EFAULT;
+ }
+
+ return csum_partial(dst, len, sum);
+}
diff --git a/arch/mips/lib/dump_tlb.c b/arch/mips/lib/dump_tlb.c
index 1ee4c79f0..5232e84db 100644
--- a/arch/mips/lib/dump_tlb.c
+++ b/arch/mips/lib/dump_tlb.c
@@ -15,7 +15,6 @@
#include <asm/mipsregs.h>
#include <asm/page.h>
#include <asm/pgtable.h>
-#include <asm/segment.h>
void
dump_tlb(int first, int last)
diff --git a/arch/mips/lib/memcpy.S b/arch/mips/lib/memcpy.S
index 8039d21ae..95639cb01 100644
--- a/arch/mips/lib/memcpy.S
+++ b/arch/mips/lib/memcpy.S
@@ -10,7 +10,6 @@
#include <asm/asm.h>
#include <asm/regdef.h>
-#include <asm/segment.h>
#define MOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5) \
lw t0, (offset + 0x18)(src); \
diff --git a/arch/mips/lib/strlen_user.S b/arch/mips/lib/strlen_user.S
index 3569313ba..c42144b35 100644
--- a/arch/mips/lib/strlen_user.S
+++ b/arch/mips/lib/strlen_user.S
@@ -27,7 +27,7 @@ LEAF(__strlen_user)
.section __ex_table,"a"
PTR 1b,fault
- .text
+ .previous
fault: move v0,zero
jr ra
diff --git a/arch/mips/lib/strncpy_user.S b/arch/mips/lib/strncpy_user.S
index 4230ffe6d..f942740e6 100644
--- a/arch/mips/lib/strncpy_user.S
+++ b/arch/mips/lib/strncpy_user.S
@@ -45,4 +45,4 @@ fault: li v0,-EFAULT
.section __ex_table,"a"
PTR 1b,fault
- .text
+ .previous
diff --git a/arch/mips/lib/tags.c b/arch/mips/lib/tags.c
index 5425db712..9a2e3cd73 100644
--- a/arch/mips/lib/tags.c
+++ b/arch/mips/lib/tags.c
@@ -1,11 +1,12 @@
/*
- * linux/arch/mips/kernel/tags.c
+ * linux/arch/mips/lib/tags.c
*
* Copyright (C) 1996 Stoned Elipot
*/
#include <linux/stddef.h>
#include <linux/kernel.h>
#include <linux/string.h>
+#include <asm/addrspace.h>
#include <asm/bootinfo.h>
/*