aboutsummaryrefslogtreecommitdiffhomepage
path: root/amd64/emit.c
diff options
context:
space:
mode:
Diffstat (limited to 'amd64/emit.c')
-rw-r--r--amd64/emit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/amd64/emit.c b/amd64/emit.c
index 946f396..e098a81 100644
--- a/amd64/emit.c
+++ b/amd64/emit.c
@@ -360,7 +360,7 @@ encode(uchar **pcode, const struct desc *tab, int ntab, enum irclass k, struct o
* access thru RSP (function arguments in the stack) */
mem.base = RSP;
mem.disp -= 8;
- } else {
+ } else if (mem.disp < 0) {
mem.disp += rbpoff;
}
}
@@ -387,7 +387,7 @@ encode(uchar **pcode, const struct desc *tab, int ntab, enum irclass k, struct o
B(mem.shift << 6 | (mem.index & 7) << 3 | (mem.base & 7));
}
if (mod == 1) B(mem.disp);
- else if (mod == 2 || (mod == 0 && mem.base == RBP/*RIP-rel*/) || (mod == 0 && sib && mem.base == RSP/*absolute*/)) {
+ else if (mod == 2 || (mod == 0 && mem.base == RBP/*RIP-rel*/) || (mod == 0 && sib && mem.base == RBP/*absolute*/)) {
I32(mem.disp);
}
}