flat assembler
Message board for the users of flat assembler.
Index
> Main > [fasmg] multibytes nop filler for package align |
Author |
|
sylware 20 Jan 2023, 12:48
I saw the align calm instruction from the "package" repository on github.
Any nice multibytes nop filler for it anywhere? |
|||
20 Jan 2023, 12:48 |
|
Tomasz Grysztar 20 Jan 2023, 13:40
You could take ones used by HeavyThing:
Code: struc bstr? bytes& virtual at 0 db bytes load . : $ from 0 end virtual end struc define aligncode aligncode namespace aligncode ?15 bstr 0x66, 0xf, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x66, 0xf, 0x1f, 0x44, 0x00, 0x00 ?14 bstr 0x66, 0xf, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0xf, 0x1f, 0x44, 0x00, 0x00 ?13 bstr 0x66, 0xf, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0xf, 0x1f, 0x40, 0x00 ?12 bstr 0x66, 0xf, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0xf, 0x1f, 0x00 ?11 bstr 0x66, 0xf, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x66, 0x90 ?10 bstr 0x66, 0xf, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, \ 0x90 ?9 bstr 0x66, 0xf, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 ?8 bstr 0xf, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 ?7 bstr 0xf, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00 ?6 bstr 0x66, 0xf, 0x1f, 0x44, 0x00, 0x00 ?5 bstr 0xf, 0x1f, 0x44, 0x00, 0x00 ?4 bstr 0xf, 0x1f, 0x40, 0x00 ?3 bstr 0xf, 0x1f, 0x00 ?2 bstr 0x66, 0x90 ?1 bstr 0x90 ?0 := '' end namespace Code: calminstruction codepad length* compute length, length arrange length, =db =aligncode.length assemble length end calminstruction |
|||
20 Jan 2023, 13:40 |
|
sylware 20 Jan 2023, 14:24
Thx! I'll give it a try with your package align calm instruction.
|
|||
20 Jan 2023, 14:24 |
|
Tomasz Grysztar 21 Jan 2023, 09:19
sylware wrote: Did not manage to make work the utility code Code: align 16, 0 Code: align 16, nops # Code: align 16, db # dup 90h |
|||
21 Jan 2023, 09:19 |
|
Tomasz Grysztar 21 Jan 2023, 09:51
I updated the package: https://github.com/tgrysztar/fasmg/commit/9695d490a2d3b7457841a85f9a3cf1fe14125851
Now you can use it with the macro this way: Code: align 16, codepad # |
|||
21 Jan 2023, 09:51 |
|
sylware 21 Jan 2023, 12:17
(the calm macro was edited with a less quick and dirty version)
Since we would expect code sections to be aligned at least on a code pick/fetch window (power of 2 >= 16bytes), my filler should re-align to a 16bytes window first and I miss a 16bytes block filler. Sorry, but I don't understand how your universal align works with elf64.inc (which does have its own align). Last edited by sylware on 21 Jan 2023, 16:54; edited 1 time in total |
|||
21 Jan 2023, 12:17 |
|
Tomasz Grysztar 21 Jan 2023, 12:36
sylware wrote: Sorry, but I don't understand how your universal align works with elf64.inc (which does have its own align). Code: include 'format/format.inc' format ELF64 include 'align.inc' section '.text' executable align 16 align.assume $, 16 start: int3 align 16, db # dup 90h myproc: Code: include 'format/format.inc' format ELF64 include 'align.inc' macro section? declaration* section declaration match any =align? number, declaration align.assume $, number else align.assume $, 4 end match end macro postpone purge section? end postpone section '.text' executable align 16 start: int3 align 16, db # dup 90h myproc: |
|||
21 Jan 2023, 12:36 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.