flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > invalid value in relativeto operator [solved]

Author
Thread Post new topic Reply to topic
CandyMan



Joined: 04 Sep 2009
Posts: 414
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 29 Jan 2015, 22:05
Code:
macro   lea     Dst,Src
{
if Src eqtype [0] & Src relativeto $    ;error: invalid value
  if Dst eq rax
        lea     eax,Src
  else if Dst eq rbx
        lea     ebx,Src
  else if Dst eq rcx
        lea     ecx,Src
  else if Dst eq rdx
        lea     edx,Src
  else if Dst eq rsi
        lea     esi,Src
  else if Dst eq rdi
        lea     edi,Src
  else if Dst eq rbp
        lea     ebp,Src
  else if Dst eq rsp
        lea     esp,Src
  else if Dst eq r8
        lea     r8d,Src
  else if Dst eq r9
        lea     r9d,Src
  else if Dst eq r10
        lea     r10d,Src
  else if Dst eq r11
        lea     r11d,Src
  else if Dst eq r12
        lea     r12d,Src
  else if Dst eq r13
        lea     r13d,Src
  else if Dst eq r14
        lea     r14d,Src
  else if Dst eq r15
        lea     r15d,Src
  else
        lea     Dst,Src
  end if
else
        lea     Dst,Src
end if
}

        use64
        org     0

        lea     rax,[Z]         ;change rax to eax
        lea     rax,[rdi+rcx*8] ;not change rax to eax

Z:
    

_________________
smaller is better


Last edited by CandyMan on 30 Jan 2015, 15:21; edited 1 time in total
Post 29 Jan 2015, 22:05
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20404
Location: In your JS exploiting you and your system
revolution 29 Jan 2015, 22:13
TFM wrote:
With relativeto operator it is possible to check whether values of two expressions differ only by constant amount. The valid syntax is a numerical expression followed by relativeto and then another expression (possibly register-based). Labels that have no simple numerical value can be tested this way to determine what kind of operations may be possible with them.
So "[addr] relativeto value" is not valid. You'll need to remove the surrounding brackets to to a test like that.
Post 29 Jan 2015, 22:13
View user's profile Send private message Visit poster's website Reply with quote
CandyMan



Joined: 04 Sep 2009
Posts: 414
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 30 Jan 2015, 15:19
I already advised myself. Very Happy
Code:
macro   lea     Dst,Src
{
local ..Word
  virtual at 0
        mov     eax,Src
  load ..Word word from 0
  end virtual
if Src eqtype [0] & ..Word=0x058B
  if Dst eq rax
        lea     eax,Src
  else if Dst eq rbx
        lea     ebx,Src
  else if Dst eq rcx
        lea     ecx,Src
  else if Dst eq rdx
        lea     edx,Src
  else if Dst eq rsi
        lea     esi,Src
  else if Dst eq rdi
        lea     edi,Src
  else if Dst eq rbp
        lea     ebp,Src
  else if Dst eq rsp
        lea     esp,Src
  else if Dst eq r8
        lea     r8d,Src
  else if Dst eq r9
        lea     r9d,Src
  else if Dst eq r10
        lea     r10d,Src
  else if Dst eq r11
        lea     r11d,Src
  else if Dst eq r12
        lea     r12d,Src
  else if Dst eq r13
        lea     r13d,Src
  else if Dst eq r14
        lea     r14d,Src
  else if Dst eq r15
        lea     r15d,Src
  else
        lea     Dst,Src
  end if
else
        lea     Dst,Src
end if
}

        use64
        lea     rax,[Z]
        lea     rax,[rdi+rcx*8]
Z:
    

_________________
smaller is better
Post 30 Jan 2015, 15:19
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.