aboutsummaryrefslogtreecommitdiff
path: root/dynasm/dasm_mips.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-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 c10528fa..f3b43211 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;
@@ -356,7 +356,7 @@ int dasm_encode(Dst_DECL, void *buffer)
356 if (ins & 2048) 356 if (ins & 2048)
357 n = n - (int)((char *)cp - base); 357 n = n - (int)((char *)cp - base);
358 else 358 else
359 n = (n + (int)base) & 0x0fffffff; 359 n = (n + (int)(size_t)base) & 0x0fffffff;
360 patchrel: 360 patchrel:
361 CK((n & 3) == 0 && 361 CK((n & 3) == 0 &&
362 ((n + ((ins & 2048) ? 0x00020000 : 0)) >> 362 ((n + ((ins & 2048) ? 0x00020000 : 0)) >>
@@ -367,6 +367,9 @@ int dasm_encode(Dst_DECL, void *buffer)
367 ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n); 367 ins &= 2047; if (ins >= 20) D->globals[ins-10] = (void *)(base + n);
368 break; 368 break;
369 case DASM_LABEL_PC: break; 369 case DASM_LABEL_PC: break;
370 case DASM_IMMS:
371 cp[-1] |= ((n>>3) & 4); n &= 0x1f;
372 /* fallthrough */
370 case DASM_IMM: 373 case DASM_IMM:
371 cp[-1] |= (n & ((1<<((ins>>5)&31))-1)) << (ins&31); 374 cp[-1] |= (n & ((1<<((ins>>5)&31))-1)) << (ins&31);
372 break; 375 break;