From: Kenn H. <ke...@us...> - 2001-01-29 00:59:35
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/lib In directory usw-pr-cvs1:/tmp/cvs-serv27962 Modified Files: string.c Log Message: Now we have a memset() that actually works... Index: string.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/lib/string.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- string.c 2001/01/26 00:27:00 1.2 +++ string.c 2001/01/29 00:59:26 1.3 @@ -206,23 +206,21 @@ #ifdef __HAVE_ARCH_MEMSET void * memset(void * s, int c , __kernel_size_t count) { - char *xs = (char *) s; - - while (count > 0xffff) { - asm("movc5 $0, 0, %0, $0xffff, *%1" - : /* no outputs */ - : "g" (c), "g" (xs) - : "r0", "r1", "r2", "r3", "r4", "r5" - /* r0 to r5 get clobbered */ ); - count -= 0xffff; - } - if (count != 0) { - asm("movc5 $0, 0, %0, %1, *%2" - : /* no outputs */ - : "g" (c), "g" (count), "g" (xs) - : "r0", "r1", "r2", "r3", "r4", "r5" - /* r0 to r5 get clobbered */ ); - } + asm ( + " movl %2, r6 \n" /* R6 holds bytes left */ + " movl %0, r3 \n" /* dest in R3 */ + " movl $0xffff, r7 \n" /* R7 always holds 65535 */ + " next_chunk: \n" + " cmpl r6, r7 \n" + " blequ last_chunk \n" /* < 65535 bytes left */ + " movc5 $0, 0, %1, r7, (r3) \n" /* MOVC5 updates R3 for us */ + " subl2 r7, r6 \n" + " brb next_chunk \n" + "last_chunk: \n" + " movc5 $0, 0, %1, r6, (r3) " + : /* no outputs */ + : "g" (s), "g" (c), "g" (count) + : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7"); return s; } |