diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-06-25 01:20:01 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-06-25 01:20:01 +0000 |
commit | 3797ba0b62debb71af4606910acacc9896a9ae3b (patch) | |
tree | 414eea76253c7871bfdf3bd9d1817771eb40917c /arch/ia64/lib | |
parent | 2b6c0c580795a4404f72d2a794214dd9e080709d (diff) |
Merge with Linux 2.4.0-test2.
Diffstat (limited to 'arch/ia64/lib')
-rw-r--r-- | arch/ia64/lib/Makefile | 14 | ||||
-rw-r--r-- | arch/ia64/lib/clear_page.S | 18 | ||||
-rw-r--r-- | arch/ia64/lib/clear_user.S | 23 | ||||
-rw-r--r-- | arch/ia64/lib/copy_page.S | 16 | ||||
-rw-r--r-- | arch/ia64/lib/copy_user.S | 18 | ||||
-rw-r--r-- | arch/ia64/lib/do_csum.S | 15 | ||||
-rw-r--r-- | arch/ia64/lib/flush.S | 17 | ||||
-rw-r--r-- | arch/ia64/lib/idiv.S | 14 | ||||
-rw-r--r-- | arch/ia64/lib/io.c | 54 | ||||
-rw-r--r-- | arch/ia64/lib/memset.S | 18 | ||||
-rw-r--r-- | arch/ia64/lib/strlen.S | 16 | ||||
-rw-r--r-- | arch/ia64/lib/strlen_user.S | 16 | ||||
-rw-r--r-- | arch/ia64/lib/strncpy_from_user.S | 10 | ||||
-rw-r--r-- | arch/ia64/lib/strnlen_user.S | 15 |
14 files changed, 177 insertions, 87 deletions
diff --git a/arch/ia64/lib/Makefile b/arch/ia64/lib/Makefile index 376d0d6d4..882bdaed9 100644 --- a/arch/ia64/lib/Makefile +++ b/arch/ia64/lib/Makefile @@ -5,15 +5,21 @@ .S.o: $(CC) $(AFLAGS) -c $< -o $@ -OBJS = __divdi3.o __divsi3.o __udivdi3.o __udivsi3.o \ +L_TARGET = lib.a + +L_OBJS = __divdi3.o __divsi3.o __udivdi3.o __udivsi3.o \ __moddi3.o __modsi3.o __umoddi3.o __umodsi3.o \ checksum.o clear_page.o csum_partial_copy.o copy_page.o \ copy_user.o clear_user.o memset.o strncpy_from_user.o \ strlen.o strlen_user.o strnlen_user.o \ flush.o do_csum.o -lib.a: $(OBJS) - $(AR) rcs lib.a $(OBJS) +LX_OBJS = io.o + +IGNORE_FLAGS_OBJS = __divdi3.o __divsi3.o __udivdi3.o __udivsi3.o \ + __moddi3.o __modsi3.o __umoddi3.o __umodsi3.o + +include $(TOPDIR)/Rules.make __divdi3.o: idiv.S $(CC) $(AFLAGS) -c -o $@ $< @@ -38,5 +44,3 @@ __umoddi3.o: idiv.S __umodsi3.o: idiv.S $(CC) $(AFLAGS) -c -DMODULO -DUNSIGNED -DSINGLE -c -o $@ $< - -include $(TOPDIR)/Rules.make diff --git a/arch/ia64/lib/clear_page.S b/arch/ia64/lib/clear_page.S index 314311c5c..c544e3725 100644 --- a/arch/ia64/lib/clear_page.S +++ b/arch/ia64/lib/clear_page.S @@ -10,10 +10,11 @@ * Output: * none * - * Copyright (C) 1999 Hewlett-Packard Co + * Copyright (C) 1999-2000 Hewlett-Packard Co * Copyright (C) 1999 Stephane Eranian <eranian@hpl.hp.com> - * Copyright (C) 1999 David Mosberger-Tang <davidm@hpl.hp.com> + * Copyright (C) 1999-2000 David Mosberger-Tang <davidm@hpl.hp.com> */ +#include <asm/asmmacro.h> #include <asm/page.h> .text @@ -21,12 +22,14 @@ .psr lsb .lsb - .align 32 - .global clear_page - .proc clear_page -clear_page: +GLOBAL_ENTRY(clear_page) + UNW(.prologue) alloc r11=ar.pfs,1,0,0,0 + UNW(.save ar.lc, r16) mov r16=ar.lc // slow + + UNW(.body) + mov r17=PAGE_SIZE/32-1 // -1 = repeat/until ;; adds r18=16,in0 @@ -38,5 +41,4 @@ clear_page: ;; mov ar.lc=r16 // restore lc br.ret.sptk.few rp - - .endp clear_page +END(clear_page) diff --git a/arch/ia64/lib/clear_user.S b/arch/ia64/lib/clear_user.S index 0b9a453b1..d937db016 100644 --- a/arch/ia64/lib/clear_user.S +++ b/arch/ia64/lib/clear_user.S @@ -11,6 +11,8 @@ * Copyright (C) 1999 Stephane Eranian <eranian@hpl.hp.com> */ +#include <asm/asmmacro.h> + // // arguments // @@ -23,11 +25,10 @@ #define cnt r16 #define buf2 r17 #define saved_lc r18 -#define saved_pr r19 -#define saved_pfs r20 -#define tmp r21 -#define len2 r22 -#define len3 r23 +#define saved_pfs r19 +#define tmp r20 +#define len2 r21 +#define len3 r22 // // Theory of operations: @@ -65,14 +66,14 @@ .psr lsb .lsb - .align 32 - .global __do_clear_user - .proc __do_clear_user - -__do_clear_user: +GLOBAL_ENTRY(__do_clear_user) + UNW(.prologue) + UNW(.save ar.pfs, saved_pfs) alloc saved_pfs=ar.pfs,2,0,0,0 cmp.eq p6,p0=r0,len // check for zero length + UNW(.save ar.lc, saved_lc) mov saved_lc=ar.lc // preserve ar.lc (slow) + .body ;; // avoid WAW on CFM adds tmp=-1,len // br.ctop is repeat/until mov ret0=len // return value is length at this point @@ -222,4 +223,4 @@ long_do_clear: mov ret0=len mov ar.lc=saved_lc br.ret.dptk.few rp - .endp +END(__do_clear_user) diff --git a/arch/ia64/lib/copy_page.S b/arch/ia64/lib/copy_page.S index 7595ac83a..811db4c96 100644 --- a/arch/ia64/lib/copy_page.S +++ b/arch/ia64/lib/copy_page.S @@ -13,6 +13,7 @@ * Copyright (C) 1999 Hewlett-Packard Co * Copyright (C) 1999 Stephane Eranian <eranian@hpl.hp.com> */ +#include <asm/asmmacro.h> #include <asm/page.h> #define PIPE_DEPTH 6 @@ -32,19 +33,21 @@ .psr lsb .lsb - .align 32 - .global copy_page - .proc copy_page - -copy_page: +GLOBAL_ENTRY(copy_page) + UNW(.prologue) + UNW(.save ar.pfs, saved_pfs) alloc saved_pfs=ar.pfs,3,((2*PIPE_DEPTH+7)&~7),0,((2*PIPE_DEPTH+7)&~7) .rotr t1[PIPE_DEPTH], t2[PIPE_DEPTH] .rotp p[PIPE_DEPTH] + UNW(.save ar.lc, saved_lc) mov saved_lc=ar.lc // save ar.lc ahead of time + UNW(.save pr, saved_pr) mov saved_pr=pr // rotating predicates are preserved // resgisters we must save. + UNW(.body) + mov src1=in1 // initialize 1st stream source adds src2=8,in1 // initialize 2nd stream source mov lcount=PAGE_SIZE/16-1 // as many 16bytes as there are on a page @@ -87,5 +90,4 @@ copy_page: mov ar.pfs=saved_pfs // restore ar.ec mov ar.lc=saved_lc // restore saved lc br.ret.sptk.few rp // bye... - - .endp copy_page +END(copy_page) diff --git a/arch/ia64/lib/copy_user.S b/arch/ia64/lib/copy_user.S index 3743174ba..4a0abaed0 100644 --- a/arch/ia64/lib/copy_user.S +++ b/arch/ia64/lib/copy_user.S @@ -29,6 +29,8 @@ * - fix extraneous stop bit introduced by the EX() macro. */ +#include <asm/asmmacro.h> + // The label comes first because our store instruction contains a comma // and confuse the preprocessor otherwise // @@ -81,10 +83,9 @@ .psr abi64 .psr lsb - .align 16 - .global __copy_user - .proc __copy_user -__copy_user: +GLOBAL_ENTRY(__copy_user) + UNW(.prologue) + UNW(.save ar.pfs, saved_pfs) alloc saved_pfs=ar.pfs,3,((2*PIPE_DEPTH+7)&~7),0,((2*PIPE_DEPTH+7)&~7) .rotr val1[PIPE_DEPTH],val2[PIPE_DEPTH] @@ -95,13 +96,17 @@ __copy_user: ;; // RAW of cfm when len=0 cmp.eq p8,p0=r0,len // check for zero length + UNW(.save ar.lc, saved_lc) mov saved_lc=ar.lc // preserve ar.lc (slow) (p8) br.ret.spnt.few rp // empty mempcy() ;; add enddst=dst,len // first byte after end of source add endsrc=src,len // first byte after end of destination + UNW(.save pr, saved_pr) mov saved_pr=pr // preserve predicates + UNW(.body) + mov dst1=dst // copy because of rotation mov ar.ec=PIPE_DEPTH mov pr.rot=1<<16 // p16=true all others are false @@ -400,7 +405,4 @@ failure_out: mov ar.pfs=saved_pfs br.ret.dptk.few rp - - - .endp __copy_user - +END(__copy_user) diff --git a/arch/ia64/lib/do_csum.S b/arch/ia64/lib/do_csum.S index d8174f10a..11bdfe031 100644 --- a/arch/ia64/lib/do_csum.S +++ b/arch/ia64/lib/do_csum.S @@ -13,6 +13,8 @@ * */ +#include <asm/asmmacro.h> + // // Theory of operations: // The goal is to go as quickly as possible to the point where @@ -100,10 +102,9 @@ // unsigned long do_csum(unsigned char *buf,int len) - .align 32 - .global do_csum - .proc do_csum -do_csum: +GLOBAL_ENTRY(do_csum) + UNW(.prologue) + UNW(.save ar.pfs, saved_pfs) alloc saved_pfs=ar.pfs,2,8,0,8 .rotr p[4], result[3] @@ -125,6 +126,7 @@ do_csum: ;; and lastoff=7,tmp1 // how many bytes off for last element andcm last=tmp2,tmp3 // address of word containing last byte + UNW(.save pr, saved_pr) mov saved_pr=pr // preserve predicates (rotation) ;; sub tmp3=last,first // tmp3=distance from first to last @@ -145,8 +147,12 @@ do_csum: shl hmask=hmask,tmp2 // build head mask, mask off [0,firstoff[ ;; shr.u tmask=tmask,tmp1 // build tail mask, mask off ]8,lastoff] + UNW(.save ar.lc, saved_lc) mov saved_lc=ar.lc // save lc ;; + + UNW(.body) + (p8) and hmask=hmask,tmask // apply tail mask to head mask if 1 word only (p9) and p[1]=lastval,tmask // mask last it as appropriate shr.u tmp3=tmp3,3 // we do 8 bytes per loop @@ -228,3 +234,4 @@ do_csum: mov ar.lc=saved_lc (p10) shr.u ret0=ret0,64-16 // + shift back to position = swap bytes br.ret.sptk.few rp +END(do_csum) diff --git a/arch/ia64/lib/flush.S b/arch/ia64/lib/flush.S index 0195ae5f5..ba9d59f84 100644 --- a/arch/ia64/lib/flush.S +++ b/arch/ia64/lib/flush.S @@ -1,9 +1,10 @@ /* * Cache flushing routines. * - * Copyright (C) 1999 Hewlett-Packard Co - * Copyright (C) 1999 David Mosberger-Tang <davidm@hpl.hp.com> + * Copyright (C) 1999-2000 Hewlett-Packard Co + * Copyright (C) 1999-2000 David Mosberger-Tang <davidm@hpl.hp.com> */ +#include <asm/asmmacro.h> #include <asm/page.h> .text @@ -11,12 +12,14 @@ .psr lsb .lsb - .align 16 - .global ia64_flush_icache_page - .proc ia64_flush_icache_page -ia64_flush_icache_page: +GLOBAL_ENTRY(ia64_flush_icache_page) + UNW(.prologue) alloc r2=ar.pfs,1,0,0,0 + UNW(.save ar.lc, r3) mov r3=ar.lc // save ar.lc + + .body + mov r8=PAGE_SIZE/64-1 // repeat/until loop ;; mov ar.lc=r8 @@ -34,4 +37,4 @@ ia64_flush_icache_page: ;; mov ar.lc=r3 // restore ar.lc br.ret.sptk.few rp - .endp ia64_flush_icache_page +END(ia64_flush_icache_page) diff --git a/arch/ia64/lib/idiv.S b/arch/ia64/lib/idiv.S index a12097c94..af424c41b 100644 --- a/arch/ia64/lib/idiv.S +++ b/arch/ia64/lib/idiv.S @@ -31,6 +31,7 @@ nops while maximizing parallelism */ +#include <asm/asmmacro.h> #include <asm/break.h> .text @@ -73,12 +74,10 @@ #define PASTE(a,b) PASTE1(a,b) #define NAME PASTE(PASTE(__,SGN),PASTE(OP,PASTE(PREC,3))) - .align 32 - .global NAME - .proc NAME -NAME: - +GLOBAL_ENTRY(NAME) + UNW(.prologue) alloc r2=ar.pfs,2,6,0,8 + UNW(.save pr, r18) mov r18=pr #ifdef SINGLE # ifdef UNSIGNED @@ -101,6 +100,10 @@ NAME: #endif setf.sig f8=in0 + UNW(.save ar.lc, r3) + + UNW(.body) + mov r3=ar.lc // save ar.lc setf.sig f9=in1 ;; @@ -156,3 +159,4 @@ NAME: mov ar.lc=r3 // restore ar.lc mov pr=r18,0xffffffffffff0000 // restore p16-p63 br.ret.sptk.few rp +END(NAME) diff --git a/arch/ia64/lib/io.c b/arch/ia64/lib/io.c new file mode 100644 index 000000000..466335172 --- /dev/null +++ b/arch/ia64/lib/io.c @@ -0,0 +1,54 @@ +#include <linux/module.h> +#include <linux/types.h> + +#include <asm/io.h> + +/* + * Copy data from IO memory space to "real" memory space. + * This needs to be optimized. + */ +void +__ia64_memcpy_fromio (void * to, unsigned long from, long count) +{ + while (count) { + count--; + *(char *) to = readb(from); + ((char *) to)++; + from++; + } +} + +/* + * Copy data from "real" memory space to IO memory space. + * This needs to be optimized. + */ +void +__ia64_memcpy_toio (unsigned long to, void * from, long count) +{ + while (count) { + count--; + writeb(*(char *) from, to); + ((char *) from)++; + to++; + } +} + +/* + * "memset" on IO memory space. + * This needs to be optimized. + */ +void +__ia64_memset_c_io (unsigned long dst, unsigned long c, long count) +{ + unsigned char ch = (char)(c & 0xff); + + while (count) { + count--; + writeb(ch, dst); + dst++; + } +} + +EXPORT_SYMBOL(__ia64_memcpy_fromio); +EXPORT_SYMBOL(__ia64_memcpy_toio); +EXPORT_SYMBOL(__ia64_memset_c_io); diff --git a/arch/ia64/lib/memset.S b/arch/ia64/lib/memset.S index 595720a2d..ddb42cc56 100644 --- a/arch/ia64/lib/memset.S +++ b/arch/ia64/lib/memset.S @@ -14,6 +14,7 @@ * Copyright (C) 1999 Stephane Eranian <eranian@hpl.hp.com> */ +#include <asm/asmmacro.h> // arguments // @@ -28,22 +29,23 @@ #define cnt r18 #define buf2 r19 #define saved_lc r20 -#define saved_pr r21 -#define tmp r22 +#define tmp r21 .text .psr abi64 .psr lsb - .align 16 - .global memset - .proc memset - -memset: +GLOBAL_ENTRY(memset) + UNW(.prologue) + UNW(.save ar.pfs, saved_pfs) alloc saved_pfs=ar.pfs,3,0,0,0 // cnt is sink here cmp.eq p8,p0=r0,len // check for zero length + UNW(.save ar.lc, saved_lc) mov saved_lc=ar.lc // preserve ar.lc (slow) ;; + + UNW(.body) + adds tmp=-1,len // br.ctop is repeat/until tbit.nz p6,p0=buf,0 // odd alignment (p8) br.ret.spnt.few rp @@ -108,4 +110,4 @@ long_memset: ;; (p6) st1 [buf]=val // only 1 byte left br.ret.dptk.few rp - .endp +END(memset) diff --git a/arch/ia64/lib/strlen.S b/arch/ia64/lib/strlen.S index 22f205656..fbc786b41 100644 --- a/arch/ia64/lib/strlen.S +++ b/arch/ia64/lib/strlen.S @@ -16,6 +16,8 @@ * 09/24/99 S.Eranian add speculation recovery code */ +#include <asm/asmmacro.h> + // // // This is an enhanced version of the basic strlen. it includes a combination @@ -82,10 +84,9 @@ .psr lsb .lsb - .align 32 - .global strlen - .proc strlen -strlen: +GLOBAL_ENTRY(strlen) + UNW(.prologue) + UNW(.save ar.pfs, saved_pfs) alloc saved_pfs=ar.pfs,11,0,0,8 // rotating must be multiple of 8 .rotr v[2], w[2] // declares our 4 aliases @@ -93,8 +94,12 @@ strlen: extr.u tmp=in0,0,3 // tmp=least significant 3 bits mov orig=in0 // keep trackof initial byte address dep src=0,in0,0,3 // src=8byte-aligned in0 address + UNW(.save pr, saved_pr) mov saved_pr=pr // preserve predicates (rotation) ;; + + UNW(.body) + ld8 v[1]=[src],8 // must not speculate: can fail here shl tmp=tmp,3 // multiply by 8bits/byte mov mask=-1 // our mask @@ -194,5 +199,4 @@ recover: sub ret0=ret0,tmp // length=now - back -1 mov ar.pfs=saved_pfs // because of ar.ec, restore no matter what br.ret.sptk.few rp // end of sucessful recovery code - - .endp strlen +END(strlen) diff --git a/arch/ia64/lib/strlen_user.S b/arch/ia64/lib/strlen_user.S index 8149dde8a..7f222bb13 100644 --- a/arch/ia64/lib/strlen_user.S +++ b/arch/ia64/lib/strlen_user.S @@ -15,6 +15,8 @@ * 09/24/99 S.Eranian added speculation recovery code */ +#include <asm/asmmacro.h> + // // int strlen_user(char *) // ------------------------ @@ -93,10 +95,9 @@ .psr lsb .lsb - .align 32 - .global __strlen_user - .proc __strlen_user -__strlen_user: +GLOBAL_ENTRY(__strlen_user) + UNW(.prologue) + UNW(.save ar.pfs, saved_pfs) alloc saved_pfs=ar.pfs,11,0,0,8 .rotr v[2], w[2] // declares our 4 aliases @@ -104,8 +105,12 @@ __strlen_user: extr.u tmp=in0,0,3 // tmp=least significant 3 bits mov orig=in0 // keep trackof initial byte address dep src=0,in0,0,3 // src=8byte-aligned in0 address + UNW(.save pr, saved_pr) mov saved_pr=pr // preserve predicates (rotation) ;; + + .body + ld8.s v[1]=[src],8 // load the initial 8bytes (must speculate) shl tmp=tmp,3 // multiply by 8bits/byte mov mask=-1 // our mask @@ -209,5 +214,4 @@ recover: mov pr=saved_pr,0xffffffffffff0000 mov ar.pfs=saved_pfs // because of ar.ec, restore no matter what br.ret.sptk.few rp - - .endp __strlen_user +END(__strlen_user) diff --git a/arch/ia64/lib/strncpy_from_user.S b/arch/ia64/lib/strncpy_from_user.S index f2d40984a..6ff7fa9b6 100644 --- a/arch/ia64/lib/strncpy_from_user.S +++ b/arch/ia64/lib/strncpy_from_user.S @@ -16,6 +16,8 @@ * by Andreas Schwab <schwab@suse.de>). */ +#include <asm/asmmacro.h> + #define EX(x...) \ 99: x; \ .section __ex_table,"a"; \ @@ -28,10 +30,7 @@ .psr lsb .lsb - .align 32 - .global __strncpy_from_user - .proc __strncpy_from_user -__strncpy_from_user: +GLOBAL_ENTRY(__strncpy_from_user) alloc r2=ar.pfs,3,0,0,0 mov r8=0 mov r9=in1 @@ -53,5 +52,4 @@ __strncpy_from_user: .Lexit: br.ret.sptk.few rp - - .endp __strncpy_from_user +END(__strncpy_from_user) diff --git a/arch/ia64/lib/strnlen_user.S b/arch/ia64/lib/strnlen_user.S index c227a9003..d70f54f2b 100644 --- a/arch/ia64/lib/strnlen_user.S +++ b/arch/ia64/lib/strnlen_user.S @@ -12,6 +12,8 @@ * Copyright (C) 1999 David Mosberger-Tang <davidm@hpl.hp.com> */ +#include <asm/asmmacro.h> + /* If a fault occurs, r8 gets set to -EFAULT and r9 gets cleared. */ #define EX(x...) \ .section __ex_table,"a"; \ @@ -25,12 +27,14 @@ .psr lsb .lsb - .align 32 - .global __strnlen_user - .proc __strnlen_user -__strnlen_user: +GLOBAL_ENTRY(__strnlen_user) + UNW(.prologue) alloc r2=ar.pfs,2,0,0,0 + UNW(.save ar.lc, r16) mov r16=ar.lc // preserve ar.lc + + UNW(.body) + add r3=-1,in1 ;; mov ar.lc=r3 @@ -51,5 +55,4 @@ __strnlen_user: mov r8=r9 mov ar.lc=r16 // restore ar.lc br.ret.sptk.few rp - - .endp __strnlen_user +END(__strnlen_user) |