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 /*LINTLIBRARY*/
41 
42 #include <sys/types.h>
43 #include "curses.h"
44 
45 /*
46  * additional memory routine to deal with memory areas in units of chtypes.
47  */
48 
49 void
memSset(chtype * s,chtype c,int n)50 memSset(chtype *s, chtype c, int n)
51 
52 #if u3b
53 {
54 	int count;			/* %r8 */
55 	char *from;			/* %r7 */
56 	char *to; 			/* %r6 */
57 
58 	count = (n - 1) * sizeof (chtype);
59 	if (count > 0) {
60 		chtype *sfrom = s;	/* %r5 */
61 
62 		to = (char *)(sfrom + 1);
63 		from = (char *)sfrom;
64 		*sfrom = c;
65 		asm("	movblkb	%r8, %r7, %r6");
66 		/* bcopy (count, to, from) */
67 	} else if (count == 0)
68 		*s = c;
69 }
70 #else
71 #if u3b2 || u3b15
72 {
73 	char *to;			/* 0(%fp) */
74 	char *from;			/* 4(%fp) */
75 	int count;		/* %r8 */
76 
77 	count = (n - 1) * sizeof (chtype);
78 	if (count > 0) {
79 		chtype *sfrom = s;	/* %r7 */
80 
81 		to = (char *)(sfrom + 1);
82 		from = (char *)sfrom;
83 		*sfrom = c;
84 
85 /* Evidently one can not specify the regs for movblb. So I move */
86 /* them in myself below to the regs where they belong. */
87 		asm("	movw	%r8,%r2");	/* count */
88 		asm("	movw	0(%fp),%r1");	/* to */
89 		asm("	movw	4(%fp),%r0");	/* from */
90 		asm("	movblb");
91 	} else if (count == 0)
92 		*s = c;
93 }
94 #else
95 {
96     while (n-- > 0)
97 	*s++ = c;
98 }
99 #endif /* u3b2 || u3b15 */
100 #endif /* u3b */
101 
102 /* The vax block copy command doesn't work the way I want. */
103 /* If anyone finds a version that does, I'd like to know. */
104 #if __bad__vax__
105 
106 /* this is the code within memcpy which shows how to do a block copy */
107 
memcpy(char * to,char * from,int count)108 memcpy(char *to, char *from, int count)
109 {
110 	if (count > 0) {
111 		asm("	movc3	12(ap),*4(ap),*8(ap)");
112 	}
113 }
114 #endif /* __bad__vax__ */
115