diff options
| author | Mike Pall <mike> | 2011-07-02 00:43:19 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2011-07-02 00:43:19 +0200 |
| commit | fe1f9137a92ee3c0e89e2f0a0b0abbeddcaf81fd (patch) | |
| tree | 54ee451f720c67e5dcd6f16cab7b6f25d1c304ed | |
| parent | 8ccf89718c2aedabcc5009db1d372574e802966e (diff) | |
| download | luajit-fe1f9137a92ee3c0e89e2f0a0b0abbeddcaf81fd.tar.gz luajit-fe1f9137a92ee3c0e89e2f0a0b0abbeddcaf81fd.tar.bz2 luajit-fe1f9137a92ee3c0e89e2f0a0b0abbeddcaf81fd.zip | |
PPC: Fix range check for scaled immediates in DynASM.
| -rw-r--r-- | dynasm/dasm_ppc.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/dynasm/dasm_ppc.h b/dynasm/dasm_ppc.h index e928ffed..1c8580fb 100644 --- a/dynasm/dasm_ppc.h +++ b/dynasm/dasm_ppc.h | |||
| @@ -233,6 +233,9 @@ void dasm_put(Dst_DECL, int start, ...) | |||
| 233 | case DASM_IMM: | 233 | case DASM_IMM: |
| 234 | #ifdef DASM_CHECKS | 234 | #ifdef DASM_CHECKS |
| 235 | CK((n & ((1<<((ins>>10)&31))-1)) == 0, RANGE_I); | 235 | CK((n & ((1<<((ins>>10)&31))-1)) == 0, RANGE_I); |
| 236 | #endif | ||
| 237 | n >>= ((ins>>10)&31); | ||
| 238 | #ifdef DASM_CHECKS | ||
| 236 | if (ins & 0x8000) | 239 | if (ins & 0x8000) |
| 237 | CK(((n + (1<<(((ins>>5)&31)-1)))>>((ins>>5)&31)) == 0, RANGE_I); | 240 | CK(((n + (1<<(((ins>>5)&31)-1)))>>((ins>>5)&31)) == 0, RANGE_I); |
| 238 | else | 241 | else |
| @@ -360,7 +363,7 @@ int dasm_encode(Dst_DECL, void *buffer) | |||
| 360 | break; | 363 | break; |
| 361 | case DASM_LABEL_PC: break; | 364 | case DASM_LABEL_PC: break; |
| 362 | case DASM_IMM: | 365 | case DASM_IMM: |
| 363 | cp[-1] |= ((n>>((ins>>10)&31)) & ((1<<((ins>>5)&31))-1)) << (ins&31); | 366 | cp[-1] |= (n & ((1<<((ins>>5)&31))-1)) << (ins&31); |
| 364 | break; | 367 | break; |
| 365 | default: *cp++ = ins; break; | 368 | default: *cp++ = ins; break; |
| 366 | } | 369 | } |
