flat assembler
Message board for the users of flat assembler.

Index > Main > Detect bitness (FASM-specific, probably)

Author
Thread Post new topic Reply to topic
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
Recently I've been thinking about mov eax, [0] (strange, eh? Wink)
Code:
macro get_bitness bitness {
  virtual at 0
    mov eax, [0]; depends on FASM choosing shorter (r/m rip-relative) encoding
    bitness = 1 shl $
  end virtual
}    
Post 14 Sep 2010, 19:57
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

Very Happy
some time ago, I switched in unprotected mode (physical addressing) with Windows XP
and i did a real "mov eax, [0]" ...
even if everything was perfectly normal,
It is still amazing to be able to execute such a instruction.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 14 Sep 2010, 20:21
View user's profile Send private message Send e-mail Reply with quote
windwakr



Joined: 30 Jun 2004
Posts: 827
Location: Michigan, USA
windwakr
Neat.

Code:
macro get_bitness bitness {
  virtual at 0
    mov eax, [0]; depends on FASM choosing shorter (r/m rip-relative) encoding
    bitness = 1 shl $
  end virtual
}



;;;;My test code below
macro disp_smallnum string, num     ;Only works properly for 0-99...must be updated when 128bit comes out. :P
{
  display string , (num / 10)+'0', num mod 10+'0',0xD,0xA
}

use16
get_bitness bits
disp_smallnum 'use16: ', bits

use32
get_bitness bits
disp_smallnum 'use32: ', bits

use64
get_bitness bits
disp_smallnum 'use64: ', bits
    


Display wrote:

use16: 16
use32: 32
use64: 64

_________________
----> * <---- My star, won HERE
Post 14 Sep 2010, 20:34
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
Marvelous! Very Happy
Post 14 Sep 2010, 20:36
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
now, the same for every instructions, anywhere, with ascii string to return listing of the instruction?
Post 14 Sep 2010, 22:14
View user's profile Send private message Visit poster's website Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
edfed,

flat disassembler? Wink
Post 14 Sep 2010, 23:42
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17641
Location: In your JS exploiting you and your system
revolution
That is a nice find.
Post 15 Sep 2010, 01:42
View user's profile Send private message Visit poster's website Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 619
cod3b453
wow that is a neat trick Cool

(I'll stick with my wrapper macros though Razz)
Post 15 Sep 2010, 17:07
View user's profile Send private message Reply with quote
guignol



Joined: 06 Dec 2008
Posts: 727
guignol
Erm?..
Post 16 Sep 2010, 09:27
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
what can be nice is to know the count of instructions, and other things, at compilation time


display wrote:

Codes:
8567 bytes
5439 single instructions

Datas:
450 bytes
33 words
1007 dwords

Alignments:
654 bytes
Post 17 Sep 2010, 02: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.