Messages in this thread |  | | | Date | Tue, 21 Dec 2010 15:24:45 -0800 | | From | "H. Peter Anvin" <> | | Subject | Re: [cpuops cmpxchg double V1 1/4] Generic support for this_cpu_cmpxchg_double |
| |
On 12/21/2010 02:36 PM, Christoph Lameter wrote: > On Sat, 18 Dec 2010, Tejun Heo wrote: > >> pointers from the beginning. Anyways, that's too late, so is it >> completely impossible to make cmpxchg_double's take a scalar value? >> It can take the pointer all the same, no? > > It could take a scalar value like the others but we are then not operating > on the scalar alone but also on the following field. >
I'm a bit confused on this one. The standard cmpxchg() takes a scalar and a pointer, and returns a scalar. The equivalent for the "double" variety would be to return a compound object, basically:
struct double_ulong { unsigned long v[2]; }; ... which can be returned in registers on both i386 and x86-64.
It's a bit clumsy from a type perspective, but I'm not sure that that is a bad thing. Doing too much type genericity has caused us problems in the past.
-hpa
-- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
|  |