Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Mar 2016 16:42:01 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r296941 - in stable/10/sys: amd64/amd64 i386/i386
Message-ID:  <201603161642.u2GGg1lf035970@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201603161642.u2GGg1lf035970>