diff options
Diffstat (limited to 'src/lj_emit_ppc.h')
-rw-r--r-- | src/lj_emit_ppc.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lj_emit_ppc.h b/src/lj_emit_ppc.h index bc361c5b..f2bf0a94 100644 --- a/src/lj_emit_ppc.h +++ b/src/lj_emit_ppc.h | |||
@@ -142,12 +142,18 @@ typedef MCode *MCLabel; | |||
142 | 142 | ||
143 | static void emit_condbranch(ASMState *as, PPCIns pi, PPCCC cc, MCode *target) | 143 | static void emit_condbranch(ASMState *as, PPCIns pi, PPCCC cc, MCode *target) |
144 | { | 144 | { |
145 | MCode *p = as->mcp; | 145 | MCode *p = --as->mcp; |
146 | ptrdiff_t delta = ((char *)target - (char *)p) + 4; | 146 | ptrdiff_t delta = (char *)target - (char *)p; |
147 | lua_assert(((delta + 0x8000) >> 16) == 0); | 147 | lua_assert(((delta + 0x8000) >> 16) == 0); |
148 | pi ^= (delta & 0x8000) * (PPCF_Y/0x8000); | 148 | pi ^= (delta & 0x8000) * (PPCF_Y/0x8000); |
149 | *--p = pi | PPCF_CC(cc) | ((uint32_t)delta & 0xffffu); | 149 | *p = pi | PPCF_CC(cc) | ((uint32_t)delta & 0xffffu); |
150 | as->mcp = p; | 150 | } |
151 | |||
152 | static void emit_jmp(ASMState *as, MCode *target) | ||
153 | { | ||
154 | MCode *p = --as->mcp; | ||
155 | ptrdiff_t delta = (char *)target - (char *)p; | ||
156 | *p = PPCI_B | (delta & 0x03fffffcu); | ||
151 | } | 157 | } |
152 | 158 | ||
153 | static void emit_call(ASMState *as, void *target) | 159 | static void emit_call(ASMState *as, void *target) |