Add a STACK_ALIGN constant rather than hardcoding sizeof(int64_t) when
aligning the stack during thread and process creation as well as when
constructing a signal frame.
Use a value of 16 for STACK_ALIGN on N32 and N64 and a value of 8 for
O32.
Differential D13875
Switch to 16-byte stack alignment on N32 and N64. jhb on Jan 11 2018, 7:52 PM. Authored by Tags None Referenced Files
Subscribers
Details Add a STACK_ALIGN constant rather than hardcoding sizeof(int64_t) when Use a value of 16 for STACK_ALIGN on N32 and N64 and a value of 8 for
Diff Detail
Event TimelineComment Actions Also, lib/libc/mips/gen/makecontext.c uses its own constants, and should likely be pulled out of the conditional, after subtracting enough registers' worth o' room. Comment Actions I'm not quite sure what you would like to do for makecontext. It is already using the right value (16 for newabi), but I don't know if it's really safe to expose STACK_ALIGN to userland (perhaps I can include <machine/md_var.h> to get it in this file?) If the comment is really stale and there is no gap for newabi, then I don't think we can collapse the #ifdef's down any further in makecontext() aside from perhaps using STACK_ALIGN.
Comment Actions I feel like the stack alignment ought to be derived from some shared definition for consistency, and used wherever needed. <machine/asm.h> has lots of similar/related things (which could perhaps be used instead? see ALMASK), but that's for assembly. I don't know if we have a consistent header for use in C (and perhaps also used in assembly.) I feel like a new header along the lines of <machine/abi.h> might be something we want to contain a bunch of things into. I'm fine with this going in as is, but definitely feel like unification and consistency has benefits if we can do it right. Possibly in such a way as sets an example for adding new ABIs to other architectures, which I imagine you have some thoughts and insights into for, say, x32.
Comment Actions I've done some more reading and I think I have a grip on the makecontext() stuff, but it's turned into a bigger ball of wax so I'm going to defer fixes there until later. Comment Actions I did look at ALMASK since we also use CALLFRAME_SIZ in C. I don't like that ALMASK use '-' instead of '~' though. (And in fact, I can't find anything in the tree that uses ALSK or ALMASK currently). -8 and -16 would work though. That bug goes back to when these cosntants were added in NetBSD's asm.h. I feel like I'd rather just add the single STACK_ALIGN perhaps in machine/asm.h and drop the ALSK and ALMASK constants as they are named poorly. Comment Actions I'd concur, and I had already pared down from NetBSD some in what's in that file when fixing various ABIs, IIRC, and I think it's reasonable to remove other things that are wrong or misleading. Comment Actions
|