News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

GetThreadContext CONTEXT structure problem with masm

Started by white scorpion, December 16, 2007, 09:07:20 PM

Previous topic - Next topic

white scorpion

Thanks guys, but it still doesn;t make sense...

Why align 16 and not 4? AFAIK the biggest member of the structure is 4 bytes (DWORD).
But from what I understood from the link it's merely a performance issue rather then a real major issue, is that correct?

ToutEnMasm


Microsoft is the only one who choose that to reduce access time.
We can see what is the choose of microsoft in the header files.
In this files we find packN.h (N=1 to 16) to fix the alignement.
popack files return to origin alignement.

drizz

Quote from: white scorpion on December 20, 2007, 04:59:36 PM
Thanks guys, but it still doesn;t make sense...

Why align 16 and not 4? AFAIK the biggest member of the structure is 4 bytes (DWORD).
But from what I understood from the link it's merely a performance issue rather then a real major issue, is that correct?

it doesn't have to be 16. 4, 8 or 16 are fine.
FYI Microsoft C++ compiler alignes all structures at 8byte boundary by default.

The point is that it needs to be aligned.

so to summarize:
1) it's good to align structures and data for performance.
2) CONTEXT is a special case because fpu state is stored to it, and instructions that store it require aligned buffer.
The truth cannot be learned ... it can only be recognized.

white scorpion

I still don't completely get why, but who cares, I'll just align it ;)

Thanks for the advise guys!!

component

GetThreadContext CONTEXT structure problem with masm <=== hey DriZz

see youre pictured code above what IDE (in color) or assembler are you using there it looks nice ,cool and you choose good colors for your source code?  :8)

rags

Quote from: drizz on December 17, 2007, 04:20:01 AM
2) Use a descent ide like RadAsm that has code completition and you won't have such problems.
(of course structure names are adjusted for masm32 so they don't interfere with masm keywords)

He is using RadAsm, But I do not know what color scheme he is using for it.
God made Man, but the monkey applied the glue -DEVO