1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 1997 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */
29
30 /*
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
33 * All Rights Reserved
34 *
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
37 * contributors.
38 */
39
40 #pragma ident "%Z%%M% %I% %E% SMI"
41
42 /*LINTLIBRARY*/
43
44 #include <sys/types.h>
45 #include "curses.h"
46
47 /*
48 * additional memory routine to deal with memory areas in units of chtypes.
49 */
50
51 void
memSset(chtype * s,chtype c,int n)52 memSset(chtype *s, chtype c, int n)
53
54 #if u3b
55 {
56 int count; /* %r8 */
57 char *from; /* %r7 */
58 char *to; /* %r6 */
59
60 count = (n - 1) * sizeof (chtype);
61 if (count > 0) {
62 chtype *sfrom = s; /* %r5 */
63
64 to = (char *)(sfrom + 1);
65 from = (char *)sfrom;
66 *sfrom = c;
67 asm(" movblkb %r8, %r7, %r6");
68 /* bcopy (count, to, from) */
69 } else if (count == 0)
70 *s = c;
71 }
72 #else
73 #if u3b2 || u3b15
74 {
75 char *to; /* 0(%fp) */
76 char *from; /* 4(%fp) */
77 int count; /* %r8 */
78
79 count = (n - 1) * sizeof (chtype);
80 if (count > 0) {
81 chtype *sfrom = s; /* %r7 */
82
83 to = (char *)(sfrom + 1);
84 from = (char *)sfrom;
85 *sfrom = c;
86
87 /* Evidently one can not specify the regs for movblb. So I move */
88 /* them in myself below to the regs where they belong. */
89 asm(" movw %r8,%r2"); /* count */
90 asm(" movw 0(%fp),%r1"); /* to */
91 asm(" movw 4(%fp),%r0"); /* from */
92 asm(" movblb");
93 } else if (count == 0)
94 *s = c;
95 }
96 #else
97 {
98 while (n-- > 0)
99 *s++ = c;
100 }
101 #endif /* u3b2 || u3b15 */
102 #endif /* u3b */
103
104 /* The vax block copy command doesn't work the way I want. */
105 /* If anyone finds a version that does, I'd like to know. */
106 #if __bad__vax__
107
108 /* this is the code within memcpy which shows how to do a block copy */
109
memcpy(char * to,char * from,int count)110 memcpy(char *to, char *from, int count)
111 {
112 if (count > 0) {
113 asm(" movc3 12(ap),*4(ap),*8(ap)");
114 }
115 }
116 #endif /* __bad__vax__ */
117