flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > Code cannot be generated |
Author |
|
revolution 22 Sep 2021, 14:50
|
|||
22 Sep 2021, 14:50 |
|
CandyMan 23 Sep 2021, 16:50
I want to replace all jmp instructions that preceded with jcc with nop, but only those that are not jumped to by another jmp instruction. Unfortunately, the macro doesn't work for me. The directive in the macro erroneously displays "000", and at the end of the code correctly displays "110".
Help me. Code: use32 virtual at 0 Jumps:: rd 1024 end virtual virtual at 0 Jump2:: rd 1024 end virtual virtual at 0 Jump3:: rb 1024 end virtual Starts = 0 Start2 = 0 macro jmp Target { local ..Next,..Prev,..Curr,..Found,Sticky if ~ Target eqtype eax virtual at $ ..Prev: jmp Target ..Next: end virtual store dword Target at Jumps:Starts shl 2 Starts = Starts+1 if $-$$>=2 store dword ..Prev at Jump2:Start2 shl 3+0 store dword ..Next at Jump2:Start2 shl 3+4 Start2 = Start2+1 load ..Found byte from Jump3:Starts-1 display ..Found+'0' load W word from ..Prev-2 if W and 0xF0 = 70h & W shr 8 = (..Next-..Prev) & ..Found = 0 | Sticky = 1 nop Sticky = 1 else jmp Target Sticky = 0 end if else jmp Target ` Sticky = 0 end if end if } inc eax jz @F ;\ not possible to modify Y: jmp Jmp3 ;/ @@: rdmsr Jmp3: jmp Y jz @F ;\ possible to modify jmp Jmp4 ;/ @@: rdtscp Jmp4: display 13,10 repeat Starts ..Found = 0 load X dword from Jumps:(%-1) shl 2 repeat Start2 load X1 dword from Jump2:(%-1) shl 3+0 load X2 dword from Jump2:(%-1) shl 3+4 if X>=X1 & X<=X2 ..Found = 1 Break end if end repeat display ..Found+'0' store byte ..Found at Jump3:(%-1) end repeat _________________ smaller is better |
|||
23 Sep 2021, 16:50 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.