Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Jun 2015 13:59:03 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r284115 - head/sys/arm/arm
Message-ID:  <201506071359.t57Dx3To069080@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Sun Jun  7 13:59:02 2015
New Revision: 284115
URL: https://svnweb.freebsd.org/changeset/base/284115

Log:
  Stop checking for ARM_TP_ADDRESS when we mean to check if building for
  ARMv6 or later.

Modified:
  head/sys/arm/arm/exception.S
  head/sys/arm/arm/genassym.c
  head/sys/arm/arm/swtch.S
  head/sys/arm/arm/sys_machdep.c
  head/sys/arm/arm/vm_machdep.c

Modified: head/sys/arm/arm/exception.S
==============================================================================
--- head/sys/arm/arm/exception.S	Sun Jun  7 11:38:26 2015	(r284114)
+++ head/sys/arm/arm/exception.S	Sun Jun  7 13:59:02 2015	(r284115)
@@ -49,6 +49,7 @@
 #include "assym.s"
 
 #include "opt_kdtrace.h"
+#include <machine/acle-compat.h>
 #include <machine/asm.h>
 #include <machine/armreg.h>
 #include <machine/asmacros.h>
@@ -80,7 +81,7 @@ _C_LABEL(dtrace_invop_calltrap_addr):
  * NOTE: r13 and r14 are stored separately as a work around for the
  * SA110 rev 2 STM^ bug
  */
