Barrelfish
Macros
irq.c File Reference

x86-32 interrupt/exception handling utility functions More...

Macros

#define HW_EXCEPTION_NOERR(num)
 Define IRQ handler number 'num'. More...
 
#define HW_IRQ(num)   XHW_IRQ(num)
 Noop wrapper for HW_IRQ to deal with CPP stringification problems.
 

Detailed Description

x86-32 interrupt/exception handling utility functions

Macro Definition Documentation

#define HW_EXCEPTION_NOERR (   num)
Value:
void __attribute__ ((visibility ("hidden"))) hwexc_##num(void); \
__asm ( \
"\t.text \n\t" \
"\t.type hwexc_"#num",@function \n\t" \
"hwexc_"#num": \n\t" \
"pushl $0 /* dummy error code */ \n\t" \
"pushl $"#num" /* vector number */ \n\t" \
"jmp hwexc_common /* common stuff */ \n\t" \
)

Define IRQ handler number 'num'.

This defines an interrupt handler for vector #num. The way this is done is quite tricky: A block of assembly is emitted, with a label pointing to the beginning of that block. The label is made known as a symbol by having a C function declaration directly in front of the block. The symbol has to be defined extern, so it is global, but its ELF visibility is set "hidden", so that the symbol does not end up in the GOT. This is very important for keeping the code position-independent.

The NOERR/ERR variants depend on whether the hardware delivers an error code.