, . , , iret .
GCC ( NASM) :
extern void isr_test1(void);
extern void isr_test2(void);
__asm__(".global isr_test1\n"
"isr_test1:\n\t"
"iret");
__asm__(".global isr_test2\n"
"isr_test2:\n\t"
"cld\n\t"
"pusha\n\t"
"call isr_test2_handler\n\t"
"popa\n\t"
"iret");
void isr_test2_handler(void)
{
return;
}
__asm__ GCC . (ISR) .globl ( , ).
. , , iret , C. . C , , C CLD. 32- . 64- , PUSHA POPA.
. GCC Windows , , , _ ( ). :
extern void isr_test1(void);
extern void isr_test2(void);
__asm__(".global _isr_test1\n"
"_isr_test1:\n\t"
"iret");
__asm__(".global _isr_test2\n"
"_isr_test2:\n\t"
"cld\n\t"
"pusha\n\t"
"call _isr_test2_handler\n\t"
"popa\n\t"
"iret");
void isr_test2_handler(void)
{
return;
}
MSVC/MSV++
Microsoft C/++ . :
- Microsoft C. , naked storage-class, . , /, . .
:
__declspec(naked) int isr_test(void)
{
__asm { iret };
}
, GCC.
GCC 7.x + x86/x86-64
GCC 7.0+ __attribute__((interrupt)) . x86 x86-64:
, , ( , , ). , , . IRET RET . , EFLAGS, IRET, . GCC MPX, SSE, MMX x87, GCC -mgeneral-regs-only.
. - , C- , , . , , , ( : int 0x80 Linux). .