Page MenuHomeFreeBSD

D54840.id170283.diff
No OneTemporary

D54840.id170283.diff

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

Mime Type
text/plain
Expires
Sun, Jan 25, 4:18 AM (15 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27910962
Default Alt Text
D54840.id170283.diff (2 KB)

Event Timeline