flat assembler
Message board for the users of flat assembler.
Index
> Windows > Misaligned Stack |
Author |
|
Tomasz Grysztar 25 Jun 2003, 08:24
Stack should be always aligned to 4 in Win32, and misalignment often causes some of system functions to fail - I had the same problem in the earlier versions of fasm, which were ported from DOS, where no stack doesn't need to be aligned.
Maybe we should add some alignment to the "enter" macro, so it'll be automatically avoided? |
|||
25 Jun 2003, 08:24 |
|
roticv 25 Jun 2003, 09:09
like
Code: add esp, 3 and esp, -4 ? |
|||
25 Jun 2003, 09:09 |
|
scientica 25 Jun 2003, 14:50
privalov wrote: Stack should be always aligned to 4 in Win32, and misalignment often causes some of system functions to fail - I had the same problem in the earlier versions of fasm, which were ported from DOS, where no stack doesn't need to be aligned. I think it should be implented by default in the enter macro, for win32, I don't if the Penguins get mad in linux if the plates are disaligned (=I don't know how linux treat the issue ), enven thought I think the stack should be aligned on a dword boundary (for all 32-OSes, qword aligned fo 64-bits, and 16-bit for those systems who only uses 16-bit), it's kinda like a pile of plates, I don't fancy the idea of a tilting high pile of plates btw, the WinNT systems are especially affected by disaligned stacks iirc. _________________ ... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself. - Bradley Kuhn |
|||
25 Jun 2003, 14:50 |
|
Tomasz Grysztar 25 Jun 2003, 15:02
It should be something like:
Code: macro enter { rb (4 - ($-dynamic_data) and 11b) and 11b dynamic_size = $ - dynamic_data end virtual enter dynamic_size,0 } |
|||
25 Jun 2003, 15:02 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.