Bug 236920 - Bad asm constraints in arm64 byte swap functions
Summary: Bad asm constraints in arm64 byte swap functions
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: CURRENT
Hardware: arm64 Any
: --- Affects Only Me
Assignee: Mitchell Horne
Keywords: patch
Depends on:
Reported: 2019-04-01 00:04 UTC by John F. Carr
Modified: 2021-01-12 22:41 UTC (History)
3 users (show)

See Also:

Fix inline assembly (882 bytes, patch)
2019-04-01 00:04 UTC, John F. Carr
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John F. Carr 2019-04-01 00:04:10 UTC
Created attachment 203277 [details]
Fix inline assembly

The bswap inline functions in sys/arm64/include/endian.h look wrong.

The ARM byte swap instructions are ordinary RISC register to register instructions and should have "=r" as the constraint on the output operand and "r" as the constraint on the input operand.

A message to the freebsd-arm list mentioned an error message "invalid operand in inline asm" associated with one of the inline assembly statements in endian.h.  This could have been caused by the strange constraints on the inline assembly.

I've tested that buildworld works with the attached patch.  I have only run a couple network utilities as a smoke test.
Comment 1 John F. Carr 2019-04-04 12:37:47 UTC
The chromium port problem mentioned on the mailing list turns out to be unrelated.  The port was compiling for ARM v7 which doesn't have rev instructions.  I still think the constraints are wrong.