[PATCH] x86 interrupt attribute

H.J. Lu hjl.tools@gmail.com
Tue Sep 29 21:49:00 GMT 2015


On Tue, Sep 29, 2015 at 1:16 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Sep 29, 2015 at 11:49 AM, Mike Stump <mikestump@comcast.net> wrote:
>> To be feature complete, it would be nice to have two styles of interrupt functions, one that returns with iret, and one that returns with ret.  The point is that the user might want to call functions from a interrupt handler and not save and restore all call clobbered registers.  By allowing a ret style interrupt handler, calls to a ret style interrupt routine can avoid saving and restoring all call clobbered registers.
>
> Do you have a testcase for this?  I think the current implementation
> covers most use cases.
>
>> Oh, and I wish that all the port independent code for interrupt functions was shared across all ports, as redoing all this code for each port is silly (sad).  And example of this would be the sibcall code, the fact that all call saved registers need to be saved is another.  The EPILOGUE_USES or the gen_rtx_USE is yet another.  Type checking the return type to ensure the return type is void, likely another.
>
> A very good point, but beyond this implementation :-(.
>
>> One last comment, most folks use EPILOGUE_USES and mark up the registers as used.  You don’t.  I’m not sure if both ways work equally well, or if there is a reason to prefer one over the other.  Maybe someone could comment on this, as in my port I use EPILOGUE_USES and it seems to work just fine.
>
> We will take a look.

Julia, I checked a patch into hjl/interrupt/master branch to
define EPILOGUE_USES in i386:

commit f3a6675a8d69d810d2cad0c090a762094a0a8622
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Sep 29 13:47:18 2015 -0700

    Define EPILOGUE_USES in i386

    Define EPILOGUE_USES in i386 so that all preserved registers are used
    by the epilogue of interrupt handler.  Don't explicitly mark BP and SP
    registers as used since they are always used in epilogue.

Please take a look.


-- 
H.J.



More information about the Gcc-patches mailing list