Page MenuHomeFreeBSD

tls: Introduce struct dtv and struct dtv_slot
ClosedPublic

Authored by jrtc27 on May 7 2025, 3:00 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jul 7, 1:26 PM
Unknown Object (File)
Sun, Jul 6, 8:13 AM
Unknown Object (File)
Sun, Jul 6, 3:45 AM
Unknown Object (File)
Sat, Jul 5, 4:12 PM
Unknown Object (File)
Sat, Jul 5, 6:04 AM
Unknown Object (File)
Fri, Jul 4, 8:42 PM
Unknown Object (File)
Mon, Jun 23, 2:27 AM
Unknown Object (File)
Sat, Jun 21, 8:03 AM
Subscribers

Details

Summary

Rather than treating the DTV as a raw array of uintptr_t, use proper
struct types and gain the benefit of having different types for
different members. In particular, the module slots now have real pointer
types so less casting is generally needed.

Note that, whilst struct dtv_slot may seem a little unnecessary, this
will help downstream in CheriBSD where we wish to be able to easily
alter the layout of a module's slot, which this helps abstract.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jrtc27 requested review of this revision.May 7 2025, 3:00 AM
sys/sys/_tls_variant_i.h
48

Can we move struct dtv into e.g. sys/sys/tls_common.h?

sys/sys/_tls_variant_i.h
48

Hm, as in leave struct dtv_slot in the individual headers and move just struct dtv? I think given everything else is variant-dependent I'd like to afford the flexibility for it to vary in layout, and it's possible I will want to do so for the new CHERI TLS variant (I have not yet bottomed out the implementation to know for sure, I stopped after doing libc (where the DTV implementation is a lot simpler) due to being fed up with all the raw arrays and magic numbers I needed change :)).

kib added inline comments.
sys/sys/_tls_variant_i.h
48

I mean dtv and all needed for it, i.e. dtv_slot. But this is a minor point, I definitely do not insist.

I also find it unnatural that there is no _tls_variant_ii.h but I understand why.

This revision is now accepted and ready to land.May 7 2025, 5:32 PM
sys/sys/_tls_variant_i.h
48

We can bring back SPARC, or add S/390, if you want to justify adding a _tls_variant_ii.h (:

This revision was automatically updated to reflect the committed changes.