Fix register usage conventions for amd64 unfilter
modified: stub/src/amd64-win64.pep.S modified: stub/src/arch/amd64/bxx.S
This commit is contained in:
@@ -234,11 +234,10 @@ section PEFILTER49
|
|||||||
mov ecx, offset filter_length
|
mov ecx, offset filter_length
|
||||||
mov dl, IMM8(filter_cto)
|
mov dl, IMM8(filter_cto)
|
||||||
.att_syntax
|
.att_syntax
|
||||||
#define esi ebx
|
push %rsi // save
|
||||||
#define rsi rbx
|
push %rbx; pop %rsi // input len
|
||||||
#include "arch/amd64/bxx.S"
|
#include "arch/amd64/bxx.S"
|
||||||
#undef esi
|
pop %rsi // restore
|
||||||
#undef rsi
|
|
||||||
.intel_syntax noprefix
|
.intel_syntax noprefix
|
||||||
|
|
||||||
// =============
|
// =============
|
||||||
|
|||||||
@@ -35,11 +35,9 @@ amdbxx: # (*f_unf)(xo->buf, out_len, h.b_cto8, h.b_ftid);
|
|||||||
|
|
||||||
#ifndef NO_METHOD_CHECK
|
#ifndef NO_METHOD_CHECK
|
||||||
cmpl $0x49,ftid; jne ckend0 # filter: JMP, CALL, 6-byte Jxx
|
cmpl $0x49,ftid; jne ckend0 # filter: JMP, CALL, 6-byte Jxx
|
||||||
#endif
|
|
||||||
push %rbx # save
|
push %rbx # save
|
||||||
cld # convention should have guaranteed this already
|
#endif
|
||||||
|
push %rdi; lea -4(%rdi,%rsi),%rcx # last possible displacement
|
||||||
push %rdi; lea (1- 4)(%rdi,%rsi),%rcx # beyond last possible opcode
|
|
||||||
pop %rsi # start of buffer
|
pop %rsi # start of buffer
|
||||||
push %rsi
|
push %rsi
|
||||||
pop %rbx # remember start of buffer
|
pop %rbx # remember start of buffer
|
||||||
@@ -56,7 +54,7 @@ ckloop2:
|
|||||||
subb $ 0xE8,%al
|
subb $ 0xE8,%al
|
||||||
cmpb $0xE9-0xE8,%al; ja ckloop4 # not JMP, not CALL
|
cmpb $0xE9-0xE8,%al; ja ckloop4 # not JMP, not CALL
|
||||||
ckmark:
|
ckmark:
|
||||||
cmpq %rcx,%rsi; jae ckend # peek only; not marked ==> do not consume
|
cmpq %rcx,%rsi; ja ckend # peek only; not marked ==> do not consume
|
||||||
push %rsi; lodsl # (assume) marked, bswapped 32-bit displacement
|
push %rsi; lodsl # (assume) marked, bswapped 32-bit displacement
|
||||||
subb %dl,%al; jne ckloop3 # not marked with cto8
|
subb %dl,%al; jne ckloop3 # not marked with cto8
|
||||||
pop %rdi
|
pop %rdi
|
||||||
@@ -68,9 +66,9 @@ ckstart:
|
|||||||
cmpq %rcx,%rsi; jae ckend
|
cmpq %rcx,%rsi; jae ckend
|
||||||
lodsb; jmp ckloop2 # 0x0F prefix would overlap previous displacement
|
lodsb; jmp ckloop2 # 0x0F prefix would overlap previous displacement
|
||||||
ckend:
|
ckend:
|
||||||
|
#ifndef NO_METHOD_CHECK
|
||||||
pop %rbx # restore
|
pop %rbx # restore
|
||||||
ckend0:
|
ckend0:
|
||||||
#ifndef NO_METHOD_CHECK
|
|
||||||
ret
|
ret
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user