Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142837174
D54840.id.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
D54840.id.diff
View Options
diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -93,8 +93,7 @@
struct savefpu *
get_pcb_user_save_td(struct thread *td)
{
- KASSERT(((vm_offset_t)td->td_md.md_usr_fpu_save %
- XSAVE_AREA_ALIGN) == 0,
+ KASSERT(__is_aligned(td->td_md.md_usr_fpu_save, XSAVE_AREA_ALIGN),
("Unaligned pcb_user_save area ptr %p td %p",
td->td_md.md_usr_fpu_save, td));
return (td->td_md.md_usr_fpu_save);
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -91,7 +91,8 @@
p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN);
- KASSERT((p % XSAVE_AREA_ALIGN) == 0, ("Unaligned pcb_user_save area"));
+ KASSERT(__is_aligned(p, XSAVE_AREA_ALIGN),
+ ("Unaligned pcb_user_save area"));
return ((union savefpu *)p);
}
diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c
--- a/sys/powerpc/powerpc/exec_machdep.c
+++ b/sys/powerpc/powerpc/exec_machdep.c
@@ -1082,8 +1082,8 @@
{
struct pcb *pcb;
- pcb = (struct pcb *)((td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
- sizeof(struct pcb)) & ~0x3fUL);
+ pcb = (struct pcb *)__align_down(td->td_kstack + td->td_kstack_pages *
+ PAGE_SIZE - sizeof(struct pcb), 0x40);
td->td_pcb = pcb;
td->td_frame = (struct trapframe *)pcb - 1;
}
diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c
--- a/sys/powerpc/powerpc/machdep.c
+++ b/sys/powerpc/powerpc/machdep.c
@@ -488,9 +488,8 @@
/*
* Finish setting up thread0.
*/
- thread0.td_pcb = (struct pcb *)
- ((thread0.td_kstack + thread0.td_kstack_pages * PAGE_SIZE -
- sizeof(struct pcb)) & ~15UL);
+ thread0.td_pcb = (struct pcb *)__align_down(thread0.td_kstack +
+ thread0.td_kstack_pages * PAGE_SIZE - sizeof(struct pcb), 16);
bzero((void *)thread0.td_pcb, sizeof(struct pcb));
pc->pc_curpcb = thread0.td_pcb;
diff --git a/sys/powerpc/powerpc/vm_machdep.c b/sys/powerpc/powerpc/vm_machdep.c
--- a/sys/powerpc/powerpc/vm_machdep.c
+++ b/sys/powerpc/powerpc/vm_machdep.c
@@ -123,8 +123,8 @@
if (td1 == curthread)
cpu_update_pcb(td1);
- pcb = (struct pcb *)((td2->td_kstack +
- td2->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb)) & ~0x3fUL);
+ pcb = (struct pcb *)__align_down(td2->td_kstack +
+ td2->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb), 0x40);
td2->td_pcb = pcb;
/* Copy the pcb */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 25, 1:23 AM (15 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27910962
Default Alt Text
D54840.id.diff (2 KB)
Attached To
Mode
D54840: sys: Use __is_aligned and __align_down for some kstack alignment operations
Attached
Detach File
Event Timeline
Log In to Comment