-#ifdef ARM_TP_ADDRESS
+#if __ARM_ARCH < 6
 #define PUSHFRAME							   \
 	sub	sp, sp, #4;		/* Align the stack */		   \
 	str	lr, [sp, #-4]!;		/* Push the return address */	   \
@@ -114,7 +115,7 @@ _C_LABEL(dtrace_invop_calltrap_addr):
  * Since the current mode is used, the SVC lr field is ignored.
  */
 
-#ifdef ARM_TP_ADDRESS
+#if __ARM_ARCH < 6
 #define PULLFRAME							   \
 	ldr	r0, [sp], #4;		/* Get the SPSR from stack */	   \
 	msr	spsr_fsxc, r0;						   \
@@ -145,7 +146,7 @@ _C_LABEL(dtrace_invop_calltrap_addr):
  * NOTE: r13 and r14 are stored separately as a work around for the
  * SA110 rev 2 STM^ bug
  */
-#ifdef ARM_TP_ADDRESS
+#if __ARM_ARCH < 6
 #define PUSHFRAMEINSVC							   \
 	stmdb	sp, {r0-r3};		/* Save 4 registers */		   \
 	mov	r0, lr;			/* Save xxx32 r14 */		   \
@@ -218,7 +219,7 @@ _C_LABEL(dtrace_invop_calltrap_addr):
  * exit.
  */
 
-#ifdef ARM_TP_ADDRESS
+#if __ARM_ARCH < 6
 #define PULLFRAMEFROMSVCANDEXIT						   \
 	ldr	r0, [sp], #4;		/* Get the SPSR from stack */	   \
 	msr	spsr_fsxc, r0;		/* restore SPSR */		   \

Modified: head/sys/arm/arm/genassym.c
==============================================================================
--- head/sys/arm/arm/genassym.c	Sun Jun  7 11:38:26 2015	(r284114)
+++ head/sys/arm/arm/genassym.c	Sun Jun  7 13:59:02 2015	(r284115)
@@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$");
 #include <vm/vm_param.h>
 #include <vm/pmap.h>
 #include <vm/vm_map.h>
+
+#include <machine/acle-compat.h>
 #include <machine/vmparam.h>
 #include <machine/armreg.h>
 #include <machine/frame.h>
@@ -124,7 +126,7 @@ ASSYM(P_FLAG, offsetof(struct proc, p_fl
 
 ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc));
 
-#ifdef ARM_TP_ADDRESS
+#if __ARM_ARCH < 6
 ASSYM(ARM_TP_ADDRESS, ARM_TP_ADDRESS);
 ASSYM(ARM_RAS_START, ARM_RAS_START);
 ASSYM(ARM_RAS_END, ARM_RAS_END);

Modified: head/sys/arm/arm/swtch.S
==============================================================================
--- head/sys/arm/arm/swtch.S	Sun Jun  7 11:38:26 2015	(r284114)
+++ head/sys/arm/arm/swtch.S	Sun Jun  7 13:59:02 2015	(r284115)
@@ -198,20 +198,20 @@ ENTRY(cpu_throw)
 	str	r7, [r6, #PC_CURPCB]
 	/* We have a new curthread now so make a note it */
 	str	r5, [r6, #PC_CURTHREAD]
-#ifndef ARM_TP_ADDRESS
+#if __ARM_ARCH >= 6
 	mcr	p15, 0, r5, c13, c0, 4
 #endif
 	/* Set the new tp */
 	ldr	r6, [r5, #(TD_MD + MD_TP)]
-#ifdef ARM_TP_ADDRESS
+#if __ARM_ARCH >= 6
+	mcr p15, 0, r6, c13, c0, 3
+#else
 	ldr	r4, =ARM_TP_ADDRESS
 	str	r6, [r4]
 	ldr	r6, [r5, #(TD_MD + MD_RAS_START)]
 	str	r6, [r4, #4] /* ARM_RAS_START */
 	ldr	r6, [r5, #(TD_MD + MD_RAS_END)]
 	str	r6, [r4, #8] /* ARM_RAS_END */
-#else
-	mcr p15, 0, r6, c13, c0, 3
 #endif
 	/* Restore all the saved registers and exit */
 	add	r3, r7, #PCB_R4
@@ -245,7 +245,7 @@ ENTRY(cpu_switch)
 	/* We have a new curthread now so make a note it */
 	GET_PCPU(r7, r2)
 	str	r1, [r7, #PC_CURTHREAD]
-#ifndef ARM_TP_ADDRESS
+#if __ARM_ARCH >= 6
 	mcr	p15, 0, r1, c13, c0, 4
 #endif
 
@@ -259,7 +259,14 @@ ENTRY(cpu_switch)
 	ldr	r2, [r0, #(TD_PCB)]
 	mov	r4, r0 /* Save the old thread. */
 
-#ifdef ARM_TP_ADDRESS
+#if __ARM_ARCH >= 6
+	/*
+	 * 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
+#else
 	/* Store the old tp; userland can change it on armv4. */
 	ldr	r3, =ARM_TP_ADDRESS
 	ldr	r9, [r3]
@@ -276,13 +283,6 @@ ENTRY(cpu_switch)
 	str	r9, [r3, #4]
 	ldr	r9, [r1, #(TD_MD + MD_RAS_END)]
 	str	r9, [r3, #8]
-#else
-	/*
-	 * 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
 
 	/* Get the user structure for the new process in r9 */

Modified: head/sys/arm/arm/sys_machdep.c
==============================================================================
--- head/sys/arm/arm/sys_machdep.c	Sun Jun  7 11:38:26 2015	(r284114)
+++ head/sys/arm/arm/sys_machdep.c	Sun Jun  7 13:59:02 2015	(r284115)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include <vm/vm.h>
 #include <vm/vm_extern.h>
 
+#include <machine/acle-compat.h>
 #include <machine/cpu-v6.h>
 #include <machine/sysarch.h>
 #include <machine/vmparam.h>
@@ -162,7 +163,7 @@ arm32_set_tp(struct thread *td, void *ar
 {
 
 	td->td_md.md_tp = (register_t)args;
-#ifndef ARM_TP_ADDRESS
+#if __ARM_ARCH >= 6
 	set_tls(args);
 #else
 	*(register_t *)ARM_TP_ADDRESS = (register_t)args;
@@ -174,7 +175,7 @@ static int
 arm32_get_tp(struct thread *td, void *args)
 {
 
-#ifndef ARM_TP_ADDRESS
+#if __ARM_ARCH >= 6
 	td->td_retval[0] = td->td_md.md_tp;
 #else
 	td->td_retval[0] = *(register_t *)ARM_TP_ADDRESS;

Modified: head/sys/arm/arm/vm_machdep.c
==============================================================================
--- head/sys/arm/arm/vm_machdep.c	Sun Jun  7 11:38:26 2015	(r284114)
+++ head/sys/arm/arm/vm_machdep.c	Sun Jun  7 13:59:02 2015	(r284115)
@@ -54,6 +54,8 @@ __FBSDID("$FreeBSD$");
 #include <sys/sysctl.h>
 #include <sys/sysent.h>
 #include <sys/unistd.h>
+
+#include <machine/acle-compat.h>
 #include <machine/cpu.h>
 #include <machine/frame.h>
 #include <machine/pcb.h>
@@ -143,10 +145,10 @@ cpu_fork(register struct thread *td1, re
 	/* Setup to release spin count in fork_exit(). */
 	td2->td_md.md_spinlock_count = 1;
 	td2->td_md.md_saved_cspr = PSR_SVC32_MODE;;
-#ifdef ARM_TP_ADDRESS
-	td2->td_md.md_tp = *(register_t *)ARM_TP_ADDRESS;
-#else
+#if __ARM_ARCH >= 6
 	td2->td_md.md_tp = td1->td_md.md_tp;
+#else
+	td2->td_md.md_tp = *(register_t *)ARM_TP_ADDRESS;
 #endif
 }
 
@@ -273,10 +275,10 @@ cpu_set_user_tls(struct thread *td, void
 	td->td_md.md_tp = (register_t)tls_base;
 	if (td == curthread) {
 		critical_enter();
-#ifdef ARM_TP_ADDRESS
-		*(register_t *)ARM_TP_ADDRESS = (register_t)tls_base;
-#else
+#if __ARM_ARCH >= 6
 		set_tls(tls_base);
+#else
+		*(register_t *)ARM_TP_ADDRESS = (register_t)tls_base;
 #endif
 		critical_exit();
 	}



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