flat assembler
Message board for the users of flat assembler.

Index > Main > Backward short jmp problem in long mode

Author
Thread Post new topic Reply to topic
fonolite



Joined: 14 Dec 2005
Posts: 32
fonolite
Backward jmp to local label cannot be assembled in a new fasm 1.67.18 for DOS.
(The things are inside a procedure in use64 long mode)


like this,

@@:
jmp @B

or

.label23
loop .label23

=> error: address sizes do not agree.

jmp @F
@@:
=> OK in 1.67.18



But with an old version(1.67.14) , everything was ok.
what is the problem?
Post 04 Jan 2007, 04:19
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
Code:
use64
format PE gui

include 'FASMDIRECTORY\include\win32ax.inc'

entry start
section '.code' readable executable
start:
@@:
jmp @b
invoke ExitProcess, 0

section '.import' import readable writeable

library kernel, 'kernel32.dll'

import kernel, ExitProcess, 'ExitProcess'                                               


Not dos, but since you posted this in the main forum i'm assuming that you're not restricting it to DOS. Well, the above code works, though i usually don't use @b. I think that should referance an anonymous lable that was declared before the last declared label. Perhaps you want to use jmp @@.
Post 04 Jan 2007, 04:24
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
fonolite



Joined: 14 Dec 2005
Posts: 32
fonolite
I made a coff object with use64.

But really backward jmp has a problem with new 1.67.18 fasm.
Post 04 Jan 2007, 08:11
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
fonolite:
did you create 64bit coff?
Code:
format MS64 COFF    
Post 04 Jan 2007, 08:38
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
fonolite



Joined: 14 Dec 2005
Posts: 32
fonolite
Thanks vid,
MS64 COFF does work for backward jmp.

But I must use COFF, because my 16bit linker(dos programming) can't recognize MS64 COFF.
(Exactly coff2omf doesn't.)

( my program : COFF(use64) -> COFF2OMF -> MS 16bit linker 5.60 + 16bit omf objects)

What's wrong with backward jmp in use64 COFF?
It works fine with fasm 1.67.14.
Post 04 Jan 2007, 23:43
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Quote:
version 1.67.15 (Nov 20, 2006)

[-] Some final (?) fixes and cleanup in the relative-offsets calculations.


Maybe the reason of your problem is using a 32-bit address on an instruction requiring a 64-bit address.

Edit: though, a clarification of what exactly happens is welcomed. Tomasz Rolling Eyes
Post 05 Jan 2007, 01:24
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7802
Location: Kraków, Poland
Tomasz Grysztar
First of all: it doesn't depend on whether it is a backward jump or forward jump, you must have been misled by some additional factors.

As for why this kind of error happens, it is possible that I was a bit too paranoid with sanity checks. Wink I will look into this later.
Post 05 Jan 2007, 09:33
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7802
Location: Kraków, Poland
Tomasz Grysztar
Corrected in 1.67.19. It appears that one of the check was not doing exactly what I intended because of a swap in values.
Post 10 Feb 2007, 13:32
View user's profile Send private message Visit poster's website 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.