Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 May 2015 23:27:00 +0000 (UTC)
From:      Ian Lepore <ian@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: r283339 - in stable/10/sys: arm/arm arm/include conf
Message-ID:  <201505232327.t4NNR1mU062403@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Sat May 23 23:27:00 2015
New Revision: 283339
URL: https://svnweb.freebsd.org/changeset/base/283339

Log:
  MFC r280278, r280402:
  
    Allow to override default kernel virtual address assignment on ARM.
  
    Do not save/restore the TLS pointer on context switch for armv6.

Modified:
  stable/10/sys/arm/arm/swtch.S
  stable/10/sys/arm/arm/sys_machdep.c
  stable/10/sys/arm/arm/vm_machdep.c
  stable/10/sys/arm/include/vmparam.h
  stable/10/sys/conf/options.arm
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/arm/arm/swtch.S
==============================================================================
--- stable/10/sys/arm/arm/swtch.S	Sat May 23 23:08:54 2015	(r283338)
+++ stable/10/sys/arm/arm/swtch.S	Sat May 23 23:27:00 2015	(r283339)
@@ -255,7 +255,7 @@ ENTRY(cpu_switch)
 	mov	r4, r0 /* Save the old thread. */
 
 #ifdef ARM_TP_ADDRESS
-	/* Store the old tp */
+	/* Store the old tp; userland can change it on armv4. */
 	ldr	r3, =ARM_TP_ADDRESS
 	ldr	r9, [r3]
 	str	r9, [r0, #(TD_MD + MD_TP)]
@@ -272,11 +272,10 @@ ENTRY(cpu_switch)
 	ldr	r9, [r1, #(TD_MD + MD_RAS_END)]
 	str	r9, [r3, #8]
 #else
-	/* Store the old tp */
-	mrc p15, 0, r9, c13, c0, 3
-	str	r9, [r0, #(TD_MD + MD_TP)]
-
-	/* Set the new tp */
+	/* 
+	 * Set new tp.  No need to store the old one first, userland can't 
+	 * change it directly on armv6.
+	 */
 	ldr	r9, [r1, #(TD_MD + MD_TP)]
 	mcr p15, 0, r9, c13, c0, 3
 #endif

Modified: stable/10/sys/arm/arm/sys_machdep.c
==============================================================================
--- stable/10/sys/arm/arm/sys_machdep.c	Sat May 23 23:08:54 2015	(r283338)
+++ stable/10/sys/arm/arm/sys_machdep.c	Sat May 23 23:27:00 2015	(r283339)
@@ -84,13 +84,11 @@ static int
 arm32_set_tp(struct thread *td, void *args)
 {
 
-	if (td != curthread)
-		td->td_md.md_tp = (register_t)args;
-	else 
+	td->td_md.md_tp = (register_t)args;
 #ifndef ARM_TP_ADDRESS
-		set_tls(args);
+	set_tls(args);
 #else
-		*(register_t *)ARM_TP_ADDRESS = (register_t)args;
+	*(register_t *)ARM_TP_ADDRESS = (register_t)args;
 #endif
 	return (0);
 }
@@ -99,13 +97,10 @@ static int
 arm32_get_tp(struct thread *td, void *args)
 {
 
-	if (td != curthread)
-		td->td_retval[0] = td->td_md.md_tp;
-	else
 #ifndef ARM_TP_ADDRESS
-		td->td_retval[0] = (register_t)get_tls();
+	td->td_retval[0] = td->td_md.md_tp;
 #else
-		td->td_retval[0] = *(register_t *)ARM_TP_ADDRESS;
+	td->td_retval[0] = *(register_t *)ARM_TP_ADDRESS;
 #endif
 	return (0);
 }

Modified: stable/10/sys/arm/arm/vm_machdep.c
==============================================================================
--- stable/10/sys/arm/arm/vm_machdep.c	Sat May 23 23:08:54 2015	(r283338)
+++ stable/10/sys/arm/arm/vm_machdep.c	Sat May 23 23:27:00 2015	(r283339)
@@ -182,7 +182,7 @@ cpu_fork(register struct thread *td1, re
 #ifdef ARM_TP_ADDRESS
 	td2->td_md.md_tp = *(register_t *)ARM_TP_ADDRESS;
 #else
-	td2->td_md.md_tp = (register_t) get_tls();
+	td2->td_md.md_tp = td1->td_md.md_tp;
 #endif
 }
 				
@@ -411,7 +411,7 @@ cpu_set_user_tls(struct thread *td, void
 #ifdef ARM_TP_ADDRESS
 		*(register_t *)ARM_TP_ADDRESS = (register_t)tls_base;
 #else
-		set_tls((void *)tls_base);
+		set_tls(tls_base);
 #endif
 		critical_exit();
 	}

Modified: stable/10/sys/arm/include/vmparam.h
==============================================================================
--- stable/10/sys/arm/include/vmparam.h	Sat May 23 23:08:54 2015	(r283338)
+++ stable/10/sys/arm/include/vmparam.h	Sat May 23 23:27:00 2015	(r283339)
@@ -68,7 +68,9 @@
  * The line between user space and kernel space
  * Mappings >= KERNEL_BASE are constant across all processes
  */
+#ifndef KERNBASE
 #define	KERNBASE		0xc0000000
+#endif
 
 /*
  * max number of non-contig chunks of physical RAM you can have

Modified: stable/10/sys/conf/options.arm
==============================================================================
--- stable/10/sys/conf/options.arm	Sat May 23 23:08:54 2015	(r283338)
+++ stable/10/sys/conf/options.arm	Sat May 23 23:27:00 2015	(r283339)
@@ -28,6 +28,7 @@ IPI_IRQ_START		opt_smp.h
 IPI_IRQ_END		opt_smp.h
 FREEBSD_BOOT_LOADER	opt_global.h
 IXP4XX_FLASH_SIZE	opt_global.h
+KERNBASE		opt_global.h
 KERNPHYSADDR		opt_global.h
 KERNVIRTADDR		opt_global.h
 LINUX_BOOT_ABI		opt_global.h



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