Re: [PATCH 4/5] x86-64: Handle exception table entries during earlyboot

From: H. Peter Anvin
Date: Thu Apr 19 2012 - 12:59:39 EST


On 04/19/2012 06:02 AM, Borislav Petkov wrote:>> + # 56(%rsp) %rflags
>> + # 48(%rsp) %cs
>> + # 40(%rsp) %rip
>> + # 32(%rsp) error code
>
> Just a question about understanding this: I was strugging with the
> exact interrupt-handler stack layout, so how do you know the exact
> offsets of rflags, cs et all? I've been staring at our APM v2, p. 144
> (http://support.amd.com/us/Processor_TechDocs/24593_APM_v2.pdf) which
> shows the interrupt stack with error code but it has different offsets
> than those above:
>
> [Return SS] 40(%rsp)
> [Return RSP] 32(%rsp)
> [rFLAGS] 24(%rsp)
> [CS] 16(%rsp)
> [RIP] 8(%rsp)
> [ErrorCode] 0(%rsp)
>
> but I see below that we have room for %rax, %rcx and %rdx on the stack.
>
> Are we doing something different in Linux, or what am I missing?

The offsets in my code refer to offsets after we push the vector number,
%rax, %rcx and %rdx onto the stack manually; that is 4*8 = 32 bytes,
hence the offset.

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

--
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/