mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
This is a subset of the Rust `zerocopy` crate, version v0.8.50 (released
2026-05-31), licensed under "BSD-2-Clause OR Apache-2.0 OR MIT", from:
https://github.com/google/zerocopy/tree/v0.8.50
The files are copied as-is, with no modifications whatsoever (not even
adding the SPDX identifiers).
The `benches` folder is added (i.e. not just `src` like in other cases)
since the files there are included in the rendered documentation,
as well as the `rustdoc` CSS style file that is needed to make those
visually more understandable.
For copyright details, please see:
https://github.com/google/zerocopy/blob/v0.8.50/README.md?plain=1
https://github.com/google/zerocopy/blob/v0.8.50/LICENSE-BSD
https://github.com/google/zerocopy/blob/v0.8.50/LICENSE-APACHE
https://github.com/google/zerocopy/blob/v0.8.50/LICENSE-MIT
The next two patches modify these files as needed for use within the
kernel. This patch split allows reviewers to double-check the import
and to clearly see the differences introduced.
The following script may be used to verify the contents:
for path in $(cd rust/zerocopy/ && find . -type f); do
curl --silent --show-error --location \
https://github.com/google/zerocopy/raw/v0.8.50/$path \
| diff --unified rust/zerocopy/$path - && echo $path: OK
done
Cc: Joshua Liebow-Feeser <joshlf@google.com>
Cc: Jack Wrenn <jswrenn@google.com>
Link: https://patch.msgid.link/20260608141439.182634-9-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
61 lines
1013 B
Plaintext
61 lines
1013 B
Plaintext
bench_extend_vec_zeroed:
|
|
push r15
|
|
push r14
|
|
push r13
|
|
push r12
|
|
push rbx
|
|
sub rsp, 32
|
|
mov rbx, rdi
|
|
mov rax, qword ptr [rdi]
|
|
mov r12, qword ptr [rdi + 16]
|
|
mov rcx, rax
|
|
sub rcx, r12
|
|
cmp rsi, rcx
|
|
jbe .LBB6_3
|
|
mov r15, r12
|
|
add r15, rsi
|
|
jae .LBB6_6
|
|
.LBB6_2:
|
|
xor eax, eax
|
|
jmp .LBB6_5
|
|
.LBB6_3:
|
|
mov rax, qword ptr [rbx + 8]
|
|
lea r15, [r12 + rsi]
|
|
.LBB6_4:
|
|
lea rcx, [r12 + 2*r12]
|
|
lea rdi, [rax + 2*rcx]
|
|
add rsi, rsi
|
|
lea rdx, [rsi + 2*rsi]
|
|
xor esi, esi
|
|
call qword ptr [rip + memset@GOTPCREL]
|
|
mov qword ptr [rbx + 16], r15
|
|
mov al, 1
|
|
.LBB6_5:
|
|
add rsp, 32
|
|
pop rbx
|
|
pop r12
|
|
pop r13
|
|
pop r14
|
|
pop r15
|
|
ret
|
|
.LBB6_6:
|
|
mov r13, rsi
|
|
lea rcx, [rax + rax]
|
|
cmp r15, rcx
|
|
cmova rcx, r15
|
|
cmp rcx, 5
|
|
mov r14d, 4
|
|
cmovae r14, rcx
|
|
mov rdx, qword ptr [rbx + 8]
|
|
lea rdi, [rsp + 8]
|
|
mov rsi, rax
|
|
mov rcx, r14
|
|
call <alloc::raw_vec::RawVecInner>::finish_grow
|
|
cmp dword ptr [rsp + 8], 1
|
|
je .LBB6_2
|
|
mov rax, qword ptr [rsp + 16]
|
|
mov qword ptr [rbx + 8], rax
|
|
mov qword ptr [rbx], r14
|
|
mov rsi, r13
|
|
jmp .LBB6_4
|