Skip to content

Commit 1b246d2

Browse files
committed
Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 asm updates from Ingo Molnar: - better support (non-atomic) 64-bit readq()/writeq() variants (Andy Shevchenko) - __clear_user() micro-optimization (Alexey Dobriyan) * 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/io: Define readq()/writeq() to use 64-bit type x86/asm/64: Micro-optimize __clear_user() - Use immediate constants
2 parents 5cef8c2 + 6469a0e commit 1b246d2

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

arch/x86/include/asm/io.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ build_mmio_write(__writel, "l", unsigned int, "r", )
9494

9595
#ifdef CONFIG_X86_64
9696

97-
build_mmio_read(readq, "q", unsigned long, "=r", :"memory")
98-
build_mmio_read(__readq, "q", unsigned long, "=r", )
99-
build_mmio_write(writeq, "q", unsigned long, "r", :"memory")
100-
build_mmio_write(__writeq, "q", unsigned long, "r", )
97+
build_mmio_read(readq, "q", u64, "=r", :"memory")
98+
build_mmio_read(__readq, "q", u64, "=r", )
99+
build_mmio_write(writeq, "q", u64, "r", :"memory")
100+
build_mmio_write(__writeq, "q", u64, "r", )
101101

102102
#define readq_relaxed(a) __readq(a)
103103
#define writeq_relaxed(v, a) __writeq(v, a)

arch/x86/lib/usercopy_64.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ unsigned long __clear_user(void __user *addr, unsigned long size)
2323
asm volatile(
2424
" testq %[size8],%[size8]\n"
2525
" jz 4f\n"
26-
"0: movq %[zero],(%[dst])\n"
27-
" addq %[eight],%[dst]\n"
26+
"0: movq $0,(%[dst])\n"
27+
" addq $8,%[dst]\n"
2828
" decl %%ecx ; jnz 0b\n"
2929
"4: movq %[size1],%%rcx\n"
3030
" testl %%ecx,%%ecx\n"
3131
" jz 2f\n"
32-
"1: movb %b[zero],(%[dst])\n"
32+
"1: movb $0,(%[dst])\n"
3333
" incq %[dst]\n"
3434
" decl %%ecx ; jnz 1b\n"
3535
"2:\n"
@@ -40,8 +40,7 @@ unsigned long __clear_user(void __user *addr, unsigned long size)
4040
_ASM_EXTABLE(0b,3b)
4141
_ASM_EXTABLE(1b,2b)
4242
: [size8] "=&c"(size), [dst] "=&D" (__d0)
43-
: [size1] "r"(size & 7), "[size8]" (size / 8), "[dst]"(addr),
44-
[zero] "r" (0UL), [eight] "r" (8UL));
43+
: [size1] "r"(size & 7), "[size8]" (size / 8), "[dst]"(addr));
4544
clac();
4645
return size;
4746
}

0 commit comments

Comments
 (0)