<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 17, 2015 at 6:24 PM, Alexander Kuleshov <span dir="ltr"><<a href="mailto:alex0xax@gmail.com" target="_blank">alex0xax@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ah, I understood, $-1 is just -1 here. But why we push it - 0xffffffffffffffff?<br>
<div class="HOEnZb"><div class="h5"><br>
2015-06-17 17:22 GMT+06:00 Alexander Kuleshov <<a href="mailto:alex0xax@gmail.com">alex0xax@gmail.com</a>>:<br>
> Hello,<br>
><br>
> I have a question about interrupt handling in Linux kernel for x86_64.<br>
> As we can read in the<br>
> 64-ia-32-architectures-software-developer-vol-3a-part-1-manual, when<br>
> an interurpt/exception occurs, the handler's stack contains SS, RSP,<br>
> RFLAGS, CS, RIP and error code. My question is: does processor push<br>
> this register on the stack when an interrupt occurs or kernel must<br>
> push it?<br>
><br>
> In the arch/x86/kernel/entry_64.S we can see following code in the<br>
> idtentry macro:<br>
><br>
> .ifeq \has_error_code<br>
> pushq_cfi $-1<br>
> .endif<br>
><br>
> where pushq_cfi is:<br>
><br>
> .macro pushq_cfi reg<br>
> pushq \reg<br>
> CFI_ADJUST_CFA_OFFSET 8<br>
> .endm<br>
><br>
> First of all what does it mean $-1 here? I have write simple assembly<br>
> program and I see:<br>
><br>
> push 0xffffffffffffffff<br>
><br>
> in the gdb. The second question, if processor pushes error code and<br>
> other during interrupt why we push it here?<br>
><br>
> Thank you.<br></div></div></blockquote></div><br></div><div class="gmail_extra">Hi<br><br></div><div class="gmail_extra">Please don't top post, even replying to yourself :)<br><br></div><div class="gmail_extra">IMHO, pushing -1 is to signify this is error code. Later, (just my guess), the error code will be pushed too. <br><br></div><div class="gmail_extra"><br><br>-- <br><div class="gmail_signature">regards,<br><br>Mulyadi Santosa<br>Freelance Linux trainer and consultant<br><br>blog: <a href="http://the-hydra.blogspot.com" target="_blank">the-hydra.blogspot.com</a><br>training: <a href="http://mulyaditraining.blogspot.com" target="_blank">mulyaditraining.blogspot.com</a></div>
</div></div>