Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimal no-ops #9

Open
gaul opened this issue Jul 16, 2021 · 0 comments
Open

Optimal no-ops #9

gaul opened this issue Jul 16, 2021 · 0 comments

Comments

@gaul
Copy link
Owner

gaul commented Jul 16, 2021

It is better to use fewer but longer no-ops to achieve padding. Some examples:

1:  90                             nop
2:  66 90                          data16 nop
3:  0F 1F 00                       nopl  %eax, (%rax)
4:  0F 1F 40 00                    nopl  %eax, (%rax)
5:  0F 1F 44 00 00                 nopl  %eax, (%rax,%rax,1)
6:  66 0F 1F 44 00 00              nopw  %ax,  (%rax,%rax,1)
7:  0F 1F 80 00 00 00 00           nopl  %eax, (%rax)
8:  0F 1F 84 00 00 00 00 00        nopl  %eax, (%rax,%rax,1)
9:  66 0F 1F 84 00 00 00 00 00     nopw  %ax,  (%rax,%rax,1)
10: 66 2E 0F 1F 84 00 00 00 00 00  nopw  %ax,  (%rax,%rax,1)

More recent processors support efficient 15-byte no-ops as well. References:

gaul added a commit that referenced this issue Sep 26, 2021
Does not handle 11-15 byte sequences.  References #9.
gaul added a commit that referenced this issue Sep 26, 2021
Does not handle 11-15 byte sequences.  References #9.
gaul added a commit that referenced this issue Sep 26, 2021
Does not handle 11-15 byte sequences.  References #9.
gaul added a commit that referenced this issue Sep 26, 2021
Does not handle 11-15 byte sequences.  References #9.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant