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