From: Dave A. <ai...@us...> - 2001-03-11 22:06:07
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/lib In directory usw-pr-cvs1:/tmp/cvs-serv13134 Modified Files: Makefile string_user.c strncpy_user.S Added Files: copy_tofrom_user.S Log Message: initial copy to/from user implementation.. this is a) not what I'd call tuned.. b) maybe missing something in the faulting path c) works for me (tm) :-) also moved strncpy_from_user to a use EX macro --- NEW FILE --- /* * $Id: copy_tofrom_user.S,v 1.1 2001/03/11 22:08:00 airlied Exp $ * * Copyright (C) 2001, Dave Airlie * * VAX Assembly implementation of copy_tofrom_user */ #include <asm/errno.h> #include <linux/linkage.h> /* * int __copy_tofrom_user(void *to, const void *from, unsigned long size); */ #define EX(insn, arg0, arg1, handler) \ 9: insn arg0, arg1; \ .section __ex_table, "a"; \ .long 9b, handler; \ .previous .text ENTRY(__copy_tofrom_user) .word 0x3e movl 4(ap), r2 /* to in r2 */ movl 8(ap), r3 /* from in r3 */ movl 12(ap), r0 /* size in r0 */ 1: EX(movb, (r3)+, r4, l_fixup) EX(movb, r4, (r2)+, s_fixup) sobgtr r0, 1b ret .section .fixup,"ax" .align 4 l_fixup: s_fixup: ret .previous Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/lib/Makefile,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- Makefile 2001/03/11 14:00:58 1.9 +++ Makefile 2001/03/11 22:08:00 1.10 @@ -12,7 +12,7 @@ all: libio.a L_TARGET := libio.a -obj-y := string.o string_user.o console.o negdi.o checksum.o lshrdi3.o strncpy_user.o +obj-y := string.o string_user.o console.o negdi.o checksum.o lshrdi3.o strncpy_user.o copy_tofrom_user.o include $(TOPDIR)/Rules.make Index: string_user.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/lib/string_user.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- string_user.c 2001/03/11 14:00:58 1.2 +++ string_user.c 2001/03/11 22:08:00 1.3 @@ -10,12 +10,6 @@ #include <linux/kernel.h> /* for panic() */ -int __copy_tofrom_user(void *to, const void *from, unsigned long size) -{ - panic("__copy_tofrom_user: not implemented"); -} - - unsigned long __clear_user(void *addr, unsigned long size) { panic("__clear_user: not implemented"); Index: strncpy_user.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/lib/strncpy_user.S,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- strncpy_user.S 2001/03/11 14:00:58 1.1 +++ strncpy_user.S 2001/03/11 22:08:00 1.2 @@ -1,5 +1,5 @@ /* - * $ID$ + * $Id$ * * Copyright (C) 2001, Dave Airlie * @@ -13,6 +13,12 @@ * Returns number of bytes copied */ +#define EX(insn, addr, reg, handler) \ +9: insn addr, reg; \ + .section __ex_table, "a"; \ + .long 9b, handler; \ + .previous + .text ENTRY(__strncpy_from_user) .word 0x3e @@ -21,7 +27,7 @@ movl 12(ap), r0 /* r0 has count */ movl r0, r1 /* keep count in r1 */ beql 2f -1: movb (r3)+, r4 +1: EX(movb, (r3)+, r4, fault) movb r4, (r2)+ cmpb $0, r4 beql 2f @@ -29,10 +35,6 @@ 2: subl2 r1, r0 ret .section .fixup, "ax" -3: movl r0, -EFAULT +fault: movl r0, -EFAULT ret .previous - .section __ex_table, "a" - .align 4 - .long 1b, 3b - .previous \ No newline at end of file |