|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Re: [PATCH] Fix stxr_c on i386Alban Bedel wrote:
> Hi all, > > I'm using lightning in a small JIT compiler and I found a little bug. > To store a char on i386 the source register must be 8bit, so when the > source is in ESI or EDI it must be moved to another register. > But currently lightning unconditionaly use EAX, this obviously can lead > to broken code if eax is used in the argument. Like this: > > stxr_c eax, ebx, esi => push eax > mov esi, eax > mov al, (eax, ebx) > pop eax > > Attached is a patch that fix this. Applied, thanks!! Paolo _______________________________________________ Lightning mailing list Lightning@... http://lists.gnu.org/mailman/listinfo/lightning |
|
|
[PATCH] Fix stxr_c on i386Hi all, I'm using lightning in a small JIT compiler and I found a little bug. To store a char on i386 the source register must be 8bit, so when the source is in ESI or EDI it must be moved to another register. But currently lightning unconditionaly use EAX, this obviously can lead to broken code if eax is used in the argument. Like this: stxr_c eax, ebx, esi => push eax mov esi, eax mov al, (eax, ebx) pop eax Attached is a patch that fix this. Albeu [i386_stxr_c.diff] diff --git a/lightning/i386/core-32.h b/lightning/i386/core-32.h index 48153e6..09e7f5f 100644 --- a/lightning/i386/core-32.h +++ b/lightning/i386/core-32.h @@ -117,7 +117,12 @@ struct jit_local_state { #define jit_movbrm(rs, dd, db, di, ds) \ (jit_check8(rs) \ ? MOVBrm(jit_reg8(rs), dd, db, di, ds) \ - : jit_replace(_EBX, rs, _EAX, MOVBrm(_AL, dd, db, di, ds))) + : jit_replace(_EBX, rs, \ + ((dd != _EAX && db != _EAX) ? _EAX : \ + ((dd != _ECX && db != _ECX) ? _ECX : _EDX)), \ + MOVBrm(((dd != _EAX && db != _EAX) ? _AL : \ + ((dd != _ECX && db != _ECX) ? _CL : _DL)), \ + dd, db, di, ds))) #define jit_ldi_c(d, is) MOVSBLmr((is), 0, 0, 0, (d)) #define jit_ldxi_c(d, rs, is) MOVSBLmr((is), (rs), 0, 0, (d)) _______________________________________________ Lightning mailing list Lightning@... http://lists.gnu.org/mailman/listinfo/lightning |
| Free embeddable forum powered by Nabble | Forum Help |