Skip to content

feat: add 32-bit assembly checksum backends (ARM, x86, RV32, MIPS32, PowerPC)#27

Merged
meigoc merged 2 commits into
NurOS-Linux:mainfrom
meigoc:feat/arch32-asm
Jul 18, 2026
Merged

feat: add 32-bit assembly checksum backends (ARM, x86, RV32, MIPS32, PowerPC)#27
meigoc merged 2 commits into
NurOS-Linux:mainfrom
meigoc:feat/arch32-asm

Conversation

@meigoc

@meigoc meigoc commented Jul 18, 2026

Copy link
Copy Markdown
Member

Adds optimized scalar assembly implementations of the checksum backend
(CRC-32, MD5, SHA-256) for five 32-bit architectures, extending the existing
64-bit backends (x86-64, aarch64, riscv64, mips64) to 32-bit targets:

  • arch/arm/ — ARM (AArch32 / ARMv7)
  • arch/x86/ — x86 (i386 / IA-32)
  • arch/riscv32/ — RISC-V (RV32)
  • arch/mips/ — MIPS32 (MIPS32r2)
  • arch/powerpc/ — PowerPC (32-bit)

Each backend implements the ABI the C drivers already dispatch to
(apg_<algo>_hw_supported / apg_<algo>_transform_hw / apg_crc32_update_hw)
and is selected at build time in meson.build via host_machine.cpu_family().
Message words are assembled byte-wise (endian-independent) and symbol addressing
is position-independent, so the backends link cleanly into the shared library.

Type of Change

  • New feature

Related Issues

Checklist

  • Code compiles without errors
  • Tests pass locally
  • Code follows project style guidelines
  • Documentation updated (if needed)
  • Commit messages follow conventional commits format

Testing

For every target the library's own C checksum drivers were built against the new
assembly and the full CRC-32, MD5 and SHA-256 were computed over test vectors
(empty input, sub-block, exact block, multi-block, odd tails, all-byte-value
data), with digests compared byte-for-byte against independent reference values.
Verified under QEMU user-mode on arm, i386, riscv32, mipsel, big-endian
mips, and powerpc (big-endian MIPS and PowerPC confirm endian independence).

PIC-safety was checked by assembling each backend with -fPIC and linking a
shared object with -Wl,-z,text. Native x86_64 build and the existing test
suite continue to pass unchanged.

New cross-*.txt files and CI coverage were added: an arch-asm job that
assembles and PIC-links every 32-bit backend, plus a full armhf cross job.

Additional Notes

Base integer instructions only (no crypto extensions), matching the existing
mips64 backend; -march is raised only where encodings require it (armv7-a
for movw/movt, mips32r2 for rotr).

…PowerPC)

Scalar CRC-32/MD5/SHA-256 assembly for arm, x86 (i386), riscv32, mips and
powerpc, selected via host_machine.cpu_family(). Endian-independent (byte-wise
message loading; verified on big-endian MIPS and PowerPC) and
position-independent so they link into the shared library. Adds cross files
and an arch-asm + armhf CI job.

Closes NurOS-Linux#21
Closes NurOS-Linux#22
Closes NurOS-Linux#23
Closes NurOS-Linux#24
Closes NurOS-Linux#25
@meigoc
meigoc requested a review from AnmiTaliDev July 18, 2026 01:01
@meigoc meigoc self-assigned this Jul 18, 2026
@meigoc meigoc added the enhancement New feature or request label Jul 18, 2026
@meigoc
meigoc merged commit ae0400f into NurOS-Linux:main Jul 18, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant