STACKALIGN: Reimplement in terms of __align_down
This changes STACKALIGN to be type-preserving when operating on pointers. Reviewed by: brooks, kib Effort: CHERI upstreaming Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D54920
This commit is contained in:
@@ -838,7 +838,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
|
||||
/* Make room, keeping the stack aligned */
|
||||
fp = (struct sigframe *)addr;
|
||||
fp--;
|
||||
fp = (struct sigframe *)STACKALIGN(fp);
|
||||
fp = STACKALIGN(fp);
|
||||
|
||||
/* Copy the sigframe out to the user's stack. */
|
||||
if (copyout(&frame, fp, sizeof(*fp)) != 0) {
|
||||
|
||||
@@ -100,7 +100,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
|
||||
|
||||
ptrauth_fork(td2, td1);
|
||||
|
||||
tf = (struct trapframe *)STACKALIGN((struct trapframe *)pcb2 - 1);
|
||||
tf = STACKALIGN((struct trapframe *)pcb2 - 1);
|
||||
bcopy(td1->td_frame, tf, sizeof(*tf));
|
||||
tf->tf_x[0] = 0;
|
||||
tf->tf_x[1] = 0;
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include <sys/_align.h>
|
||||
|
||||
#define STACKALIGNBYTES (16 - 1)
|
||||
#define STACKALIGN(p) ((uint64_t)(p) & ~STACKALIGNBYTES)
|
||||
|
||||
#ifndef MACHINE
|
||||
#define MACHINE "arm64"
|
||||
|
||||
@@ -338,7 +338,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
|
||||
|
||||
/* Make room, keeping the stack aligned */
|
||||
fp--;
|
||||
fp = (struct l_sigframe *)STACKALIGN(fp);
|
||||
fp = STACKALIGN(fp);
|
||||
|
||||
get_mcontext(td, &uc.uc_mcontext, 0);
|
||||
uc.uc_sigmask = *mask;
|
||||
|
||||
Reference in New Issue
Block a user