[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: curcpu() and curlwp()
In article <20110605171617.GD2029%snowdrop.l8s.co.uk@localhost>,
David Laight <david%l8s.co.uk@localhost> wrote:
>I've just been looking at the definitions of curcpu() etc on
>i386 and amd64 (they differ only in the segment register used).
>in sys/arch/i386/include/cpu.h we have:
>__inline static lwp_t * __attribute__ ((const))
> lwp_t *l;
> __asm volatile("movl %%fs:%1, %0" :
> "=r" (l) :
> (*(struct cpu_info * const *)offsetof(struct cpu_info,
> return l;
>I think it should be:
> "m" (((const struct cpu_info *)0)->ci_curlwp)
>The actual code seems to be a reference to a pointer to 'struct cpu_info'.
>The generated code is probably identical, but the inferences are different.
>(cpu_set_curpri() is broken in a different, but similar way.)
>I also think that the curcpu() and culwp() functions need not be volatile.
I think that if offsetof() produces suboptimal code, it should be fixed,
not expanded in place differently.
Main Index |
Thread Index |