Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147272509
D55151.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D55151.diff
View Options
diff --git a/sys/amd64/amd64/exec_machdep.c b/sys/amd64/amd64/exec_machdep.c
--- a/sys/amd64/amd64/exec_machdep.c
+++ b/sys/amd64/amd64/exec_machdep.c
@@ -151,7 +151,7 @@
td->td_sigstk.ss_flags |= SS_ONSTACK;
#endif
} else
- sp = (char *)regs->tf_rsp - 128;
+ sp = (char *)regs->tf_rsp - REDZONE_SZ;
if (xfpusave != NULL) {
sp -= xfpusave_len;
sp = (char *)((unsigned long)sp & ~0x3Ful);
@@ -159,7 +159,7 @@
}
sp -= sizeof(struct sigframe);
/* Align to 16 bytes. */
- sfp = (struct sigframe *)((unsigned long)sp & ~0xFul);
+ sfp = (struct sigframe *)STACKALIGN(sp);
/* Build the argument list for the signal handler. */
regs->tf_rdi = sig; /* arg 1 in %rdi */
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1216,8 +1216,8 @@
{
PCPU_SET(rsp0, rsp0);
- PCPU_SET(pti_rsp0, ((vm_offset_t)PCPU_PTR(pti_stack) +
- PC_PTI_STACK_SZ * sizeof(uint64_t)) & ~0xful);
+ PCPU_SET(pti_rsp0, STACKALIGN((vm_offset_t)PCPU_PTR(pti_stack) +
+ PC_PTI_STACK_SZ * sizeof(uint64_t)));
PCPU_SET(curpcb, thread0.td_pcb);
}
@@ -1585,7 +1585,7 @@
/* make an initial tss so cpu can get interrupt stack on syscall! */
rsp0 = thread0.td_md.md_stack_base;
/* Ensure the stack is aligned to 16 bytes */
- rsp0 &= ~0xFul;
+ rsp0 = STACKALIGN(rsp0);
PCPU_PTR(common_tss)->tss_rsp0 = rsp0;
amd64_bsp_pcpu_init2(rsp0);
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -217,8 +217,8 @@
pc->pc_curthread = 0;
pc->pc_tssp = &pc->pc_common_tss;
pc->pc_rsp0 = 0;
- pc->pc_pti_rsp0 = (((vm_offset_t)&pc->pc_pti_stack +
- PC_PTI_STACK_SZ * sizeof(uint64_t)) & ~0xful);
+ pc->pc_pti_rsp0 = STACKALIGN(((vm_offset_t)&pc->pc_pti_stack +
+ PC_PTI_STACK_SZ * sizeof(uint64_t)));
gdt = pc->pc_gdt;
pc->pc_tss = (struct system_segment_descriptor *)&gdt[GPROC0_SEL];
pc->pc_fs32p = &gdt[GUFS32_SEL];
diff --git a/sys/amd64/include/param.h b/sys/amd64/include/param.h
--- a/sys/amd64/include/param.h
+++ b/sys/amd64/include/param.h
@@ -43,6 +43,9 @@
#include <sys/_align.h>
+#define STACKALIGNBYTES (16 - 1)
+#define REDZONE_SZ 128
+
/*
* Machine dependent constants for AMD64.
*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 10, 2:44 PM (4 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29497234
Default Alt Text
D55151.diff (2 KB)
Attached To
Mode
D55151: amd64: define and use STACKALIGN and REDZONE_SZ
Attached
Detach File
Event Timeline
Log In to Comment