1: /
2: / Sendmail
3: / Copyright (c) 1983 Eric P. Allman
4: / Berkeley, California
5: /
6: / Copyright (c) 1983 Regents of the University of California.
7: / All rights reserved. The Berkeley software License Agreement
8: / specifies the terms and conditions for redistribution.
9: /
10: / @(#)bmove.11.s 4.2 (Berkeley) 6/7/85
11: /
12: /
13: / BMOVE -- block move
14: /
15: /
16: / This is a highly optimized version of the old C-language
17: / bmove routine; it's function (should be) identical.
18: / It uses a fancy algorithm to move words instead of bytes
19: / whenever possible.
20: /
21: / In C the routine is:
22: / char *bmove(a, b, l)
23: / char *a, *b;
24: / int l;
25: / {
26: / register int n;
27: / register char *p, *q;
28: / p = a;
29: / q = b;
30: / n = l;
31: / while (n--)
32: / *q++ = *p++;
33: / return (q);
34: / }
35: /
36: / Parameters:
37: / a [4(sp)] -- source area
38: / b [6(sp)] -- target area
39: / l [10(sp)] -- byte count
40: /
41: / Returns:
42: / Pointer to end of target area.
43: /
44: / History:
45: / 3/14/79 [rse] -- added odd to odd case
46: / 2/9/78 [bob] -- converted from "C"
47: /
48: /
49:
50: .globl _bmove
51:
52: _bmove:
53: mov r2,-(sp) / save r2
54: mov 4(sp),r1 / get src address
55: mov 6(sp),r0 / get dst address
56:
57: / determine whether to use word or byte move
58: mov r0,r2 / r2 will reflect the three cases
59: bic $177776,r2 / keep only last bit of dst
60: ror 4(sp) / get least significant bit of src
61: adc r2 / add it in.
62: beq wordm / both on even boundary
63: dec r2 / check for odd case
64: bgt wordodd / both on odd boundary
65:
66: mov 10(sp),r2 / get count
67: beq done
68: bytem:
69: movb (r1)+,(r0)+ / copy next byte
70: sob r2,bytem / branch until done
71: br done
72:
73: wordm:
74: mov 10(sp),r2 / get count
75: wordt:
76: beq done
77: asr r2 / get word count
78: bcs odd / count was odd
79: even:
80: mov (r1)+,(r0)+ / copy word
81: sob r2,even / more to do if non-zero
82: br done
83:
84: wordodd:
85: mov 10(sp),r2 / get count
86: beq done
87: movb (r1)+,(r0)+ / copy byte
88: dec r2 / dec count
89: br wordt / now treat as an even word move
90:
91: odd:
92: beq odd2 / special case of count = 1
93: odd1:
94: mov (r1)+,(r0)+ / copy word
95: sob r2,odd1 / continue
96: odd2:
97: movb (r1)+,(r0)+ / count was odd. do last one
98:
99: done:
100: mov (sp)+,r2 / restore r2
101: rts pc / return
Defined functions
_bmove
declared in line
50; defined in line
52; used 1 times
bytem
defined in line
68; used 1 times
done
defined in line
99; used 5 times
even
defined in line
79; used 1 times
odd
defined in line
91; used 1 times
odd1
defined in line
93; used 1 times
odd2
defined in line
96; used 1 times
wordm
defined in line
73; used 1 times
wordt
defined in line
75; used 1 times