[Bug target/66960] Add interrupt attribute to x86 backend

goswin-v-b at web dot de gcc-bugzilla@gcc.gnu.org
Wed Jul 6 19:56:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66960

--- Comment #17 from Goswin von Brederlow <goswin-v-b at web dot de> ---
(In reply to H.J. Lu from comment #16)
> (In reply to Goswin von Brederlow from comment #15)
> 
> > > No.  We only do it for data pushed onto stack by CPU.
> > 
> > I was thinking of something like:
> > 
> > __attribute__ ((interrupt("save_regs")))
> > void
> > f (struct interrupt_frame *frame, uword_t error_code, struct regs regs)
> > {
> >     kprintf("user SP = %#016x\n", regs.sp);
> > }
> 
> It is an interesting idea.  But frame and err_code are created by caller,
> which is CPU, not by callee.  You want to not only save all original
> registers of interrupted process, but also make them available to interrupt
> handler.  This won't be supported without significant changes in
> infrastructure.

Is it a significant change?

On a normal function gcc creates a stackframe and pushes callee saved registers
that it later uses onto the stack. I'm suggesting doing much the same with 2
small changes:

1) push all registers unconditionally
2) make the address where the registers got pushed to known to the function


More information about the Gcc-bugs mailing list