On Wed, Jun 17, 2015 at 6:24 PM, Alexander Kuleshov <alex0xax@gmail.com> wrote:
Ah, I understood, $-1 is just -1 here. But why we push it - 0xffffffffffffffff?
2015-06-17 17:22 GMT+06:00 Alexander Kuleshov <alex0xax@gmail.com>:
Hello,
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 .endif
where pushq_cfi is:
.macro pushq_cfi reg pushq \reg CFI_ADJUST_CFA_OFFSET 8 .endm
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.
Hi Please don't top post, even replying to yourself :) IMHO, pushing -1 is to signify this is error code. Later, (just my guess), the error code will be pushed too. -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com