Reason for playing games with vector number on x86-64 interrupt handling

From: Ilya Lesokhin
Date: Sun Feb 03 2013 - 14:33:27 EST


Hi,

I have a question related to interrupt handling on x86-64.

entry_64.s cains the following code:
pushq_cfi $(~vector+0x80) /* Note: always in signed byte range */
and later
addq $-0x80,(%rsp) /* Adjust vector to [-256,-1] range *
and then finally in irq.c
unsigned vector = ~regs->orig_ax;

if I'm not mistaken regs->orig_ax contains ((~vector+0x80) -0x80) =
~vector and applying ~ again gives vector.

I was wondering, what is the reason for all those games with vector?
why not just push vector in the begging and save later instructions?

Please CC me in your answers.
Thanks,
Ilya
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/