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)
g++set up to build Windows object files? I was confused at first because you don't need a speciali686version of gcc to make 32-bit x86 code.