Interrupts handling

Alexander Kuleshov alex0xax at
Wed Jun 17 07:22:28 EDT 2015


I have a question about interrupt handling in Linux kernel for x86_64.
As we can read in the
64-ia-32-architectures-software-developer-vol-3a-part-1-manual, when
an interurpt/exception occurs, the handler's stack contains SS, RSP,
RFLAGS, CS, RIP and error code. My question is: does processor push
this register on the stack when an interrupt occurs or kernel must
push it?

In the arch/x86/kernel/entry_64.S we can see following code in the
idtentry macro:

.ifeq \has_error_code
pushq_cfi $-1

where pushq_cfi is:

.macro pushq_cfi reg
    pushq \reg

First of all what does it mean $-1 here? I have write simple assembly
program and I see:

push 0xffffffffffffffff

in the gdb. The second question, if processor pushes error code and
other during interrupt why we push it here?

Thank you.

More information about the Kernelnewbies mailing list