flat assembler
Message board for the users of flat assembler.
Index
> Windows > tasm to fasm syntax help |
Author |
|
JohnFound 18 Jan 2005, 07:33
Code: push dword [fs:0] ; or pushd [fs:0] |
|||
18 Jan 2005, 07:33 |
|
Madis731 18 Jan 2005, 14:01
And if you are under 32bit there is no hint needed.
just push [fs:0] ^o) or is there sth I missed (I think there should be no harm even if FSelector is 16bit) EDIT: There is a bug. According to manuals - FASM should choose the shortest one, but PUSH DWORD[FS:0] assembles to: Code: 64:FF35 00000000 which is 7 bytes The shortest form of this instruction is: Code: 64:67:FF36 0000 with 6 bytes (WOW - it uses TWO prefixes) I think that assembler get fooled by this 2pre+2decode byte, but HERE the extra prefix pays off because the 0-data is 2 bytes shorter. Strange thing is that I checked and even OllyDbg doesn't know this short form. It disassembles, when it meets it, but if you assemble with OllyDbg, it assembles to 7-byte version (I think its faster because of one less prefix). |
|||
18 Jan 2005, 14:01 |
|
Tomasz Grysztar 18 Jan 2005, 17:10
fasm doesn't use 16-bit addressing in 32-bit mode unless you tell to do it (with "push [fs:word 0]"), because the prefixed instructions even if shorted, usually were decoded slower. The earliest versions of fasm did such optimization, but later I've decided that this was the bad choice.
However I have just noticed that in the latest releases, during making the changes to adapt the assembler for future integration of AMD64 support, I have introduced a small bug, which caused fasm to ignore the size operator for address (so "push [fs:word 0]" is by fasm 1.56 assembled exactly the same as "push [fs:0]). I am fixing it now, look out for the new release. |
|||
18 Jan 2005, 17:10 |
|
Madis731 18 Jan 2005, 22:58
If I understood correctly - push [fs:word 0] should assemble to 6-byte operation/command, but it still pushes DWORD to the stack.
To my knowledge this command should push word (I mean written exactly as push [fs:word 0]), but I fear to argue here because I know that ADD, SUB, AND, ... have shorter forms but still dealing with 4-byte variables (m32/r32). Just checking - did I understand correctly? |
|||
18 Jan 2005, 22:58 |
|
vid 19 Jan 2005, 00:23
johnfound: i thought "pushd" is just a macro
Last edited by vid on 19 Jan 2005, 11:54; edited 1 time in total |
|||
19 Jan 2005, 00:23 |
|
Tomasz Grysztar 19 Jan 2005, 08:35
Quote: If I understood correctly - push [fs:word 0] should assemble to 6-byte operation/command, but it still pushes DWORD to the stack. As I wrote above, there is a bug in 1.56 causing it - check with some earlier release, or with the 1.57 - which is coming out. Quote: To my knowledge this command should push word (I mean written exactly as push [fs:word 0]) To push word use the "push word [fs:0]" command, everything inside the square brackets define the address on which you operate, so if you put size operator there, it applies to address size. |
|||
19 Jan 2005, 08:35 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.