Skip to contentSkip to conversation

asm offsets for i386

PATCH Pete Zaitcev 3 participants 3 messages Mar 27, 2003 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 7 lines

[Resend]

This patch creates an asm-offsets.c file for i386, and removes the hardcoded constants from several asm files.

--
Brian Gerst

Doesn't seem to be worth the trouble because thread_info is a small structure, not embedded into a big structure as thread_struct was. DaveM removed the automatic offset generation on sparc64 and I am thinking to do the same on sparc.

I'm not surprised that nobody answered, the patch seems to be rather pointless.

We might want to add something like this:

    if (TI_CPU         != offsetof(struct thread_info, cpu) ||
        TI_PREEMPT     != offsetof(struct thread_info, preempt_count) ||
        TI_SOFTIRQ     != offsetof(struct thread_info, softirq_count) ||
        TI_HARDIRQ     != offsetof(struct thread_info, hardirq_count))
            thread_info_offsets_are_bolixed_linus();

It gives out an link time error.

-- Pete

#2 lore raw
Quoted 26 lines · Pete Zaitcev
Quoted 7 lines

[Resend]

This patch creates an asm-offsets.c file for i386, and removes the hardcoded constants from several asm files.

--
Brian Gerst

Doesn't seem to be worth the trouble because thread_info is a small structure, not embedded into a big structure as thread_struct was. DaveM removed the automatic offset generation on sparc64 and I am thinking to do the same on sparc.

I'm not surprised that nobody answered, the patch seems to be rather pointless.

We might want to add something like this:

    if (TI_CPU         != offsetof(struct thread_info, cpu) ||
        TI_PREEMPT     != offsetof(struct thread_info, preempt_count) ||
        TI_SOFTIRQ     != offsetof(struct thread_info, softirq_count) ||
        TI_HARDIRQ     != offsetof(struct thread_info, hardirq_count))
            thread_info_offsets_are_bolixed_linus();
Quoted 4 lines

It gives out an link time error.

-- Pete

I already caught one bug with this, since someone recently added values to the feature flags array and didn't fix up the vendor id offset. What you propose fails with some non-gcc compilers (Intel's compiler for example, which supports gcc extensions) that don't optimize it away.

--
Brian Gerst

#3 lore raw
Quoted 4 lines · Brian Gerst

I already caught one bug with this, since someone recently added values to the feature flags array and didn't fix up the vendor id offset. What you propose fails with some non-gcc compilers (Intel's compiler for example, which supports gcc extensions) that don't optimize it away.

Too f*ing bad, this kind of debug test already exists in other places of the kernel.

Signature · 1 line
David S. Miller <[email protected]>