Page MenuHomeFreeBSD

amd64: relax constraints in curthead and curpcb
ClosedPublic

Authored by mjg on Oct 18 2018, 10:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 22 2024, 11:40 PM
Unknown Object (File)
Dec 20 2023, 3:06 AM
Unknown Object (File)
Dec 7 2023, 1:11 AM
Unknown Object (File)
Sep 23 2023, 6:06 AM
Unknown Object (File)
Sep 18 2023, 9:14 AM
Unknown Object (File)
Aug 18 2023, 10:53 AM
Unknown Object (File)
Jun 26 2023, 9:39 PM
Unknown Object (File)
Jun 26 2023, 9:39 PM
Subscribers

Details

Summary

This makes the compiler less likely to reload the content from %gs.

The 'P' modifier drops all synteax prefixes and 'n' constraint treats input as a known at compilation time immediate integer.

Example reloading victim was spinlock_enter.

Stolen from: OpenBSD
Reported by: jtl

Test Plan

booted

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Wnere is the 'P' constraint documented ? I see that in gcc 8 manual, 'P' is listed and machine-specific constraint, but x86 section does not mention it.

In D17615#376015, @kib wrote:

Wnere is the 'P' constraint documented ? I see that in gcc 8 manual, 'P' is listed and machine-specific constraint, but x86 section does not mention it.

Ok, 'P' is not a constraint, it is the operand modifier, 'n' is the constraint. I still cannot find the explanation for 'P' in the gcc documentation.

In D17615#376018, @mjg wrote:

Got it, the 'P' modifier is not documented in gcc 8 doc, it only appeared in the 9.0-pre. So the question is, what is the min version of both gcc and clang which support the modifier ?

A test prog worked on gcc version 5.5.0 (FreeBSD Ports Collection) and clang version 3.5.2 (tags/RELEASE_352/final), I don't think going any lower makes sense.

fwiw, looks like the macros are only used for an assertion elsewhere. Basically we can just do put the offsets directly into the string if needed and only loosen the compile time assertion.

I found some of this "documented" in clang by grepping the source code and running into TargetInfo::validateInputConstraint.

This revision is now accepted and ready to land.Oct 18 2018, 11:48 PM
This revision was automatically updated to reflect the committed changes.