I using hjl/interrupt/gcc-5-branch and my program is crashing when I
issue an INT xx. The problem appears to me to be that using
__attribute__ ((interrupt)) causes the a IRET to be emitted when an
IRETQ should be emitted. Below is my trivial do nothing main.c which I
compile with and then use objdump to view the assembler source.
I compiled x86_64-unknown-elf-xxxx using crosstool-ng, could that be a problem?
$ cat main.c
typedef unsigned long u64;
typedef struct intr_frame {
u64 ip;
u64 cs;
u64 flags;
u64 sp;
u64 ss;
} intr_frame;
__attribute__ ((interrupt))
void ih(struct intr_frame* frame) {
}
void main(void) {
}
$ x86_64-unknown-elf-gcc -c main.c -o main.o -m64
$ x86_64-unknown-elf-objdump -d main.o
main.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <ih>:
0: 55 push %rbp
1: 48 89 e5 mov %rsp,%rbp
4: 50 push %rax
5: 48 8d 45 08 lea 0x8(%rbp),%rax
9: 48 89 45 f0 mov %rax,-0x10(%rbp)
d: 90 nop
e: 58 pop %rax
f: 5d pop %rbp
10: cf iret
0000000000000011 <main>:
11: 55 push %rbp
12: 48 89 e5 mov %rsp,%rbp
15: 90 nop
16: 5d pop %rbp
17: c3 retq