From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhk9l-0002yC-AD for qemu-devel@nongnu.org; Thu, 01 Oct 2015 16:08:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zhk9i-0000h4-2C for qemu-devel@nongnu.org; Thu, 01 Oct 2015 16:08:45 -0400 Received: from mail-bn1on0084.outbound.protection.outlook.com ([157.56.110.84]:24992 helo=na01-bn1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhk9h-0000gp-Ss for qemu-devel@nongnu.org; Thu, 01 Oct 2015 16:08:41 -0400 Date: Thu, 1 Oct 2015 12:52:38 -0700 From: "Edgar E. Iglesias" Message-ID: <20151001195238.GH3214@toto> References: <1442672127-26223-1-git-send-email-edgar.iglesias@gmail.com> <1442672127-26223-4-git-send-email-edgar.iglesias@gmail.com> <20151001184451.GB29416@toto> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH RFC 3/8] target-arm: Add support for S2 page-table protection bits List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: "Edgar E. Iglesias" , Sergey Fedorov , Alex =?iso-8859-1?Q?Benn=E9e?= , QEMU Developers , Alexander Graf On Thu, Oct 01, 2015 at 08:48:17PM +0100, Peter Maydell wrote: > On 1 October 2015 at 19:44, Edgar E. Iglesias wrote: > > On Wed, Sep 23, 2015 at 09:55:05AM -0700, Peter Maydell wrote: > >> This isn't right -- the XN bit controls executability and the > >> S2AP bits don't affect it at all. I think you want: > >> > >> int prot_rw = 0; > >> if (s2ap & 1) { > >> prot_rw |= PAGE_READ; > >> } > >> if (s2ap & 2) { > >> prot_rw |= PAGE_WRITE; > >> } > >> if (!xn) { > >> prot_rw |= PAGE_EXEC; > >> } > > > > > > Thanks, this was the stuff I was worried about when we talked about it > > last time. I've got the following now which seems to be the same as > > you suggest: > > > > static int get_S2prot(CPUARMState *env, int s2ap, int xn) > > { > > int prot; > > > > prot = s2ap & 1 ? PAGE_READ : 0; > > prot |= s2ap & 2 ? PAGE_WRITE : 0; > > if (!xn) { > > prot |= PAGE_EXEC; > > } > > return prot; > > } > > Yep, that's the right logic, though it seems a bit odd not > to consistently use either 'if' or '?:' for all 3 bits. OK, that's true, I'll change it to all ifs. Thanks, Edgar