<HTML>
<style> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }</style>I stand corrected.<br>
<br>
Normally if I want to write a second epilogue, I simply compile the project and look at the disassembly, and copy what the compiler puts in for the epilogue.  The only one I remember off-hand is for leaf functions with no stack frame and which uses only volatile registers, hence a simple RET.  I'll get it right in the end!<br>
<br>
Gareth aka. Kit<br>
<br>
P.S. You might want to tell your spam filter that these messages are sound, so we're not put off at the sight of "*** GMX Spamverdacht ***"!<br>
 <br>
<br>
<span style="font-weight: bold;">On Sun 29/04/18 12:44 , "Thorsten Engler" thorsten.engler@gmx.net sent:<br>
</span><blockquote style="BORDER-LEFT: #F5F5F5 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px"><span style="color: rgb(102, 102, 102);">> From: fpc-devel <<a href="mailto:fpc-devel-bounces@lists.freepascal.org">fpc-devel-bounces@lists.freepascal.org</a>> On Behalf
</span><br>

<span style="color: rgb(102, 102, 102);">> Of J. Gareth Moreton
</span><br>


<br>

<span style="color: rgb(102, 102, 102);">> For functions with a stack frame, either LEAVE or MOV RSP, RBP; POP
</span><br>

<span style="color: rgb(102, 102, 102);">> RBP must precede it.
</span><br>

It's not quite that simple, at least under windows:
<br>

<a target="_blank" href="https://docs.microsoft.com/en-us/cpp/build/prolog-and-epilog"><span style="color: red;">https://docs.microsoft.com/en-us/cpp/build/prolog-and-epilog</span></a>
<br>


<br>

But yes, this documents that there can be multiple epilogues, so the additional ret would be fine in this regard.
<br>


<br>

Following this exact format is required so that the stack unwinder during processing of SEH (structured exception handling) which is performed by the OS can correctly restore the value of non-volatile registers that has been saved on the stack.
<br>


<br>

Fortunately, as our function in this case doesn't use the stack at all and doesn't contain calls to other functions, this can be skipped.
<br>


<br>

<span style="color: rgb(102, 102, 102);">> So what happens now? Do we submit a patch?
</span><br>

I think Sven Barth was going to fix this up anyway?
<br>


<br>

Cheers,
<br>

Thorsten
<br>


<br>

_______________________________________________
<br>

fpc-devel maillist  -  <a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<br>

<a target="_blank" href="<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>"><span style="color: red;">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</span></a>
<br>

<br>

<br>

</blockquote></HTML>