Page MenuHomeFreeBSD

libc/amd64: fix stpncpy.S again
Needs ReviewPublic

Authored by fuz on Thu, Dec 18, 11:42 PM.
Tags
None
Referenced Files
F140029983: D54303.id.diff
Fri, Dec 19, 6:57 AM
F140029913: D54303.id.diff
Fri, Dec 19, 6:56 AM
F140028491: D54303.id168382.diff
Fri, Dec 19, 6:25 AM
F140026905: D54303.diff
Fri, Dec 19, 5:52 AM
F140009849: D54303.id168382.diff
Thu, Dec 18, 11:51 PM
Subscribers

Details

Reviewers
cy
des
markj
getz
Summary

The previous fix introduced a regression on machines without the BMI1
instruction set extension. The TZCNT instruction used in this function
behaves different on old machines when the source operand is zero, but
the code was originally designed to never trigger this case. The bug
fix caused this case to be possible, leading to a regression on
sufficiently old hardware.

Fix the code by messing with things such that the source operand is
never zero.

PR: 291720
Fixes: 66eb78377bf109af1d9e25626bf254b4369436ec

Test Plan

passes unit test. The behaviour on older machines was
manually checked by replacing TZCNT with BSF in the affected code
path. Please check again before I land this.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 69391
Build 66274: arc lint + arc unit