svn commit: r296945 - in releng/10.3/sys: amd64/amd64 i386/i386

Konstantin Belousov kib at FreeBSD.org
Wed Mar 16 17:01:26 UTC 2016


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

Log:
  MFC r296908:
  Force the desired alignment of the user save area.
  
  Approved by:	re (marius)

Modified:
  releng/10.3/sys/amd64/amd64/vm_machdep.c
  releng/10.3/sys/i386/i386/vm_machdep.c
Directory Properties:
  releng/10.3/   (props changed)

Modified: releng/10.3/sys/amd64/amd64/vm_machdep.c
==============================================================================
--- releng/10.3/sys/amd64/amd64/vm_machdep.c	Wed Mar 16 16:56:28 2016	(r296944)
+++ releng/10.3/sys/amd64/amd64/vm_machdep.c	Wed Mar 16 17:01:24 2016	(r296945)
@@ -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: releng/10.3/sys/i386/i386/vm_machdep.c
==============================================================================
--- releng/10.3/sys/i386/i386/vm_machdep.c	Wed Mar 16 16:56:28 2016	(r296944)
+++ releng/10.3/sys/i386/i386/vm_machdep.c	Wed Mar 16 17:01:24 2016	(r296945)
@@ -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-releng mailing list