lib/raid/xor/x86/xor-mmx.c
Source file repositories/reference/linux-study-clean/lib/raid/xor/x86/xor-mmx.c
File Facts
- System
- Linux kernel
- Corpus path
lib/raid/xor/x86/xor-mmx.c- Extension
.c- Size
- 13851 bytes
- Lines
- 516
- Domain
- Kernel Services
- Bucket
- lib
- Inferred role
- Kernel Services: implementation source
- Status
- source implementation candidate
Why This File Exists
Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
asm/fpu/api.hxor_impl.hxor_arch.h
Detected Declarations
function xor_pII_mmx_2function xor_pII_mmx_3function xor_pII_mmx_4function xor_pII_mmx_5function xor_p5_mmx_2function xor_p5_mmx_3function xor_p5_mmx_4function xor_p5_mmx_5function xor_gen_pII_mmxfunction xor_gen_p5_mmx
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Optimized XOR parity functions for MMX.
*
* Copyright (C) 1998 Ingo Molnar.
*/
#include <asm/fpu/api.h>
#include "xor_impl.h"
#include "xor_arch.h"
#define LD(x, y) " movq 8*("#x")(%1), %%mm"#y" ;\n"
#define ST(x, y) " movq %%mm"#y", 8*("#x")(%1) ;\n"
#define XO1(x, y) " pxor 8*("#x")(%2), %%mm"#y" ;\n"
#define XO2(x, y) " pxor 8*("#x")(%3), %%mm"#y" ;\n"
#define XO3(x, y) " pxor 8*("#x")(%4), %%mm"#y" ;\n"
#define XO4(x, y) " pxor 8*("#x")(%5), %%mm"#y" ;\n"
static void
xor_pII_mmx_2(unsigned long bytes, unsigned long * __restrict p1,
const unsigned long * __restrict p2)
{
unsigned long lines = bytes >> 7;
asm volatile(
#undef BLOCK
#define BLOCK(i) \
LD(i, 0) \
LD(i + 1, 1) \
LD(i + 2, 2) \
LD(i + 3, 3) \
XO1(i, 0) \
ST(i, 0) \
XO1(i+1, 1) \
ST(i+1, 1) \
XO1(i + 2, 2) \
ST(i + 2, 2) \
XO1(i + 3, 3) \
ST(i + 3, 3)
" .align 32 ;\n"
" 1: ;\n"
BLOCK(0)
BLOCK(4)
BLOCK(8)
BLOCK(12)
" addl $128, %1 ;\n"
" addl $128, %2 ;\n"
" decl %0 ;\n"
" jnz 1b ;\n"
: "+r" (lines),
"+r" (p1), "+r" (p2)
:
: "memory");
}
static void
xor_pII_mmx_3(unsigned long bytes, unsigned long * __restrict p1,
const unsigned long * __restrict p2,
const unsigned long * __restrict p3)
{
unsigned long lines = bytes >> 7;
asm volatile(
#undef BLOCK
#define BLOCK(i) \
LD(i, 0) \
LD(i + 1, 1) \
LD(i + 2, 2) \
LD(i + 3, 3) \
XO1(i, 0) \
XO1(i + 1, 1) \
XO1(i + 2, 2) \
XO1(i + 3, 3) \
XO2(i, 0) \
ST(i, 0) \
XO2(i + 1, 1) \
ST(i + 1, 1) \
XO2(i + 2, 2) \
ST(i + 2, 2) \
XO2(i + 3, 3) \
ST(i + 3, 3)
" .align 32 ;\n"
" 1: ;\n"
BLOCK(0)
BLOCK(4)
BLOCK(8)
Annotation
- Immediate include surface: `asm/fpu/api.h`, `xor_impl.h`, `xor_arch.h`.
- Detected declarations: `function xor_pII_mmx_2`, `function xor_pII_mmx_3`, `function xor_pII_mmx_4`, `function xor_pII_mmx_5`, `function xor_p5_mmx_2`, `function xor_p5_mmx_3`, `function xor_p5_mmx_4`, `function xor_p5_mmx_5`, `function xor_gen_pII_mmx`, `function xor_gen_p5_mmx`.
- Atlas domain: Kernel Services / lib.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.