Re: patch to use more symbolic constants in asm

From: Andi Kleen
Date: Wed Feb 21 2007 - 06:57:08 EST


On Wednesday 21 February 2007 12:10, Arjan van de Ven wrote:
> From: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
> Subject: Use symbolic constants in inline assembly
>
> This patch replaces several of the %0/%1 uses in x86-64 inline assembly
> with symbolic names (this is a new gcc 3.x feature, but that's ok now).
> This tends to, imo, make the inline assembly a lot more readable, and
> for sure it's less error prone in terms of finding which %<number>
> corresponds with which variable.

At least for two arguments i don't really see the value, but ok.

> objdump -d of the vmlinux before and after the patch is the same; also
> boot tested.

You should do i386 too then; one reason I didn't touch bitops
for example was to keep the code more similar.


> static inline void set_cr4(unsigned long cr4)
> {
> - asm volatile("mov %0,%%cr4" :: "r" (cr4) : "memory");
> + asm volatile("mov %[cr4],%%cr4" :: [cr4] "r" (cr4) : "memory");

I'm not sure that's really an improvement for example.

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