License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* MMX 3DNow! library helper functions
|
|
|
|
*
|
|
|
|
* To do:
|
2008-02-18 15:53:56 +08:00
|
|
|
* We can use MMX just for prefetch in IRQ's. This may be a win.
|
2005-04-17 06:20:36 +08:00
|
|
|
* (reported so on K6-III)
|
|
|
|
* We should use a better code neutral filler for the short jump
|
|
|
|
* leal ebx. [ebx] is apparently best for K6-2, but Cyrix ??
|
|
|
|
* We also want to clobber the filler register so we don't get any
|
2008-02-18 15:53:56 +08:00
|
|
|
* register forwarding stalls on the filler.
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
* Add *user handling. Checksums are not a win with MMX on any CPU
|
|
|
|
* tested so far for any MMX solution figured.
|
|
|
|
*
|
2008-02-18 15:53:56 +08:00
|
|
|
* 22/09/2000 - Arjan van de Ven
|
|
|
|
* Improved for non-egineering-sample Athlons
|
2005-04-17 06:20:36 +08:00
|
|
|
*
|
|
|
|
*/
|
2008-02-18 15:53:56 +08:00
|
|
|
#include <linux/hardirq.h>
|
|
|
|
#include <linux/string.h>
|
2016-07-14 08:18:57 +08:00
|
|
|
#include <linux/export.h>
|
2008-02-18 15:53:56 +08:00
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
2015-04-24 08:46:00 +08:00
|
|
|
#include <asm/fpu/api.h>
|
2008-02-18 15:53:56 +08:00
|
|
|
#include <asm/asm.h>
|
|
|
|
|
2024-06-11 20:26:44 +08:00
|
|
|
/*
|
|
|
|
* Use KFPU_387. MMX instructions are not affected by MXCSR,
|
|
|
|
* but both AMD and Intel documentation states that even integer MMX
|
|
|
|
* operations will result in #MF if an exception is pending in FCW.
|
|
|
|
*
|
|
|
|
* EMMS is not needed afterwards because, after calling kernel_fpu_end(),
|
|
|
|
* any subsequent user of the 387 stack will reinitialize it using
|
|
|
|
* KFPU_387.
|
|
|
|
*/
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
void *_mmx_memcpy(void *to, const void *from, size_t len)
|
|
|
|
{
|
|
|
|
void *p;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (unlikely(in_interrupt()))
|
|
|
|
return __memcpy(to, from, len);
|
|
|
|
|
|
|
|
p = to;
|
|
|
|
i = len >> 6; /* len/64 */
|
|
|
|
|
2024-06-11 20:26:44 +08:00
|
|
|
kernel_fpu_begin_mask(KFPU_387);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
__asm__ __volatile__ (
|
|
|
|
"1: prefetch (%0)\n" /* This set is 28 bytes */
|
|
|
|
" prefetch 64(%0)\n"
|
|
|
|
" prefetch 128(%0)\n"
|
|
|
|
" prefetch 192(%0)\n"
|
|
|
|
" prefetch 256(%0)\n"
|
|
|
|
"2: \n"
|
|
|
|
".section .fixup, \"ax\"\n"
|
|
|
|
"3: movw $0x1AEB, 1b\n" /* jmp on 26 bytes */
|
|
|
|
" jmp 2b\n"
|
|
|
|
".previous\n"
|
2008-02-18 15:53:56 +08:00
|
|
|
_ASM_EXTABLE(1b, 3b)
|
|
|
|
: : "r" (from));
|
|
|
|
|
|
|
|
for ( ; i > 5; i--) {
|
2005-04-17 06:20:36 +08:00
|
|
|
__asm__ __volatile__ (
|
|
|
|
"1: prefetch 320(%0)\n"
|
|
|
|
"2: movq (%0), %%mm0\n"
|
|
|
|
" movq 8(%0), %%mm1\n"
|
|
|
|
" movq 16(%0), %%mm2\n"
|
|
|
|
" movq 24(%0), %%mm3\n"
|
|
|
|
" movq %%mm0, (%1)\n"
|
|
|
|
" movq %%mm1, 8(%1)\n"
|
|
|
|
" movq %%mm2, 16(%1)\n"
|
|
|
|
" movq %%mm3, 24(%1)\n"
|
|
|
|
" movq 32(%0), %%mm0\n"
|
|
|
|
" movq 40(%0), %%mm1\n"
|
|
|
|
" movq 48(%0), %%mm2\n"
|
|
|
|
" movq 56(%0), %%mm3\n"
|
|
|
|
" movq %%mm0, 32(%1)\n"
|
|
|
|
" movq %%mm1, 40(%1)\n"
|
|
|
|
" movq %%mm2, 48(%1)\n"
|
|
|
|
" movq %%mm3, 56(%1)\n"
|
|
|
|
".section .fixup, \"ax\"\n"
|
|
|
|
"3: movw $0x05EB, 1b\n" /* jmp on 5 bytes */
|
|
|
|
" jmp 2b\n"
|
|
|
|
".previous\n"
|
2008-02-18 15:53:56 +08:00
|
|
|
_ASM_EXTABLE(1b, 3b)
|
|
|
|
: : "r" (from), "r" (to) : "memory");
|
|
|
|
|
|
|
|
from += 64;
|
|
|
|
to += 64;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2008-02-18 15:53:56 +08:00
|
|
|
for ( ; i > 0; i--) {
|
2005-04-17 06:20:36 +08:00
|
|
|
__asm__ __volatile__ (
|
|
|
|
" movq (%0), %%mm0\n"
|
|
|
|
" movq 8(%0), %%mm1\n"
|
|
|
|
" movq 16(%0), %%mm2\n"
|
|
|
|
" movq 24(%0), %%mm3\n"
|
|
|
|
" movq %%mm0, (%1)\n"
|
|
|
|
" movq %%mm1, 8(%1)\n"
|
|
|
|
" movq %%mm2, 16(%1)\n"
|
|
|
|
" movq %%mm3, 24(%1)\n"
|
|
|
|
" movq 32(%0), %%mm0\n"
|
|
|
|
" movq 40(%0), %%mm1\n"
|
|
|
|
" movq 48(%0), %%mm2\n"
|
|
|
|
" movq 56(%0), %%mm3\n"
|
|
|
|
" movq %%mm0, 32(%1)\n"
|
|
|
|
" movq %%mm1, 40(%1)\n"
|
|
|
|
" movq %%mm2, 48(%1)\n"
|
|
|
|
" movq %%mm3, 56(%1)\n"
|
2008-02-18 15:53:56 +08:00
|
|
|
: : "r" (from), "r" (to) : "memory");
|
|
|
|
|
|
|
|
from += 64;
|
|
|
|
to += 64;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
/*
|
2008-02-18 15:53:56 +08:00
|
|
|
* Now do the tail of the block:
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2008-02-18 15:53:56 +08:00
|
|
|
__memcpy(to, from, len & 63);
|
2005-04-17 06:20:36 +08:00
|
|
|
kernel_fpu_end();
|
2008-02-18 15:53:56 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
return p;
|
|
|
|
}
|
2008-02-18 15:53:56 +08:00
|
|
|
EXPORT_SYMBOL(_mmx_memcpy);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_MK7
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The K7 has streaming cache bypass load/store. The Cyrix III, K6 and
|
|
|
|
* other MMX using processors do not.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void fast_clear_page(void *page)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2024-06-11 20:26:44 +08:00
|
|
|
kernel_fpu_begin_mask(KFPU_387);
|
2008-02-18 15:53:56 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
__asm__ __volatile__ (
|
|
|
|
" pxor %%mm0, %%mm0\n" : :
|
|
|
|
);
|
|
|
|
|
2008-02-18 15:53:56 +08:00
|
|
|
for (i = 0; i < 4096/64; i++) {
|
2005-04-17 06:20:36 +08:00
|
|
|
__asm__ __volatile__ (
|
|
|
|
" movntq %%mm0, (%0)\n"
|
|
|
|
" movntq %%mm0, 8(%0)\n"
|
|
|
|
" movntq %%mm0, 16(%0)\n"
|
|
|
|
" movntq %%mm0, 24(%0)\n"
|
|
|
|
" movntq %%mm0, 32(%0)\n"
|
|
|
|
" movntq %%mm0, 40(%0)\n"
|
|
|
|
" movntq %%mm0, 48(%0)\n"
|
|
|
|
" movntq %%mm0, 56(%0)\n"
|
|
|
|
: : "r" (page) : "memory");
|
2008-02-18 15:53:56 +08:00
|
|
|
page += 64;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2008-02-18 15:53:56 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Since movntq is weakly-ordered, a "sfence" is needed to become
|
|
|
|
* ordered again:
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2008-02-18 15:53:56 +08:00
|
|
|
__asm__ __volatile__("sfence\n"::);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
kernel_fpu_end();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void fast_copy_page(void *to, void *from)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2024-06-11 20:26:44 +08:00
|
|
|
kernel_fpu_begin_mask(KFPU_387);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-02-18 15:53:56 +08:00
|
|
|
/*
|
|
|
|
* maybe the prefetch stuff can go before the expensive fnsave...
|
2005-04-17 06:20:36 +08:00
|
|
|
* but that is for later. -AV
|
|
|
|
*/
|
2008-02-18 15:53:56 +08:00
|
|
|
__asm__ __volatile__(
|
2005-04-17 06:20:36 +08:00
|
|
|
"1: prefetch (%0)\n"
|
|
|
|
" prefetch 64(%0)\n"
|
|
|
|
" prefetch 128(%0)\n"
|
|
|
|
" prefetch 192(%0)\n"
|
|
|
|
" prefetch 256(%0)\n"
|
|
|
|
"2: \n"
|
|
|
|
".section .fixup, \"ax\"\n"
|
|
|
|
"3: movw $0x1AEB, 1b\n" /* jmp on 26 bytes */
|
|
|
|
" jmp 2b\n"
|
|
|
|
".previous\n"
|
2008-02-18 15:53:56 +08:00
|
|
|
_ASM_EXTABLE(1b, 3b) : : "r" (from));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-02-18 15:53:56 +08:00
|
|
|
for (i = 0; i < (4096-320)/64; i++) {
|
2005-04-17 06:20:36 +08:00
|
|
|
__asm__ __volatile__ (
|
|
|
|
"1: prefetch 320(%0)\n"
|
|
|
|
"2: movq (%0), %%mm0\n"
|
|
|
|
" movntq %%mm0, (%1)\n"
|
|
|
|
" movq 8(%0), %%mm1\n"
|
|
|
|
" movntq %%mm1, 8(%1)\n"
|
|
|
|
" movq 16(%0), %%mm2\n"
|
|
|
|
" movntq %%mm2, 16(%1)\n"
|
|
|
|
" movq 24(%0), %%mm3\n"
|
|
|
|
" movntq %%mm3, 24(%1)\n"
|
|
|
|
" movq 32(%0), %%mm4\n"
|
|
|
|
" movntq %%mm4, 32(%1)\n"
|
|
|
|
" movq 40(%0), %%mm5\n"
|
|
|
|
" movntq %%mm5, 40(%1)\n"
|
|
|
|
" movq 48(%0), %%mm6\n"
|
|
|
|
" movntq %%mm6, 48(%1)\n"
|
|
|
|
" movq 56(%0), %%mm7\n"
|
|
|
|
" movntq %%mm7, 56(%1)\n"
|
|
|
|
".section .fixup, \"ax\"\n"
|
|
|
|
"3: movw $0x05EB, 1b\n" /* jmp on 5 bytes */
|
|
|
|
" jmp 2b\n"
|
|
|
|
".previous\n"
|
2008-02-18 15:53:56 +08:00
|
|
|
_ASM_EXTABLE(1b, 3b) : : "r" (from), "r" (to) : "memory");
|
|
|
|
|
|
|
|
from += 64;
|
|
|
|
to += 64;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2008-02-18 15:53:56 +08:00
|
|
|
|
|
|
|
for (i = (4096-320)/64; i < 4096/64; i++) {
|
2005-04-17 06:20:36 +08:00
|
|
|
__asm__ __volatile__ (
|
|
|
|
"2: movq (%0), %%mm0\n"
|
|
|
|
" movntq %%mm0, (%1)\n"
|
|
|
|
" movq 8(%0), %%mm1\n"
|
|
|
|
" movntq %%mm1, 8(%1)\n"
|
|
|
|
" movq 16(%0), %%mm2\n"
|
|
|
|
" movntq %%mm2, 16(%1)\n"
|
|
|
|
" movq 24(%0), %%mm3\n"
|
|
|
|
" movntq %%mm3, 24(%1)\n"
|
|
|
|
" movq 32(%0), %%mm4\n"
|
|
|
|
" movntq %%mm4, 32(%1)\n"
|
|
|
|
" movq 40(%0), %%mm5\n"
|
|
|
|
" movntq %%mm5, 40(%1)\n"
|
|
|
|
" movq 48(%0), %%mm6\n"
|
|
|
|
" movntq %%mm6, 48(%1)\n"
|
|
|
|
" movq 56(%0), %%mm7\n"
|
|
|
|
" movntq %%mm7, 56(%1)\n"
|
2008-02-18 15:53:56 +08:00
|
|
|
: : "r" (from), "r" (to) : "memory");
|
|
|
|
from += 64;
|
|
|
|
to += 64;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2008-02-18 15:53:56 +08:00
|
|
|
/*
|
|
|
|
* Since movntq is weakly-ordered, a "sfence" is needed to become
|
|
|
|
* ordered again:
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2008-02-18 15:53:56 +08:00
|
|
|
__asm__ __volatile__("sfence \n"::);
|
2005-04-17 06:20:36 +08:00
|
|
|
kernel_fpu_end();
|
|
|
|
}
|
|
|
|
|
2008-02-18 15:53:56 +08:00
|
|
|
#else /* CONFIG_MK7 */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Generic MMX implementation without K7 specific streaming
|
|
|
|
*/
|
|
|
|
static void fast_clear_page(void *page)
|
|
|
|
{
|
|
|
|
int i;
|
2008-02-18 15:53:56 +08:00
|
|
|
|
2024-06-11 20:26:44 +08:00
|
|
|
kernel_fpu_begin_mask(KFPU_387);
|
2008-02-18 15:53:56 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
__asm__ __volatile__ (
|
|
|
|
" pxor %%mm0, %%mm0\n" : :
|
|
|
|
);
|
|
|
|
|
2008-02-18 15:53:56 +08:00
|
|
|
for (i = 0; i < 4096/128; i++) {
|
2005-04-17 06:20:36 +08:00
|
|
|
__asm__ __volatile__ (
|
|
|
|
" movq %%mm0, (%0)\n"
|
|
|
|
" movq %%mm0, 8(%0)\n"
|
|
|
|
" movq %%mm0, 16(%0)\n"
|
|
|
|
" movq %%mm0, 24(%0)\n"
|
|
|
|
" movq %%mm0, 32(%0)\n"
|
|
|
|
" movq %%mm0, 40(%0)\n"
|
|
|
|
" movq %%mm0, 48(%0)\n"
|
|
|
|
" movq %%mm0, 56(%0)\n"
|
|
|
|
" movq %%mm0, 64(%0)\n"
|
|
|
|
" movq %%mm0, 72(%0)\n"
|
|
|
|
" movq %%mm0, 80(%0)\n"
|
|
|
|
" movq %%mm0, 88(%0)\n"
|
|
|
|
" movq %%mm0, 96(%0)\n"
|
|
|
|
" movq %%mm0, 104(%0)\n"
|
|
|
|
" movq %%mm0, 112(%0)\n"
|
|
|
|
" movq %%mm0, 120(%0)\n"
|
2008-02-18 15:53:56 +08:00
|
|
|
: : "r" (page) : "memory");
|
|
|
|
page += 128;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
kernel_fpu_end();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void fast_copy_page(void *to, void *from)
|
|
|
|
{
|
|
|
|
int i;
|
2008-02-18 15:53:56 +08:00
|
|
|
|
2024-06-11 20:26:44 +08:00
|
|
|
kernel_fpu_begin_mask(KFPU_387);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
__asm__ __volatile__ (
|
|
|
|
"1: prefetch (%0)\n"
|
|
|
|
" prefetch 64(%0)\n"
|
|
|
|
" prefetch 128(%0)\n"
|
|
|
|
" prefetch 192(%0)\n"
|
|
|
|
" prefetch 256(%0)\n"
|
|
|
|
"2: \n"
|
|
|
|
".section .fixup, \"ax\"\n"
|
|
|
|
"3: movw $0x1AEB, 1b\n" /* jmp on 26 bytes */
|
|
|
|
" jmp 2b\n"
|
|
|
|
".previous\n"
|
2008-02-18 15:53:56 +08:00
|
|
|
_ASM_EXTABLE(1b, 3b) : : "r" (from));
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-02-18 15:53:56 +08:00
|
|
|
for (i = 0; i < 4096/64; i++) {
|
2005-04-17 06:20:36 +08:00
|
|
|
__asm__ __volatile__ (
|
|
|
|
"1: prefetch 320(%0)\n"
|
|
|
|
"2: movq (%0), %%mm0\n"
|
|
|
|
" movq 8(%0), %%mm1\n"
|
|
|
|
" movq 16(%0), %%mm2\n"
|
|
|
|
" movq 24(%0), %%mm3\n"
|
|
|
|
" movq %%mm0, (%1)\n"
|
|
|
|
" movq %%mm1, 8(%1)\n"
|
|
|
|
" movq %%mm2, 16(%1)\n"
|
|
|
|
" movq %%mm3, 24(%1)\n"
|
|
|
|
" movq 32(%0), %%mm0\n"
|
|
|
|
" movq 40(%0), %%mm1\n"
|
|
|
|
" movq 48(%0), %%mm2\n"
|
|
|
|
" movq 56(%0), %%mm3\n"
|
|
|
|
" movq %%mm0, 32(%1)\n"
|
|
|
|
" movq %%mm1, 40(%1)\n"
|
|
|
|
" movq %%mm2, 48(%1)\n"
|
|
|
|
" movq %%mm3, 56(%1)\n"
|
|
|
|
".section .fixup, \"ax\"\n"
|
|
|
|
"3: movw $0x05EB, 1b\n" /* jmp on 5 bytes */
|
|
|
|
" jmp 2b\n"
|
|
|
|
".previous\n"
|
2008-02-18 15:53:56 +08:00
|
|
|
_ASM_EXTABLE(1b, 3b)
|
|
|
|
: : "r" (from), "r" (to) : "memory");
|
|
|
|
|
|
|
|
from += 64;
|
|
|
|
to += 64;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
kernel_fpu_end();
|
|
|
|
}
|
|
|
|
|
2008-02-18 15:53:56 +08:00
|
|
|
#endif /* !CONFIG_MK7 */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
/*
|
2008-02-18 15:53:56 +08:00
|
|
|
* Favour MMX for page clear and copy:
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
2008-02-18 15:53:56 +08:00
|
|
|
static void slow_zero_page(void *page)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
int d0, d1;
|
2008-02-18 15:53:56 +08:00
|
|
|
|
|
|
|
__asm__ __volatile__(
|
|
|
|
"cld\n\t"
|
|
|
|
"rep ; stosl"
|
|
|
|
|
|
|
|
: "=&c" (d0), "=&D" (d1)
|
|
|
|
:"a" (0), "1" (page), "0" (1024)
|
|
|
|
:"memory");
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2008-02-18 15:53:56 +08:00
|
|
|
|
|
|
|
void mmx_clear_page(void *page)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2008-02-18 15:53:56 +08:00
|
|
|
if (unlikely(in_interrupt()))
|
2005-04-17 06:20:36 +08:00
|
|
|
slow_zero_page(page);
|
|
|
|
else
|
|
|
|
fast_clear_page(page);
|
|
|
|
}
|
2008-02-18 15:53:56 +08:00
|
|
|
EXPORT_SYMBOL(mmx_clear_page);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
static void slow_copy_page(void *to, void *from)
|
|
|
|
{
|
|
|
|
int d0, d1, d2;
|
2008-02-18 15:53:56 +08:00
|
|
|
|
|
|
|
__asm__ __volatile__(
|
|
|
|
"cld\n\t"
|
|
|
|
"rep ; movsl"
|
|
|
|
: "=&c" (d0), "=&D" (d1), "=&S" (d2)
|
|
|
|
: "0" (1024), "1" ((long) to), "2" ((long) from)
|
2005-04-17 06:20:36 +08:00
|
|
|
: "memory");
|
|
|
|
}
|
|
|
|
|
|
|
|
void mmx_copy_page(void *to, void *from)
|
|
|
|
{
|
2008-02-18 15:53:56 +08:00
|
|
|
if (unlikely(in_interrupt()))
|
2005-04-17 06:20:36 +08:00
|
|
|
slow_copy_page(to, from);
|
|
|
|
else
|
|
|
|
fast_copy_page(to, from);
|
|
|
|
}
|
2005-06-23 15:08:33 +08:00
|
|
|
EXPORT_SYMBOL(mmx_copy_page);
|