[BACK]Return to bcopy.m4 CVS log [TXT][DIR] Up to [local] / sys / lib / libkern / arch / hppa

Annotation of sys/lib/libkern/arch/hppa/bcopy.m4, Revision 1.1

1.1     ! nbrk        1: define(_rcsid,``$OpenBSD: bcopy.m4,v 1.16 2007/05/14 19:54:21 martin Exp $'')dnl
        !             2: dnl
        !             3: dnl
        !             4: dnl  This is the source file for bcopy.S, spcopy.S
        !             5: dnl
        !             6: dnl
        !             7: define(`versionmacro',substr(_rcsid,1,eval(len(_rcsid)-2)))dnl
        !             8: dnl
        !             9: /* This is a generated file. DO NOT EDIT. */
        !            10: /*
        !            11:  * Generated from:
        !            12:  *
        !            13:  *     versionmacro
        !            14:  */
        !            15: /*
        !            16:  * Copyright (c) 1999 Michael Shalayeff
        !            17:  * All rights reserved.
        !            18:  *
        !            19:  * Redistribution and use in source and binary forms, with or without
        !            20:  * modification, are permitted provided that the following conditions
        !            21:  * are met:
        !            22:  * 1. Redistributions of source code must retain the above copyright
        !            23:  *    notice, this list of conditions and the following disclaimer.
        !            24:  * 2. Redistributions in binary form must reproduce the above copyright
        !            25:  *    notice, this list of conditions and the following disclaimer in the
        !            26:  *    documentation and/or other materials provided with the distribution.
        !            27:  *
        !            28:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
        !            29:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
        !            30:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
        !            31:  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
        !            32:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
        !            33:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
        !            34:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
        !            35:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        !            36:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
        !            37:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        !            38:  *
        !            39:  */
        !            40:
        !            41: dnl
        !            42: dnl    macro: L(`arg1',`arg2')
        !            43: dnl synopsis: creates an assembly label based on args resulting in $arg1.arg2
        !            44: dnl
        !            45: define(`L', `$$1.$2')dnl
        !            46: dnl
        !            47: dnl
        !            48: dnl
        !            49: define(`STWS',`ifelse($5, `u',dnl
        !            50: `ifelse($1, `1', `vshd $4, t`$1', r31
        !            51:        stbys,B,m r31, F`'4($2, $3)',
        !            52: `0', `0', `vshd        t`'decr($1), t`$1', r31
        !            53:        stws,M  r31, F`'4($2, $3)')',dnl
        !            54: `0', `0',
        !            55: `ifelse($1, `1',
        !            56: `stbys,B`'ifelse(B, `b', `,m ', `0', `0', `    ')`'t`$1', F`'4($2, $3)',
        !            57: `0', `0', `stws,M      t`$1', F`'4($2, $3)')')')dnl
        !            58: define(`STWSS', `ifelse(`$3', `1', `dnl',
        !            59: `0', `0', `STWSS($1, $2, eval($3 - 1), $4, $5)')
        !            60:        STWS($3, $1, $2, $4, $5)dnl
        !            61: ')dnl
        !            62: define(`LDWSS', `ifelse(`$3', `1', `dnl',
        !            63: `0', `0', `LDWSS($1, $2, eval($3 - 1))')
        !            64:        ldws,M  F`'4($1, $2), t`'$3`'dnl
        !            65: ')dnl
        !            66: dnl
        !            67: dnl copy data in 4-words blocks
        !            68: dnl
        !            69: define(`hppa_blcopy',`
        !            70:        addi    -16, $6, $6
        !            71: L($1, `loop16'`$7')
        !            72: dnl    cache hint may not work on some hardware
        !            73: dnl    ldw     F 32($2, $3), r0
        !            74: ifelse(F, `-', `dnl
        !            75:        addi    F`'4, $5, $5', `0', `0', `dnl')
        !            76: LDWSS($2, $3, 4)
        !            77: STWSS($4, $5, 3, `ret1', $7)
        !            78: ifelse($7, `u', `dnl
        !            79:        STWS(4, $4, $5, `ret1', $7)', $7, `a', `dnl')
        !            80:        addib,>= -16, $6, L($1, `loop16'`$7')
        !            81: ifelse($7, `a', `dnl
        !            82:        STWS(4, $4, $5, `ret1', $7)dnl
        !            83: ', $7, `u', `dnl
        !            84:        copy    t4, ret1')')dnl
        !            85: dnl
        !            86: dnl copy in words
        !            87: dnl
        !            88: define(`STWL', `addib,<,n 12, $6, L($1, cleanup)
        !            89: ifelse($7, `u', `      copy    ret1, t1', $7, `a', `dnl')
        !            90: L($1, word)
        !            91:        ldws,M  F`'4($2, $3), t1
        !            92:        addib,>= -4, $6, L($1, word)
        !            93:        stws,M  t1, F`'4($4, $5)
        !            94:
        !            95: L($1, cleanup)
        !            96:        addib,=,n 4, $6, L($1, done)
        !            97:        ldws    0($2, $3), t1
        !            98:        add     $5, $6, $5
        !            99:        b       L($1, done)
        !           100:        stbys,E t1, 0($4, $5)
        !           101: ')
        !           102: dnl
        !           103: dnl
        !           104: dnl parameters:
        !           105: dnl  $1        name
        !           106: dnl  $2        source space
        !           107: dnl  $3        source address
        !           108: dnl  $4        destination space
        !           109: dnl  $5        destination address
        !           110: dnl  $6        length
        !           111: dnl  $7        direction
        !           112: dnl
        !           113: define(hppa_copy,
        !           114: `dnl
        !           115: dnl
        !           116: dnl    if direction is `-' (backwards copy), adjust src, dst
        !           117: dnl
        !           118: ifelse($7,`-', `add    $3, $6, $3
        !           119:        add     $5, $6, $5
        !           120: define(`F', `-')dnl
        !           121: define(`R', `')dnl
        !           122: define(`M', `mb')dnl
        !           123: define(`B', `e')dnl
        !           124: define(`E', `b')dnl
        !           125: ',dnl ifelse
        !           126: `0',`0',
        !           127: `define(`F', `')dnl
        !           128: define(`R', `-')dnl
        !           129: define(`M', `ma')dnl
        !           130: define(`B', `b')dnl
        !           131: define(`E', `e')dnl
        !           132: ')dnl ifelse
        !           133:
        !           134: ifelse($7,`-', `', `0',`0',
        !           135: `      comib,>=,n 15, $6, L($1, byte)
        !           136:
        !           137:        extru   $3, 31, 2, t3
        !           138:        extru   $5, 31, 2, t4
        !           139:        add     $6, t4, $6
        !           140:        comb,<> t3, t4, L($1, unaligned)
        !           141:        dep     r0, 31, 2, $3
        !           142:        hppa_blcopy($1, $2, $3, $4, $5, $6, `a')
        !           143:
        !           144:        STWL($1, $2, $3, $4, $5, $6, `a')dnl
        !           145:
        !           146: L($1, unaligned)
        !           147:        sub,>=  t4, t3, t2
        !           148:        ldwm    F`'4($2, $3), ret1
        !           149:        zdep    t2, 28, 29, t1
        !           150:        mtsar   t1
        !           151:        hppa_blcopy($1, $2, $3, $4, $5, $6, `u')
        !           152:
        !           153: dnl    STWL($1, $2, $3, $4, $5, $6, `u')
        !           154:        addib,<,n 12, $6, L($1, cleanup_un)
        !           155: L($1, word_un)
        !           156:        ldws,M  F`'4($2, $3), t1
        !           157:        vshd    ret1, t1, t2
        !           158:        addib,< -4, $6, L($1, cleanup1_un)
        !           159:        stws,M  t2, F`'4($4, $5)
        !           160:        ldws,M  F`'4($2, $3), ret1
        !           161:        vshd    t1, ret1, t2
        !           162:        addib,>= -4, $6, L($1, word_un)
        !           163:        stws,M  t2, F`'4($4, $5)
        !           164:
        !           165: L($1, cleanup_un)
        !           166:        addib,<=,n 4, $6, L($1, done)
        !           167:        mfctl   sar, t4
        !           168:        add     $5, $6, $5
        !           169:        extru   t4, 28, 2, t4
        !           170:        sub,<=  $6, t4, r0
        !           171:        ldws,M  F`'4($2, $3), t1
        !           172:        vshd    ret1, t1, t2
        !           173:        b       L($1, done)
        !           174:        stbys,E t2, 0($4, $5)
        !           175:
        !           176: L($1, cleanup1_un)
        !           177:        b       L($1, cleanup_un)
        !           178:        copy    t1, ret1
        !           179: ')dnl ifelse
        !           180:
        !           181: L($1, byte)
        !           182:        comb,>=,n r0, $6, L($1, done)
        !           183: L($1, byte_loop)
        !           184:        ldbs,M  F`'1($2, $3), t1
        !           185:        addib,<> -1, $6, L($1, byte_loop)
        !           186:        stbs,M  t1, F`'1($4, $5)
        !           187: L($1, done)
        !           188: ')dnl
        !           189: `
        !           190: #undef _LOCORE
        !           191: #define _LOCORE
        !           192: #include <machine/asm.h>
        !           193: #include <machine/frame.h>
        !           194: '
        !           195: ifelse(NAME, `bcopy',
        !           196: `
        !           197: #if defined(LIBC_SCCS)
        !           198:        .text
        !           199:        .asciz "versionmacro"
        !           200:        .align  4
        !           201: #endif
        !           202:
        !           203: LEAF_ENTRY(memcpy)
        !           204: ALTENTRY(memmove)
        !           205:        copy    arg0, t1
        !           206:        copy    arg1, arg0
        !           207:        copy    t1, arg1
        !           208:        copy    arg0, ret0
        !           209: ALTENTRY(ovbcopy)
        !           210: ALTENTRY(bcopy)
        !           211:        comb,>,n arg1, arg0, L(bcopy, reverse)
        !           212:        hppa_copy(bcopy_f, sr0, arg0, sr0, arg1, arg2, `+')
        !           213:        bv      0(rp)
        !           214:        nop
        !           215: L(bcopy, reverse)
        !           216:        hppa_copy(bcopy_r, sr0, arg0, sr0, arg1, arg2, `-')
        !           217:        bv      0(rp)
        !           218:        nop
        !           219: EXIT(memcpy)
        !           220: ')dnl
        !           221: dnl
        !           222: ifelse(NAME, `spcopy',
        !           223: `
        !           224: #ifdef _KERNEL
        !           225: #include <assym.h>
        !           226:
        !           227: /*
        !           228:  * int spcopy (pa_space_t ssp, const void *src, pa_space_t dsp, void *dst,
        !           229:  *              size_t size)
        !           230:  * do a space to space bcopy.
        !           231:  *
        !           232:  * assumes that spaces do not clash, otherwise we lose
        !           233:  */
        !           234:        .import curproc, data
        !           235:        .import cpu_info_primary, data
        !           236:        .import copy_on_fault, code
        !           237:
        !           238: #define curproc        (cpu_info_primary + CI_CURPROC)
        !           239:
        !           240: LEAF_ENTRY(spcopy)
        !           241:        ldw     HPPA_FRAME_ARG(4)(sp), ret0
        !           242:        sub,<>  r0, ret0, r0
        !           243:        bv      r0(rp)
        !           244:        nop
        !           245: `
        !           246:        ldo     64(sp), sp
        !           247:        stw     rp, HPPA_FRAME_CRP(sp)
        !           248:        /* setup fault handler */
        !           249:        ldil    L%curproc, t1
        !           250:        ldw     R%curproc(t1), t3
        !           251:        ldil    L%copy_on_fault, t2
        !           252:        ldw     P_ADDR(t3), r2
        !           253:        ldo     R%copy_on_fault(t2), t2
        !           254:        ldw     PCB_ONFAULT+U_PCB(r2), r1
        !           255:        stw     t2, PCB_ONFAULT+U_PCB(r2)
        !           256: '
        !           257:        mtsp    arg0, sr1
        !           258:        mtsp    arg2, sr2
        !           259:
        !           260:        hppa_copy(spcopy, sr1, arg1, sr2, arg3, ret0, `+')
        !           261:
        !           262:        mtsp    r0, sr1
        !           263:        mtsp    r0, sr2
        !           264:        /* reset fault handler */
        !           265:        stw     r1, PCB_ONFAULT+U_PCB(r2)
        !           266:        ldw     HPPA_FRAME_CRP(sp), rp
        !           267:        ldo     -64(sp), sp
        !           268:        bv      0(rp)
        !           269:        copy    r0, ret0
        !           270: EXIT(spcopy)
        !           271: #endif
        !           272: ')dnl
        !           273:
        !           274:        .end

CVSweb