1 /*
2  * Copyright (c) 2017, NVIDIA CORPORATION.  All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 #include "stdioInterf.h"
19 #include "fioMacros.h"
20 
21 extern void *__fort_malloc();
22 
23 int __fort_minxfer = 0;
24 
25 /* receive data items */
26 
__fort_erecv(cpu,e)27 void __fort_erecv(cpu, e) int cpu;
28 struct ents *e;
29 {
30   __fort_abort("__fort_erecv: not implemented");
31 }
32 
33 /* send data items */
34 
__fort_esend(cpu,e)35 void __fort_esend(cpu, e) int cpu;
36 struct ents *e;
37 {
38   __fort_abort("__fort_esend: not implemented");
39 }
40 
41 /* bcopy data items */
42 
__fort_ebcopys(ed,es)43 void __fort_ebcopys(ed, es) struct ents *ed;
44 struct ents *es;
45 {
46   struct ent *p;
47   struct ent *q;
48 
49   p = es->beg;
50   q = ed->beg;
51 #if defined(DEBUG)
52   if (ed->avl - q != es->avl - p)
53     __fort_abort("ebcopys: unmatched send/recv");
54 #endif
55   while (q < ed->avl) {
56 #if defined(DEBUG)
57     if (p->cnt != q->cnt)
58       __fort_abort("ebcopys: inconsistent counts");
59     if (p->ilen != q->ilen)
60       __fort_abort("ebcopys: inconsistent item length");
61 #endif
62     __DIST_ENTRY_COPY(p->len);
63     __fort_bcopysl(q->adr, p->adr, q->cnt, q->str, p->str, q->ilen);
64     __DIST_ENTRY_COPY_DONE();
65     p++;
66     q++;
67   }
68 }
69 
70 /* execute structure */
71 
__fort_doit(c)72 void __fort_doit(c) struct chdr *c;
73 {
74   struct ccpu *cp;
75   int n;
76 
77   while (c != (struct chdr *)0) {
78     for (n = 0; n < c->cn; n++) {
79       cp = &(c->cp[n]);
80       switch (cp->op) {
81       case CPU_COPY:
82         __fort_ebcopys(cp->rp, cp->sp);
83         break;
84       default:
85         __fort_abort("__fort_doit: invalid operation\n");
86         break;
87       }
88     }
89     c = c->next;
90   }
91 }
92