From: notaz Date: Sun, 10 May 2015 14:12:05 +0000 (+0300) Subject: translate: allow negative offsets on indexed stack accesses X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8fb3694c071ffe819509e01292b2a1520a70017;p=ia32rtools.git translate: allow negative offsets on indexed stack accesses --- diff --git a/tools/translate.c b/tools/translate.c index cc1de70..f85d5be 100644 --- a/tools/translate.c +++ b/tools/translate.c @@ -1735,14 +1735,12 @@ static struct parsed_equ *equ_find(struct parsed_op *po, const char *name, *extra_offs = 0; namelen = strlen(name); - p = strchr(name, '+'); + p = strpbrk(name, "+-"); if (p != NULL) { namelen = p - name; if (namelen <= 0) ferr(po, "equ parse failed for '%s'\n", name); - if (IS_START(p, "0x")) - p += 2; *extra_offs = strtol(p, &endp, 16); if (*endp != 0) ferr(po, "equ parse failed for '%s'\n", name); @@ -1867,7 +1865,6 @@ static int stack_frame_access(struct parsed_op *po, int offset = 0; int retval = -1; int sf_ofs; - int lim; if (po->flags & OPF_EBP_S) ferr(po, "stack_frame_access while ebp is scratch\n"); @@ -1998,8 +1995,7 @@ static int stack_frame_access(struct parsed_op *po, g_stack_frame_used = 1; sf_ofs = g_stack_fsz + offset; - lim = (ofs_reg[0] != 0) ? -4 : 0; - if (offset > 0 || sf_ofs < lim) + if (ofs_reg[0] == 0 && (offset > 0 || sf_ofs < 0)) ferr(po, "bp_stack offset %d/%d\n", offset, g_stack_fsz); if (is_lea)