From patchwork Mon May 9 21:34:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 94863 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 56192B6F18 for ; Tue, 10 May 2011 07:38:16 +1000 (EST) Received: from localhost ([::1]:32899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJY9d-0008Ly-Hj for incoming@patchwork.ozlabs.org; Mon, 09 May 2011 17:38:13 -0400 Received: from eggs.gnu.org ([140.186.70.92]:38313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJY6b-0003OZ-NU for qemu-devel@nongnu.org; Mon, 09 May 2011 17:35:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QJY6a-0006FU-Uv for qemu-devel@nongnu.org; Mon, 09 May 2011 17:35:05 -0400 Received: from mail-iy0-f173.google.com ([209.85.210.173]:48729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJY6a-0006A3-Rc for qemu-devel@nongnu.org; Mon, 09 May 2011 17:35:04 -0400 Received: by mail-iy0-f173.google.com with SMTP id 10so5564538iym.4 for ; Mon, 09 May 2011 14:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:subject:date:message-id:x-mailer :in-reply-to:references; bh=RYwcOFDjhrhZWewxDi2SDg+thxe2TlI649+aSRrZU8Q=; b=B+T7r2RsMujmtVnr4xsKALvOrwef+dl3jXMK0fnJo5CaB0vliZvv3Wgid/WuxsyXWg aEiG/kyaZdhQkH1DeqjMnXRKd1mPdmpQl09hhknkV3T2va0IptzTzoN2Uknj1YP8aUFx PMM9qm/F7zP138yGucAaMWN/iElGKMjxdfVQU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; b=hsZgBtfg/px2Ehg6ZwPfM40B6YERwJyAtX4XFkCRhAyhNlWO/L8+GbvJNdJJXmptem hdF/QNbeeag07m9X/Cxvlr7wEH0EI33091eOXIxIH92dBN1DF4Ok0j9NBMrQhStG/rS4 jwbtPgNbhdfSwF1fNS4yVEFT1FYcRLvM/HMWk= Received: by 10.42.152.195 with SMTP id j3mr3262851icw.514.1304976904644; Mon, 09 May 2011 14:35:04 -0700 (PDT) Received: from localhost.localdomain (are.twiddle.net [75.101.38.216]) by mx.google.com with ESMTPS id ui7sm2549819icb.14.2011.05.09.14.35.03 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 May 2011 14:35:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 9 May 2011 14:34:23 -0700 Message-Id: <1304976889-29675-10-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1304976889-29675-1-git-send-email-rth@twiddle.net> References: <1304976889-29675-1-git-send-email-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.210.173 Subject: [Qemu-devel] [PATCH 09/35] target-alpha: Cleanup MMU modes. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Don't bother including executive and supervisor modes. Signed-off-by: Richard Henderson --- target-alpha/cpu.h | 36 ++++++++++++++++++++++++++++-------- 1 files changed, 28 insertions(+), 8 deletions(-) diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h index 1fc21dc..bdd396c 100644 --- a/target-alpha/cpu.h +++ b/target-alpha/cpu.h @@ -192,6 +192,33 @@ enum { #define SWCR_MASK (SWCR_TRAP_ENABLE_MASK | SWCR_MAP_MASK | SWCR_STATUS_MASK) +/* MMU modes definitions */ + +/* Alpha has 5 MMU modes: PALcode, kernel, executive, supervisor, and user. + The Unix PALcode only exposes the kernel and user modes; presumably + executive and supervisor are used by VMS. + + PALcode itself uses physical mode for code and kernel mode for data; + there are PALmode instructions that can access data via physical mode + or via an os-installed "alternate mode", which is one of the 4 above. + + QEMU does not currently properly distinguish between code/data when + looking up addresses. To avoid having to address this issue, our + emulated PALcode will cheat and use the KSEG mapping for its code+data + rather than physical addresses. + + Moreover, we're only emulating Unix PALcode, and not attempting VMS. + + All of which allows us to drop all but kernel and user modes. + Elide the unused MMU modes to save space. */ + +#define NB_MMU_MODES 2 + +#define MMU_MODE0_SUFFIX _kernel +#define MMU_MODE1_SUFFIX _user +#define MMU_KERNEL_IDX 0 +#define MMU_USER_IDX 1 + typedef struct CPUAlphaState CPUAlphaState; struct CPUAlphaState { @@ -246,16 +273,9 @@ struct CPUAlphaState { #define cpu_gen_code cpu_alpha_gen_code #define cpu_signal_handler cpu_alpha_signal_handler -/* MMU modes definitions */ -#define NB_MMU_MODES 4 -#define MMU_MODE0_SUFFIX _kernel -#define MMU_MODE1_SUFFIX _executive -#define MMU_MODE2_SUFFIX _supervisor -#define MMU_MODE3_SUFFIX _user -#define MMU_USER_IDX 3 static inline int cpu_mmu_index (CPUState *env) { - return (env->ps >> 3) & 3; + return (env->ps >> 3) & 1; } #include "cpu-all.h"