Re: [cpuops cmpxchg double V1 2/4] x86: this_cpu_cmpxchg_double()support

From: H. Peter Anvin
Date: Tue Dec 14 2010 - 19:47:21 EST


On 12/14/2010 09:48 AM, Christoph Lameter wrote:
> +
> +/*
> + * Inputs:
> + * %rsi : memory location to compare
> + * %rax : low 64 bits of old value
> + * %rdx : high 64 bits of old value
> + * %rbx : low 64 bits of new value
> + * %rcx : high 64 bits of new value
> + * %al : Operation successful
> + */
> +ENTRY(cmpxchg16b_cpuops_emu)
> +CFI_STARTPROC
> +
> +#
> +# Emulate 'cmpxchg16b %gs:(%rsi)' except we return the result in
> +# al not via the ZF. Caller will access al to get result.
> +#
> +cmpxchg16b_cpuops_emu:
> + pushf
> + cli
> +
> + cmpq %gs:(%rsi), %rax
> + jne not_same
> + cmpq %gs:8(%rsi), %rdx
> + jne not_same
> +
> + movq %rbx, %gs:(%rsi)
> + movq %rcx, %gs:8(%rsi)
> +
> + popf
> + mov $1, %al
> + ret
> +
> + not_same:
> + popf
> + xor %al,%al
> + ret
> +
> +CFI_ENDPROC
> +
> +ENDPROC(cmpxchg16b_cpuops)
> +

NAK on this. This is acceptable for cmpxchg8b only because we don't
support SMP on 486s anymore. x86-64 is another matter...

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