I downloaded the intel IA-64 and 32 book because I wanted to know more in depth about how a CPU works. So I read the book and started to code some stuff. I enabled the IDT and when I want to program an interrupt handler I have that code :
extern "C" __attribute__((interrupt)) void test (void* ptr)
{
}
int main (void)
{
return 0;
}
when I compile with i686-elf-g++ -Wall -Wextra -O2 -c -m32 main.cpp I have the following warning : main.cpp:6:60: warning: 'interrupt' attribute directive ignored, but when I compile with g++ -Wall -Wextra -O2 -c -m32 main.cpp the compilation just works well and the code generated is like it should be with the iret instruction at the end (and that's what I want) :
Disassembly of section __TEXT,__text:
_test:
0: 55 push ebp
1: 89 e5 mov ebp, esp
3: fc cld
4: 5d pop ebp
5: cf iretd
6: 66 2e 0f 1f 84 00 00 00 00 00 nop word ptr cs:[eax + eax]
Does anyone have any idea of why I have this warning with my cross platform version of gcc ? (and I am also wondering why an interrupt handler must have a pointer at parameter for gcc)
The interrupt attribute is only a recent addition to G++ when targeting x86/x86-64 architectures and is available in G++ 7.0 and later.I would guess that your i686-elf-g++ cross compiler is earlier than 7.0 and your host compiler g++ is 7.0 or later. You'll have to upgrade your i686 cross compiler to a newer version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With