Author Topic: Unwindable stack  (Read 794 times)

enzechen

  • Regular Member
  • *
  • Posts: 9
Unwindable stack
« on: November 22, 2016, 01:30:31 AM »
Hi Steve,

May I ask whether you are going to implement the unwindable stack directives (prologue declaration) like {.ALLOCSTACK
.ENDPROLOG
.PUSHFRAME
.PUSHREG
.SAVEREG
.SAVEXMM128
.SETFRAME} into the INVOKE macro?

Is this the only way to provide a way to process the exception?

Thanks a lot.

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5659
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: Unwindable stack
« Reply #1 on: November 22, 2016, 03:45:07 AM »
From the reference material I could find which generally was very poor, the set of directives are designed for structured exception handling in a C compiler and I could not see their advantage with manually coded assembler. The way the prologue/epilogue is structured in the macro is to fill the shadow space with the first 4 arguments then write any others to a sequence of stack locations. This ensures that the normal high level interface for procedures works in a predictable manner without being overwritten. There are the normal directives to turn the stack frame off for procedures that do not require local values and have 4 or less arguments.

Now this means for data sizes greater than 64 bit which means 128 bit SSE and 256 bit AVX (have not tested code on 512 bit yet) that normal stack cannot be used for these data sizes so you either directly pass data in registers or pass the address of the larger data. Passing data in a structure is also viable.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin: