svn commit: r296941 - in stable/10/sys: amd64/amd64 i386/i386

Konstantin Belousov kib at FreeBSD.org
Wed Mar 16 16:42:03 UTC 2016


Author: kib
Date: Wed Mar 16 16:42:01 2016
New Revision: 296941
URL: https://svnweb.freebsd.org/changeset/base/296941

Log:
  MFC r296908:
  Force the desired alignment of the user save area.

Modified:
  stable/10/sys/amd64/amd64/vm_machdep.c
  stable/10/sys/i386/i386/vm_machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/amd64/amd64/vm_machdep.c
==============================================================================
--- stable/10/sys/amd64/amd64/vm_machdep.c	Wed Mar 16 16:21:30 2016	(r296940)
+++ stable/10/sys/amd64/amd64/vm_machdep.c	Wed Mar 16 16:42:01 2016	(r296941)
@@ -100,8 +100,8 @@ get_pcb_user_save_td(struct thread *td)
 	vm_offset_t p;
 
 	p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
-	    cpu_max_ext_state_size;
-	KASSERT((p % 64) == 0, ("Unaligned pcb_user_save area"));
+	    roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN);
+	KASSERT((p % XSAVE_AREA_ALIGN) == 0, ("Unaligned pcb_user_save area"));
 	return ((struct savefpu *)p);
 }
 
@@ -120,7 +120,8 @@ get_pcb_td(struct thread *td)
 	vm_offset_t p;
 
 	p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
-	    cpu_max_ext_state_size - sizeof(struct pcb);
+	    roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN) -
+	    sizeof(struct pcb);
 	return ((struct pcb *)p);
 }
 

Modified: stable/10/sys/i386/i386/vm_machdep.c
==============================================================================
--- stable/10/sys/i386/i386/vm_machdep.c	Wed Mar 16 16:21:30 2016	(r296940)
+++ stable/10/sys/i386/i386/vm_machdep.c	Wed Mar 16 16:42:01 2016	(r296941)
@@ -159,8 +159,8 @@ get_pcb_user_save_td(struct thread *td)
 {
 	vm_offset_t p;
 	p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
-	    cpu_max_ext_state_size;
-	KASSERT((p % 64) == 0, ("Unaligned pcb_user_save area"));
+	    roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN);
+	KASSERT((p % XSAVE_AREA_ALIGN) == 0, ("Unaligned pcb_user_save area"));
 	return ((union savefpu *)p);
 }
 
@@ -179,7 +179,8 @@ get_pcb_td(struct thread *td)
 	vm_offset_t p;
 
 	p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
-	    cpu_max_ext_state_size - sizeof(struct pcb);
+	    roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN) -
+	    sizeof(struct pcb);
 	return ((struct pcb *)p);
 }
 


More information about the svn-src-stable-10 mailing list