aboutsummaryrefslogtreecommitdiff
path: root/dynasm/dasm_mips.h
diff options
context:
space:
mode:
Diffstat (limited to 'dynasm/dasm_mips.h')
-rw-r--r--dynasm/dasm_mips.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/dynasm/dasm_mips.h b/dynasm/dasm_mips.h
index 46af0349..71a835b2 100644
--- a/dynasm/dasm_mips.h
+++ b/dynasm/dasm_mips.h
@@ -21,7 +21,7 @@ enum {
21 /* The following actions need a buffer position. */ 21 /* The following actions need a buffer position. */
22 DASM_ALIGN, DASM_REL_LG, DASM_LABEL_LG, 22 DASM_ALIGN, DASM_REL_LG, DASM_LABEL_LG,
23 /* The following actions also have an argument. */ 23 /* The following actions also have an argument. */
24 DASM_REL_PC, DASM_LABEL_PC, DASM_IMM, 24 DASM_REL_PC, DASM_LABEL_PC, DASM_IMM, DASM_IMMS,
25 DASM__MAX 25 DASM__MAX
26}; 26};
27 27
@@ -231,7 +231,7 @@ void dasm_put(Dst_DECL, int start, ...)
231 *pl = -pos; /* Label exists now. */ 231 *pl = -pos; /* Label exists now. */
232 b[pos++] = ofs; /* Store pass1 offset estimate. */ 232 b[pos++] = ofs; /* Store pass1 offset estimate. */
233 break; 233 break;
234 case DASM_IMM: 234 case DASM_IMM: case DASM_IMMS:
235#ifdef DASM_CHECKS 235#ifdef DASM_CHECKS
236 CK((n & ((1<<((ins>>10)&31))-1)) == 0, RANGE_I); 236 CK((n & ((1<<((ins>>10)&31))-1)) == 0, RANGE_I);
237#endif 237#endif
@@ -299,7 +299,7 @@ int dasm_link(Dst_DECL, size_t *szp)
299 case DASM_ALIGN: ofs -= (b[pos++] + ofs) & (ins & 255); break; 299 case DASM_ALIGN: ofs -= (b[pos++] + ofs) & (ins & 255); break;
300 case DASM_REL_LG: case DASM_REL_PC: pos++; break; 300 case DASM_REL_LG: case DASM_REL_PC: pos++; break;
301 case DASM_LABEL_LG: case DASM_LABEL_PC: b[pos++] += ofs; break; 301 case DASM_LABEL_LG: case DASM_LABEL_PC: b[pos++] += ofs; break;
302 case DASM_IMM: pos++; break; 302 case DASM_IMM: case DASM_IMMS: pos++; break;
303 } 303 }
304 } 304 }
305 stop: (void)0; 305 stop: (void)0;
@@ -357,7 +357,7 @@ int dasm_encode(Dst_DECL, void *buffer)
357 if (ins & 2048) 357 if (ins & 2048)
358 n = n - (int)((char *)cp - base); 358 n = n - (int)((char *)cp - base);
359 else 359 else
360 n = (n + (int)base) & 0x0fffffff; 360 n = (n + (int)(size_t)base) & 0x0fffffff;
361 patchrel: 361 patchrel:
362 CK((n & 3) == 0 && 362 CK((n & 3) == 0 &&
363 ((n + ((ins & 2048) ? 0x00020000 : 0)) >> 363 ((n + ((ins & 2048) ? 0x00020000 : 0)) >>
@@ -368,6 +368,9 @@ int dasm_encode(Dst_DECL, void *buffer)
368 ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n); 368 ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);
369 break; 369 break;
370 case DASM_LABEL_PC: break; 370 case DASM_LABEL_PC: break;
371 case DASM_IMMS:
372 cp[-1] |= ((n>>3) & 4); n &= 0x1f;
373 /* fallthrough */
371 case DASM_IMM: 374 case DASM_IMM:
372 cp[-1] |= (n & ((1<<((ins>>5)&31))-1)) << (ins&31); 375 cp[-1] |= (n & ((1<<((ins>>5)&31))-1)) << (ins&31);
373 break; 376 break;