Update emulators/lisaem to version 1.2.6_6
[dports.git] / emulators / lisaem / files / patch-generator__cpu68k.c
1 --- generator/cpu68k.c.orig
2 +++ generator/cpu68k.c
3 @@ -259,7 +259,7 @@
4              continue;
5            }
6          }
7 -        if (cpu68k_iibtable[bitmap] != NULL) {EXIT(283,0,"CPU definition #%d conflicts (0x%x)", i, bitmap);}
8 +        if (cpu68k_iibtable[bitmap] != NULL) {EXITR(283,0,"CPU definition #%d conflicts (0x%x)", i, bitmap);}
9  
10          cpu68k_iibtable[bitmap] = iib;
11          /* set both flag and non-flag versions */
12 @@ -285,7 +285,7 @@
13  
14    if (j != cpu68k_totalinstr) 
15      {
16 -      EXIT(84,0,"Instruction count not verified (%d/%d)\n",
17 +      EXITR(84,0,"Instruction count not verified (%d/%d)\n",
18                    cpu68k_totalinstr, i);
19      }
20  
21 @@ -904,19 +904,19 @@
22         else /*---- Nope! We're out of IPCt's, allocate some more.  ----*/
23         {
24  
25 -        if ( ipcts_free) { EXIT(3,0,"Bug! ipcts_free is %ld, but ipct_free_head is null",ipcts_free);}
26 +        if ( ipcts_free) { EXITR(3,0,"Bug! ipcts_free is %ld, but ipct_free_head is null",ipcts_free);}
27  
28          //check_iib();
29  
30          /*--- Did we call Malloc too many times? ---*/
31 -        if ((iipct_mallocs++)>MAX_IPCT_MALLOCS) { EXIT(2,0,"Excessive mallocs of ipct's recompile with more!");}
32 +        if ((iipct_mallocs++)>MAX_IPCT_MALLOCS) { EXITR(2,0,"Excessive mallocs of ipct's recompile with more!");}
33  
34                 size_to_get = (ipcts_allocated/IPCT_ALLOC_PERCENT)+1; // add a percentange of what we have, least 1
35                 if ( (ipct_mallocs[iipct_mallocs]=(t_ipc_table *)malloc(size_to_get * sizeof(t_ipc_table)+1)  )==NULL)
36                 {
37              DEBUG_LOG(0,"Out of memory getting more ipcs: %p was returned",  ipct_mallocs[iipct_mallocs]);
38              DEBUG_LOG(0,"%d ipcts allocated so far, %d are free, %d used, %d mallocs done", ipcts_allocated, ipcts_free, ipcts_used, iipct_mallocs);
39 -            EXIT(86,0,"Out of memory while allocating more ipct's");
40 +            EXITR(86,0,"Out of memory while allocating more ipct's");
41                 }
42  
43  //        DEBUG_LOG(0,"zzzzzzz ipct land allocated:: %p -to- %p", ipct_mallocs[iipct_mallocs], (void *)(ipct_mallocs[iipct_mallocs]+size_to_get * sizeof(t_ipc_table)));
44 @@ -1084,8 +1084,8 @@
45          DEBUG_LOG(1000,"Nope - calling get_ipct()");
46                 mmu_trn->table=get_ipct(); // allocate an ipc table for this mmu_t
47          table=mmu_trn->table;
48 -        if (!table) {EXIT(21,0,"Couldn't get IPC Table! Doh!");}
49 -        if (pc&1) {EXIT(14,0,"odd pc!");}
50 +        if (!table) {EXITR(21,0,"Couldn't get IPC Table! Doh!");}
51 +        if (pc&1) {EXITR(14,0,"odd pc!");}
52  
53          //check_iib();
54  
55 @@ -1094,11 +1094,11 @@
56                         // ipc points to the MMU translation table entry for this page.
57              ipc = &(table->ipc[((pc>>1) & 0xff)]);
58              DEBUG_LOG(200,"ipc is now %p at pc %06x max %06x",ipc,pc,xpc);
59 -            if (!ipc) {EXIT(501,0,"cpu68k_makeipclist: But! ipc is null!"); }
60 -            if (pc&1) {EXIT(501,0,"odd pc!");}
61 +            if (!ipc) {EXITR(501,0,"cpu68k_makeipclist: But! ipc is null!"); }
62 +            if (pc&1) {EXITR(501,0,"odd pc!");}
63                 }
64          else
65 -        {EXIT(502,0,"Let the bodies hit the floor!\nLet the bodies hit the floor!\nLet the bodies hit the floor!\n\n  Either mmu_trn or table is null!");}
66 +        {EXITR(502,0,"Let the bodies hit the floor!\nLet the bodies hit the floor!\nLet the bodies hit the floor!\n\n  Either mmu_trn or table is null!");}
67         }
68  
69      //check_iib();
70 @@ -1106,7 +1106,7 @@
71  
72          if ( !ipc)
73                  {
74 -                    EXIT(17,0,"ipc=NULL\n1. Something's got to give 2. Something's got to give. 3. Something's got to give 4. Something's got to give.\nNOW!");
75 +                    EXITR(17,0,"ipc=NULL\n1. Something's got to give 2. Something's got to give. 3. Something's got to give 4. Something's got to give.\nNOW!");
76                  }
77  
78      //check_iib();
79 @@ -1126,7 +1126,7 @@
80  
81      if ( !ipc)
82                  {
83 -                    EXIT(20,0,"ipc=NULL\n1. Something's got to give 2. Something's got to give. 3. Something's got to give 4. Something's got to give.\nNOW!");
84 +                    EXITR(20,0,"ipc=NULL\n1. Something's got to give 2. Something's got to give. 3. Something's got to give 4. Something's got to give.\nNOW!");
85                  }
86  
87      //check_iib();
88 @@ -1236,8 +1236,8 @@
89          // fflush(buglog);
90          // #endif
91  
92 -        if (!iib) {EXIT(53,0,"There's no proper IIB for the possibly illegal instruction opcode %04x @ pc=%08x\n",opcode,pc);}
93 -        if ( !ipc)  {EXIT(54,0,"Have a cow man! ipc=NULL\n"); }
94 +        if (!iib) {EXITR(53,0,"There's no proper IIB for the possibly illegal instruction opcode %04x @ pc=%08x\n",opcode,pc);}
95 +        if ( !ipc)  {EXITR(54,0,"Have a cow man! ipc=NULL\n"); }
96  
97          //DEBUG_LOG(200,"ipc is %s",(!ipc)?"null":"ok");
98  
99 @@ -1283,7 +1283,7 @@
100                 // grow the list of ipcs if we need to.
101                 if (instrs>=ipcs_to_get)
102                 {
103 -            EXIT(24,0,"Welcome to the realms of chaos! I'm dealing with over %d instructions, %d ipcs! %d/%d/%d pc=%d/%08x",instrs,ipcs_to_get,segment1,segment2,start,context,pc);
104 +            EXITR(24,0,"Welcome to the realms of chaos! I'm dealing with over %d instructions, %d ipcs! %d/%d/%d pc=%d/%08x",instrs,ipcs_to_get,segment1,segment2,start,context,pc);
105              pc24=pc;
106                 }
107  
108 @@ -1308,7 +1308,7 @@
109                table=mmu_trn->table;
110  
111                if (!table) {
112 -                           EXIT(99,0,"Couldnt get IPC Table! Doh!\n");}
113 +                           EXITR(99,0,"Couldnt get IPC Table! Doh!\n");}
114  
115                //if (pc&1) {DEBUG_LOG(200,"odd pc!"); EXIT(26);}
116              }
117 @@ -1333,7 +1333,7 @@
118  
119                   // check_iib();
120  
121 -                  if (!table) {EXIT(27,0,"Couldnt get IPC Table! Doh!");}
122 +                  if (!table) {EXITR(27,0,"Couldnt get IPC Table! Doh!");}
123                    //ipc = &(mmu_trn->table->ipc[((pc>>1) & 0xff)]);
124                    //myiib=cpu68k_iibtable[opcode]; iib=myiib; // iib =  myiib ? myiib : illegaliib;
125                    //////cpu68k_ipc(pc, iib, ipc);
126 @@ -1370,7 +1370,7 @@
127      if (instrs == 2)
128      {
129  
130 -        if (pc&1) {EXIT(28,0,"odd pc!");}
131 +        if (pc&1) {EXITR(28,0,"odd pc!");}
132          DEBUG_LOG(200,"*~*~*~*~*~*~ in 2instrs ipc is now %p at pc %06x max %06x",ipc,pc,xpc);
133          ipc=ipcs[instrs-1-1]; //ipc--
134          DEBUG_LOG(200,"ipc is now %p at pc %06x max %06x",ipc,pc,xpc);
135 @@ -1443,7 +1443,7 @@
136          DEBUG_LOG(200,"ipc is now %p at pc %06x max %06x ix=%d",ipc,pc,xpc,ix);
137          if ( !ipc)
138          {
139 -            EXIT(29,0,"Null ipc, bye");
140 +            EXITR(29,0,"Null ipc, bye");
141          }
142  
143          //check_iib();
144 @@ -1460,7 +1460,7 @@
145  
146          if (!ipc->function)
147               {
148 -              EXIT(3,0,"Null IPC fn returned for opcode:%04x ix=%d of %d instrs",ipc->opcode,ix,instrs);
149 +              EXITR(3,0,"Null IPC fn returned for opcode:%04x ix=%d of %d instrs",ipc->opcode,ix,instrs);
150                // cpu68k_printipc(ipc);
151               }
152  
153 @@ -1479,7 +1479,7 @@
154                 {
155            //  check_iib();
156              ipc=ipcs[ix];
157 -            EXIT(6,0,"FATAL ipc with null fnction at index %d-> used:%d, set:%d, opcode %04x, len %02x, src %08x, dst %08x\n",
158 +            EXITR(6,0,"FATAL ipc with null fnction at index %d-> used:%d, set:%d, opcode %04x, len %02x, src %08x, dst %08x\n",
159                  ix, ipc->used, ipc->set, ipc->opcode, ipc->wordlen, ipc->src, ipc->dst);
160                 }
161