Date: Fri, 14 Sep 2018 15:29:35 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338683 - head/sys/amd64/amd64 Message-ID: <201809141529.w8EFTam7023857@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Fri Sep 14 15:29:35 2018 New Revision: 338683 URL: https://svnweb.freebsd.org/changeset/base/338683 Log: amd64: implement pagezero_erms Intel docs claim such a memset (rep stosb + 4096 bytes) is special-cased by microarchs. They also switched Linux to use it for this purpose. Approved by: re (gjb) Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/support.S Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Fri Sep 14 15:15:16 2018 (r338682) +++ head/sys/amd64/amd64/machdep.c Fri Sep 14 15:29:35 2018 (r338683) @@ -2693,3 +2693,12 @@ DEFINE_IFUNC(, void *, memcpy, (void * _Nonnull, const return ((cpu_stdext_feature & CPUID_STDEXT_ERMS) != 0 ? memcpy_erms : memcpy_std); } + +void pagezero_std(void *addr); +void pagezero_erms(void *addr); +DEFINE_IFUNC(, void , pagezero, (void *), static) +{ + + return ((cpu_stdext_feature & CPUID_STDEXT_ERMS) != 0 ? + pagezero_erms : pagezero_std); +} Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Fri Sep 14 15:15:16 2018 (r338682) +++ head/sys/amd64/amd64/support.S Fri Sep 14 15:29:35 2018 (r338683) @@ -41,7 +41,7 @@ .text /* Address: %rdi */ -ENTRY(pagezero) +ENTRY(pagezero_std) PUSH_FRAME_POINTER movq $PAGE_SIZE/8,%rcx xorl %eax,%eax @@ -49,7 +49,17 @@ ENTRY(pagezero) stosq POP_FRAME_POINTER ret -END(pagezero) +END(pagezero_std) + +ENTRY(pagezero_erms) + PUSH_FRAME_POINTER + movq $PAGE_SIZE,%rcx + xorl %eax,%eax + rep + stosb + POP_FRAME_POINTER + ret +END(pagezero_erms) /* * pagecopy(%rdi=from, %rsi=to)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201809141529.w8EFTam7023857>