Bug 236920

Summary: Bad asm constraints in arm64 byte swap functions
Product: Base System Reporter: John F. Carr <jfc>
Component: armAssignee: Mitchell Horne <mhorne>
Status: In Progress ---    
Severity: Affects Only Me CC: Andrew, emaste, mhorne
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: arm64   
OS: Any   
Attachments:
Description Flags
Fix inline assembly none

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.