summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2010-04-20 15:06:44 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2010-04-21 01:06:53 +0400
commit92aa187f3ab5228caa95494e30a7efc06288802e (patch)
tree8c887d40b03109367d2ddcf7d1f9350a1415fd94 /macros
parentd807d911feadad61c8afb09d74e4239859eba993 (diff)
downloadnasm-92aa187f3ab5228caa95494e30a7efc06288802e.tar.gz
nasm-92aa187f3ab5228caa95494e30a7efc06288802e.tar.bz2
nasm-92aa187f3ab5228caa95494e30a7efc06288802e.zip
smartalign: Introduce nojmp mode
This allows to force nasm to generate multibyte NOPs without jmp injected. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'macros')
-rw-r--r--macros/smartalign.mac10
1 files changed, 7 insertions, 3 deletions
diff --git a/macros/smartalign.mac b/macros/smartalign.mac
index 51779c6..32e7b3f 100644
--- a/macros/smartalign.mac
+++ b/macros/smartalign.mac
@@ -150,7 +150,11 @@ USE: smartalign
%error unknown alignment mode: %1
%endif
%ifnempty %2
- %xdefine __ALIGN_JMP_THRESHOLD__ %2
+ %ifidni %2,nojmp
+ %xdefine __ALIGN_JMP_THRESHOLD__ -1
+ %else
+ %xdefine __ALIGN_JMP_THRESHOLD__ %2
+ %endif
%endif
%xdefine __ALIGNMODE__ %1,__ALIGN_JMP_THRESHOLD__
%endmacro
@@ -162,14 +166,14 @@ USE: smartalign
%else
%push
%assign %$pad (((%1) - (($-$$) % (%1))) % (%1))
- %if %$pad > __ALIGN_JMP_THRESHOLD__
+ %if __ALIGN_JMP_THRESHOLD__ != -1 && %$pad > __ALIGN_JMP_THRESHOLD__
jmp %$end
; We can't re-use %$pad here as $ will have changed!
times (((%1) - (($-$$) % (%1))) % (%1)) nop
%$end:
%else
times (%$pad / __ALIGN_%[__BITS__]BIT_GROUP__) \
- db __ALIGN_%[__BITS__]BIT_%[__ALIGN_%[__BITS__]BIT_GROUP__]B__
+ db __ALIGN_%[__BITS__]BIT_%[__ALIGN_%[__BITS__]BIT_GROUP__]B__
%assign %$pad %$pad % __ALIGN_%[__BITS__]BIT_GROUP__
%if %$pad > 0
db __ALIGN_%[__BITS__]BIT_%[%$pad]B__