Page MenuHomeFreeBSD

STACKALIGN: Reimplement in terms of __align_down
ClosedPublic

Authored by jhb on Tue, Jan 27, 10:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Feb 12, 3:13 AM
Unknown Object (File)
Mon, Feb 9, 10:44 AM
Unknown Object (File)
Sat, Jan 31, 2:30 AM
Unknown Object (File)
Thu, Jan 29, 5:14 AM
Unknown Object (File)
Wed, Jan 28, 10:17 AM
Unknown Object (File)
Wed, Jan 28, 9:01 AM
Unknown Object (File)
Wed, Jan 28, 3:19 AM
Unknown Object (File)
Wed, Jan 28, 2:50 AM

Details

Summary

This changes STACKALIGN to be type-preserving when operating on
pointers.

Diff Detail

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

Event Timeline

jhb requested review of this revision.Tue, Jan 27, 10:29 PM
sys/arm/include/param.h
49–50

Why STACKALIGN needs to be MD then? It is enough to have STACKALIGNBYTES defined in machine/param.h.
And please add a comment that it is type-preserving.

Effort: CHERI upstreaming or whatever it is seems like it would apply?

brooks added inline comments.
sys/arm/include/param.h
49–50

It's only defined on arm/riscv.

STACKALIGNBYTES should surely be STACKALIGN_MASK or the like, but that's a different change.

This revision is now accepted and ready to land.Wed, Jan 28, 10:12 AM
sys/arm/include/param.h
49–50

It's only defined on arm/riscv.

Yes, this is why I said that it is enough to have STACKALIGNBYTES in machine/param.h.
sys/param.h could then do

#ifdef STACKALIGNBYTES
#define STACKALIGN ...
#endif

and it would be immediately have uses at least on amd64 where we align stack after the signal frame.
Might be for i386 too, but I do not remember.

sys/arm/include/param.h
49–50

I would be happy to move it. I do think it would be nicer on other arches as well. I do wish the STACKALIGNBYTES wasn't the biased value. I'm not sure if we expose this to userland though. :( Let me see if it's feasible to change that to the unbiased value.

Centralize STACKALIGN and pass tinderbox

This revision now requires review to proceed.Thu, Feb 5, 6:38 PM

There are opportunities with amd64 at least, but I can do it myself after this patch lands. Thanks.

This revision is now accepted and ready to land.Thu, Feb 5, 6:42 PM
This revision was automatically updated to reflect the committed changes.