flat assembler
Message board for the users of flat assembler.

Index > Main > The most useless instruction

Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Author
Thread Post new topic Reply to topic
AsmGuru62



Joined: 28 Jan 2004
Posts: 1619
Location: Toronto, Canada
AsmGuru62 21 Jun 2011, 02:35
Can't move memory to insert something without STD. It's either STD or moving memory in small steps - ineffective.
Post 21 Jun 2011, 02:35
View user's profile Send private message Send e-mail Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 21 Jun 2011, 09:25

@Tyler
@Teehee


LEA ... pointless ?
i'm not agree with you.
a very useful instruction and much more powerful than it seems at first sight!
Code:
.next_dd_w:       mov     edi,[BIU_dword + ecx]
               lea     ebx,[ID_ITUN_01u + (ecx*8)]     ;<
               lea     esi,[ebx+14]                    ;<
.next_write:       lea     eax,[ecx*8]                     ;<
               neg     eax     
            lea     edx,[ebx-3000+eax]              ;<
               mov     eax,BST_CHECKED
             bt      edi,edx
             jc      @F    

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 21 Jun 2011, 09:25
View user's profile Send private message Send e-mail Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1389
Location: Piraeus, Greece
Picnic 21 Jun 2011, 10:21
xleelz wrote:
what is std and cld good for?


Moving, copying, traversing data, in conjunction with a REP prefix and movsb, stosb, cmpsb instructions. Quite useful.
Post 21 Jun 2011, 10:21
View user's profile Send private message Visit poster's website Reply with quote
sinsi



Joined: 10 Aug 2007
Posts: 789
Location: Adelaide
sinsi 21 Jun 2011, 10:37
Try writing 64-bit code without LEA.
Post 21 Jun 2011, 10:37
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 440
Location: Ukraine
idle 21 Jun 2011, 11:15
BSWAP
CPUID
CMPXCHG
CMPXCHG8B
XADD

as those are not in i386 set i regret much about
clever thoughts come afterwards, crying or very sad
Post 21 Jun 2011, 11:15
View user's profile Send private message Reply with quote
Teehee



Joined: 05 Aug 2009
Posts: 570
Location: Brazil
Teehee 21 Jun 2011, 12:08
@ouadji: pointless != useless, doesn't? Smile at least in my suck english it is Razz

i preffer to call it LEV (Load Effective Value) lol Razz
Post 21 Jun 2011, 12:08
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 440
Location: Ukraine
idle 21 Jun 2011, 13:06
Quote:

LEV

in our native = lion
Post 21 Jun 2011, 13:06
View user's profile Send private message Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 21 Jun 2011, 13:34
What about esc, not useless, but maybe least used?

As for any others mentioned, i think they ALL are very useful.
Some people have great big toolbox full of tools and do everything with just a hammer Smile
Post 21 Jun 2011, 13:34
View user's profile Send private message Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 676
Location: Mar del Plata
Enko 21 Jun 2011, 13:52
bitshifter wrote:

Some people have great big toolbox full of tools and do everything with just a hammer Smile

Not if you are Jemie from Mythbusters, he does have a great toolkit and he actually use it.
http://dsc.discovery.com/videos/mythbusters-raw-jamies-toolkit.html


My thought is that all the instructions at some point are usefull. For example, some "exotic" intructions can be used to bother noob crackers.
Post 21 Jun 2011, 13:52
View user's profile Send private message Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 977
Location: Czechoslovakia
MazeGen 22 Jun 2011, 09:24
My random favorites:

FNOP - I wonder when it can be really useful

ARPL - have anyone ever used it?

INVLPG in real mode - cool, but what for?
Post 22 Jun 2011, 09:24
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 22 Jun 2011, 09:56

INT3 (0xCC) ... ok

but INT 3 (0xCD 0x03) ??

