<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 31, 2018 at 2:52 PM, Amaan Cheval <span dir="ltr"><<a href="mailto:amaan.cheval@gmail.com" target="_blank">amaan.cheval@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Chris!<br>
<br>
I currently have code like this in c/src/lib/libbsp/x86_64/amd64/<wbr>Makefile.am:<br>
<br>
    librtemsbsp_a_SOURCES +=<br>
../../../../../../bsps/x86_64/<wbr>amd64/interrupts/handlers.c<br>
    # XXX: Needed to use GCC "interrupt" attribute directives - can we<br>
pass these<br>
    # flags only for the handlers.c source file (compile to an object<br>
file first and<br>
    # then link with the rest for librtemsbsp.a?)<br>
    librtemsbsp_a_CFLAGS = -mgeneral-regs-only<br>
<br>
The CFLAGS arg is required to allow us to use<br>
"__attribute__((interrupt))" to setup interrupt handlers in C. (See<br>
[1] and ctrl+f "interrupt" for more.)<br>
<br>
Is there a way to not force the CFLAGS for _all_ of librtemsbsp, but<br>
to limit it only to handlers.c?<br>
<br>
If not, is the above code something that would be acceptable to have upstream?<br>
<br>
[1] <a href="https://gcc.gnu.org/onlinedocs/gcc/x86-Function-Attributes.html#x86-Function-Attributes" rel="noreferrer" target="_blank">https://gcc.gnu.org/<wbr>onlinedocs/gcc/x86-Function-<wbr>Attributes.html#x86-Function-<wbr>Attributes</a></blockquote><div><br></div><div>Are we basically talking about the outermost layer of your interrupt dispatching?</div><div><br></div><div><br></div><div>Have you looked at the basic approach taken by the other ports? They end</div><div>up switching the stack pointer to a dedicated stack on the outermost interrupt</div><div>and, if a context switch/dispatch is needed, arrange for the interrupted</div><div>task to call _Thread_Dispatch.But tinker with its stack so some registers</div><div>are saved and it looks like it made the call itself.</div><div><br></div><div>If you can do it in C, I am ok with an attribute. I just don't think you</div><div>can pull off all the stack and return to dispatch magic that way.</div><div><br></div><div>--joel</div></div><br></div></div>