From owner-svn-src-all@freebsd.org Thu Oct 29 22:12:05 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22BC8A21344; Thu, 29 Oct 2015 22:12:05 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 DC2FB1888; Thu, 29 Oct 2015 22:12:04 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9TMC3Va058230; Thu, 29 Oct 2015 22:12:03 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9TMC35I058229; Thu, 29 Oct 2015 22:12:03 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201510292212.t9TMC35I058229@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 29 Oct 2015 22:12:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290167 - 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: Thu, 29 Oct 2015 22:12:05 -0000 Author: gonzo Date: Thu Oct 29 22:12:03 2015 New Revision: 290167 URL: https://svnweb.freebsd.org/changeset/base/290167 Log: Fix LEAVE_HYP macro: spsr is not guaranteed to contain valid value at this point, e.g. on RaspberryPi 2 when control is passed from loader to kernel it contains garbage. So we use cpsr as a base for new cpsr value: if we have reached this point it means current value is OK Reviewed by: andrew Modified: head/sys/arm/arm/locore-v6.S Modified: head/sys/arm/arm/locore-v6.S ============================================================================== --- head/sys/arm/arm/locore-v6.S Thu Oct 29 21:40:32 2015 (r290166) +++ head/sys/arm/arm/locore-v6.S Thu Oct 29 22:12:03 2015 (r290167) @@ -74,9 +74,11 @@ __FBSDID("$FreeBSD$"); teq r0, #(PSR_HYP32_MODE) /* Hyp Mode? */ ;\ bne 1f ;\ /* Ensure that IRQ, FIQ and Aborts will be disabled after eret */ ;\ - mrs r0, spsr ;\ + mrs r0, cpsr ;\ + bic r0, r0, #(PSR_MODE) ;\ + orr r0, r0, #(PSR_SVC32_MODE) ;\ orr r0, r0, #(PSR_I | PSR_F | PSR_A) ;\ - msr spsr, r0 ;\ + msr spsr_cxsf, r0 ;\ /* Exit hypervisor mode */ ;\ adr lr, 1f ;\ MSR_ELR_HYP(14) ;\