Just a matter of microprocessor design.
It would be foolish to disable this instruction.
But in practice, this instruction is completely useless.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 22 Jun 2011, 09:56
View user's profile Send private message Send e-mail Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 22 Jun 2011, 10:19
CD03 behaves bit differently from CC. I don't recall exact details, but you should be able to find them in manuals.
Post 22 Jun 2011, 10:19
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 22 Jun 2011, 10:20
Post 22 Jun 2011, 10:20
View user's profile Send private message Visit poster's website Reply with quote
Feryno



Joined: 23 Mar 2005
Posts: 509
Location: Czech republic, Slovak republic
Feryno 22 Jun 2011, 13:01
Personally, I don't find any useless instruction.
Even found some usage for instructions/combinations of instructions looking "useless" like REPZ LODSD (a0C.exe in self_dbg in fdbg package) - MazeGen likes the REP LODSB, right?
Remember that if you find some "useless" instruction or some exotic combination of instructions, it may be an antidebug trick.
Don't reject anything only because currently you think it's useless, good idea opening your eyes may come in the feaure and may color the world !

idle wrote:
CMPXCHG
CMPXCHG8B
XADD
I used them frequently in drivers and hypervisors programming (atomic memory operations in SMP), it may also be very useful in multithread application (in common - everytime when more "things" want to read/write shared memory at the same time)

MazeGen wrote:
INVLPG
I used it frequently when hypervisor maps memory page of guest into its virtual memory space (older versions of virtualization don't support virtualization of memory so hypervisor must walk through paging tables of guest from guest CR3 to last level of paging tables to find physical memory page and then map it into itself)

db 0CCh / db 0CDh, 03h - again an antidebug trick, even microsoft windows exception handler doesn't count with CD03 choice and reports wrong exception address inside CD03 instruction (ms assumes every int3 comes from db 0CCh, int3 is trap type of exception, so ms handler subtracts 1 and reports that as origin of instruction leading into int 3, then you must think of some correction algorithm if you develop a debugger)
Post 22 Jun 2011, 13:01
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 676
Location: Mar del Plata
Enko 22 Jun 2011, 13:42
MazeGen wrote:
My random favorites:

FNOP - I wonder when it can be really useful

The date of the post is November 06, 2003 at 12:16:58.
8 years no reply?
Post 22 Jun 2011, 13:42
View user's profile Send private message Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 977
Location: Czechoslovakia
MazeGen 22 Jun 2011, 13:52
Feryno wrote:
MazeGen wrote:
INVLPG
I used it frequently when hypervisor maps memory page of guest into its virtual memory space
As I wrote, INVLPG is allowed in real mode, but what for?
Post 22 Jun 2011, 13:52
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1900
DOS386 10 Jul 2011, 02:17
Tyler wrote:
lea is pretty pointless.


NO : http://board.flatassembler.net/topic.php?p=111985#111985 Shocked

Quote:
The most useless instruction


VERR and VERW Sad
Post 10 Jul 2011, 02:17
View user's profile Send private message Reply with quote
yoshimitsu



Joined: 07 Jul 2011
Posts: 96
yoshimitsu 13 Jul 2011, 01:53
I guess by "useless" instructions you mean those, which actually consist of two operations and were implemented to provide some higher level of code to draw simplicity but ended up being much slower and are therefore negatively connotated

examples are loop, enter, lods, stos, movs
on most processors they are considerably slower than their two instruction-pendants

kind of compareable to inc eax vs add eax,1 as the latter is often faster on newer processors
while 'inc' is considered more an 'exotic' instruction like the high-level instructions mentioned above

however, there are some exceptions like leave or rep lods/stos/movs, which are pretty fast
Post 13 Jul 2011, 01:53
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 440
Location: Ukraine
idle 13 Jul 2011, 03:14
Quote:

kind of compareable to inc eax vs add eax,1

there is special opcode for shifts when count=1
Post 13 Jul 2011, 03:14
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 13 Jul 2011, 04:02
idle wrote:
there is special opcode for shifts when count=1
Well I can guess what you mean here, but actually the opcode is the same. There is a special short form binary encoding though. Wink
Post 13 Jul 2011, 04:02
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:  
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next

< 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.