Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 257 Vote(s) - 3.43 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is faster: JMP or string of NOPs?

#1
I'm implementing binary translation and have to deal with sequences of NOPs (0x90) with length about 16 opcodes. Is it better for performance to place JMP (to the end) at start of such sequences?
Reply

#2
If the `NOP`s are to align the stream, then they have more value than just being a NO OP. if your concerned with pure speed, see [Agner Fog's Optimization Manuals Vol. 4][1].



[1]:

[To see links please register here]

Reply

#3
being a binary translation I would start by translating (them into equivalent nops on the target system). Once things are working then optimize out dead code. At the same time since this string of instructions caught your eye, try to understand what they were there for, perhaps waiting on hardware to do something, and make sure that your translated system functions the same.
Reply

#4
The [Intel Architecture Software developer's guide, volume 2B (instructions N-Z)][1] contains the following table (pg 4-12) about `NOP`:

**Table 4-9. Recommended Multi-Byte Sequence of NOP Instruction**
<pre>
Length Assembly Byte Sequence
=================================================================================
2 bytes 66 NOP 66 90H
3 bytes NOP DWORD ptr [EAX] 0F 1F 00H
4 bytes NOP DWORD ptr [EAX + 00H] 0F 1F 40 00H
5 bytes NOP DWORD ptr [EAX + EAX*1 + 00H] 0F 1F 44 00 00H
6 bytes 66 NOP DWORD ptr [EAX + EAX*1 + 00H] 66 0F 1F 44 00 00H
7 bytes NOP DWORD ptr [EAX + 00000000H] 0F 1F 80 00 00 00 00H
8 bytes NOP DWORD ptr [EAX + EAX*1 + 00000000H] 0F 1F 84 00 00 00 00 00H
9 bytes 66 NOP DWORD ptr [EAX + EAX*1 + 00000000H] 66 0F 1F 84 00 00 00 00 00H</pre>

This allows you to construct "padding `NOP`" of certain sizes. With two of those, you can bridge 16 Bytes, although I second the suggestion to check the optimization guides (for the CPU you're targeting) whether a `JMP` is faster than two such `NOPs`.

[1]:
Reply



Forum Jump:


Users browsing this thread:
2 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through