diff options
Diffstat (limited to 'gcc/doc/extend.texi')
-rw-r--r-- | gcc/doc/extend.texi | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 63fce0f9cf4..6a94d9dd2dd 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -5182,6 +5182,69 @@ On x86-32 targets, the @code{stdcall} attribute causes the compiler to assume that the called function pops off the stack space used to pass arguments, unless it takes a variable number of arguments. +@item no_caller_saved_registers +@cindex @code{no_caller_saved_registers} function attribute, x86 +Use this attribute to indicate that the specified function has no +caller-saved registers. That is, all registers are callee-saved. +The compiler generates proper function entry and exit sequences to +save and restore any modified registers. + +@item interrupt +@cindex @code{interrupt} function attribute, x86 +Use this attribute to indicate that the specified function is an +interrupt handler. The compiler generates function +entry and exit sequences suitable for use in an interrupt handler when +this attribute is present. The @code{IRET} instruction, instead of the +@code{RET} instruction, is used to return from interrupt handlers. All +registers, except for the EFLAGS register which is restored by the +@code{IRET} instruction, are preserved by the compiler. + +Any interruptible-without-stack-switch code must be compiled with +@option{-mno-red-zone} since interrupt handlers can and will, because +of the hardware design, touch the red zone. + +An interrupt handler must be declared with a mandatory pointer +argument: + +@smallexample +struct interrupt_frame; + +__attribute__ ((interrupt)) +void +f (struct interrupt_frame *frame) +@{ +@} +@end smallexample + +and user must properly define the structure the pointer pointing to. + +The exception handler is very similar to the interrupt handler with +a different mandatory function signature: + +@smallexample +#ifdef __x86_64__ +typedef unsigned long long int uword_t; +#else +typedef unsigned int uword_t; +#endif + +struct interrupt_frame; + +__attribute__ ((interrupt)) +void +f (struct interrupt_frame *frame, uword_t error_code) +@{ + ... +@} +@end smallexample + +and compiler pops the error code off the stack before the @code{IRET} +instruction. + +The exception handler should only be used for exceptions which push an +error code and all other exceptions must use the interrupt handler. +The system will crash if the wrong handler is used. + @item target (@var{options}) @cindex @code{target} function attribute As discussed in @ref{Common Function Attributes}, this attribute |