From owner-svn-src-all@FreeBSD.ORG Sun Jun 7 13:59:04 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CDFD3BF1; Sun, 7 Jun 2015 13:59:04 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BBE3E1F68; Sun, 7 Jun 2015 13:59:04 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t57Dx417069092; Sun, 7 Jun 2015 13:59:04 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t57Dx3To069080; Sun, 7 Jun 2015 13:59:03 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201506071359.t57Dx3To069080@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 7 Jun 2015 13:59:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284115 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jun 2015 13:59:04 -0000 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 #include #include #include @@ -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 #include #include + +#include #include #include #include @@ -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 #include +#include #include #include #include @@ -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 #include #include + +#include #include #include #include @@ -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(); }