1/* This is a generated file. DO NOT EDIT. */ 2/* 3 * Generated from: 4 * 5 * OpenBSD: bcopy.m4 6 */ 7/* 8 * Copyright (c) 1999 Michael Shalayeff 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS' AND ANY EXPRESS OR 21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 */ 32 33 34 35#undef _LOCORE 36#define _LOCORE 37#include <machine/asm.h> 38#include <machine/frame.h> 39 40 41#ifdef _KERNEL 42#include <assym.h> 43 44/* 45 * int spcopy (pa_space_t ssp, const void *src, pa_space_t dsp, void *dst, 46 * size_t size) 47 * do a space to space bcopy. 48 * 49 * assumes that spaces do not clash, otherwise we lose 50 */ 51 .import curproc, data 52 .import cpu_info_primary, data 53 .import copy_on_fault, code 54 55#define curproc (cpu_info_primary + CI_CURPROC) 56 57LEAF_ENTRY(spcopy) 58 ldw HPPA_FRAME_ARG(4)(sp), ret0 59 sub,<> r0, ret0, r0 60 bv r0(rp) 61 nop 62 63 ldo 64(sp), sp 64 stw rp, HPPA_FRAME_CRP(sp) 65 /* setup fault handler */ 66 ldil L%curproc, t1 67 ldw R%curproc(t1), t3 68 ldil L%copy_on_fault, t2 69 ldw P_ADDR(t3), r2 70 ldo R%copy_on_fault(t2), t2 71 ldw PCB_ONFAULT+U_PCB(r2), r1 72 stw t2, PCB_ONFAULT+U_PCB(r2) 73 74 mtsp arg0, sr1 75 mtsp arg2, sr2 76 77 78 comib,>=,n 15, ret0, $spcopy.byte 79 80 extru arg1, 31, 2, t3 81 extru arg3, 31, 2, t4 82 add ret0, t4, ret0 83 comb,<> t3, t4, $spcopy.unaligned 84 dep r0, 31, 2, arg1 85 86 addi -16, ret0, ret0 87$spcopy.loop16a 88 ldws,ma 4(sr1, arg1), t1 89 ldws,ma 4(sr1, arg1), t2 90 ldws,ma 4(sr1, arg1), t3 91 ldws,ma 4(sr1, arg1), t4 92 stbys,b,m t1, 4(sr2, arg3) 93 stws,ma t2, 4(sr2, arg3) 94 stws,ma t3, 4(sr2, arg3) 95 addib,>= -16, ret0, $spcopy.loop16a 96 stws,ma t4, 4(sr2, arg3) 97 98 addib,<,n 12, ret0, $spcopy.cleanup 99$spcopy.word 100 ldws,ma 4(sr1, arg1), t1 101 addib,>= -4, ret0, $spcopy.word 102 stws,ma t1, 4(sr2, arg3) 103 104$spcopy.cleanup 105 addib,=,n 4, ret0, $spcopy.done 106 ldws 0(sr1, arg1), t1 107 add arg3, ret0, arg3 108 b $spcopy.done 109 stbys,e t1, 0(sr2, arg3) 110 111$spcopy.unaligned 112 sub,>= t4, t3, t2 113 ldwm 4(sr1, arg1), ret1 114 zdep t2, 28, 29, t1 115 mtsar t1 116 117 addi -16, ret0, ret0 118$spcopy.loop16u 119 ldws,ma 4(sr1, arg1), t1 120 ldws,ma 4(sr1, arg1), t2 121 ldws,ma 4(sr1, arg1), t3 122 ldws,ma 4(sr1, arg1), t4 123 vshd ret1, t1, r31 124 stbys,b,m r31, 4(sr2, arg3) 125 vshd t1, t2, r31 126 stws,ma r31, 4(sr2, arg3) 127 vshd t2, t3, r31 128 stws,ma r31, 4(sr2, arg3) 129 vshd t3, t4, r31 130 stws,ma r31, 4(sr2, arg3) 131 addib,>= -16, ret0, $spcopy.loop16u 132 copy t4, ret1 133 134 addib,<,n 12, ret0, $spcopy.cleanup_un 135$spcopy.word_un 136 ldws,ma 4(sr1, arg1), t1 137 vshd ret1, t1, t2 138 addib,< -4, ret0, $spcopy.cleanup1_un 139 stws,ma t2, 4(sr2, arg3) 140 ldws,ma 4(sr1, arg1), ret1 141 vshd t1, ret1, t2 142 addib,>= -4, ret0, $spcopy.word_un 143 stws,ma t2, 4(sr2, arg3) 144 145$spcopy.cleanup_un 146 addib,<=,n 4, ret0, $spcopy.done 147 mfctl sar, t4 148 add arg3, ret0, arg3 149 extru t4, 28, 2, t4 150 sub,<= ret0, t4, r0 151 ldws,ma 4(sr1, arg1), t1 152 vshd ret1, t1, t2 153 b $spcopy.done 154 stbys,e t2, 0(sr2, arg3) 155 156$spcopy.cleanup1_un 157 b $spcopy.cleanup_un 158 copy t1, ret1 159 160$spcopy.byte 161 comb,>=,n r0, ret0, $spcopy.done 162$spcopy.byte_loop 163 ldbs,ma 1(sr1, arg1), t1 164 addib,<> -1, ret0, $spcopy.byte_loop 165 stbs,ma t1, 1(sr2, arg3) 166$spcopy.done 167 168 169 mtsp r0, sr1 170 mtsp r0, sr2 171 /* reset fault handler */ 172 stw r1, PCB_ONFAULT+U_PCB(r2) 173 ldw HPPA_FRAME_CRP(sp), rp 174 ldo -64(sp), sp 175 bv 0(rp) 176 copy r0, ret0 177EXIT(spcopy) 178#endif 179 180 .end 181