Re: [PATCH] x86: make 32-bit "emergency stack" better documented

From: Denys Vlasenko
Date: Mon Mar 09 2015 - 10:14:39 EST


On Mon, Mar 9, 2015 at 2:43 PM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
>> /* Offset from the sysenter stack to tss.sp0 */
>> DEFINE(TSS_sysenter_sp0, offsetof(struct tss_struct, x86_tss.sp0) -
>> - sizeof(struct tss_struct));
>> + (offsetof(struct tss_struct, SYSENTER_stack_last_word) + 4));
>
> Is there no way to do this using sizeof to avoid having a "last_word" member.

sizeof of a structure member? IIRC in C sizeof can't be used for that.
You need to concoct a fictitious object, dereference its member
and take sizeof of _that_.

It would look horrible. Something like:

offsetof(struct tss_struct, SYSENTER_stack) +
sizeof(((struct tss_struct*)NULL)->SYSENTER_stack)
--
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/