From patchwork Mon May 9 21:34:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 94866 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 C42F0B6F18 for ; Tue, 10 May 2011 07:38:45 +1000 (EST) Received: from localhost ([::1]:54470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJYA5-0000jb-Fu for incoming@patchwork.ozlabs.org; Mon, 09 May 2011 17:38:41 -0400 Received: from eggs.gnu.org ([140.186.70.92]:38463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJY6j-0003co-1y for qemu-devel@nongnu.org; Mon, 09 May 2011 17:35:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QJY6i-0006Km-2w for qemu-devel@nongnu.org; Mon, 09 May 2011 17:35:13 -0400 Received: from mail-iw0-f173.google.com ([209.85.214.173]:38418) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QJY6h-0006Af-SV for qemu-devel@nongnu.org; Mon, 09 May 2011 17:35:11 -0400 Received: by mail-iw0-f173.google.com with SMTP id 42so5560360iwl.4 for ; Mon, 09 May 2011 14:35:11 -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=1JFiB5xqcnG0Z7XrJmk3VGIbZBmai2Xref3nfR0G/EY=; b=e15D0QO/DmtiOCwLOQ6vMt22T405ZbtuvPD/kcsZel5JXO57eKPn26d6r+MQffodLk 1tS8L7F4Vlt57jnPbj524kBD5AYftCzncANlwmvuYu3q/oi3Eypq3Kd/bg4B4TLhsNvN 6b0nwx8aZ1yqj4NL4pokKyzHkoQd2BmSKTzPs= 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=BjK24y/3up75h13BWdmWCaFQis7yVyjRXapBLdHXRjniaNvXtZ9j3zN4vNLnFWB7L5 zMZTQjqkPuFFud3g50ur9N7P8h1mjaM3sXlBqsYaY+pmW5w1GObUqu8T9CfSpLUwImTD Q8JTCwuvxwQQIY9fUyoEBxEY7RBoouOtSasSo= Received: by 10.43.70.204 with SMTP id yh12mr6363889icb.430.1304976911629; Mon, 09 May 2011 14:35:11 -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.10 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 09 May 2011 14:35:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 9 May 2011 14:34:31 -0700 Message-Id: <1304976889-29675-18-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.214.173 Subject: [Qemu-devel] [PATCH 17/35] target-alpha: Add various symbolic constants. 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 The EXC_M_* constants were being set for the EV6, not as set for the Unix kernel entry point. Use PS_USER_MODE instead of hard-coding access to the PS register. Signed-off-by: Richard Henderson --- target-alpha/cpu.h | 56 +++++++++++++++++++++++++++++++++++---------- target-alpha/translate.c | 2 +- 2 files changed, 44 insertions(+), 14 deletions(-) diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h index 7e4c46f..50a8109 100644 --- a/target-alpha/cpu.h +++ b/target-alpha/cpu.h @@ -290,11 +290,6 @@ struct CPUAlphaState { #define cpu_gen_code cpu_alpha_gen_code #define cpu_signal_handler cpu_alpha_signal_handler -static inline int cpu_mmu_index (CPUState *env) -{ - return (env->ps >> 3) & 1; -} - #include "cpu-all.h" enum { @@ -321,14 +316,49 @@ enum { EXCP_STQ_C, }; -/* Arithmetic exception */ -#define EXC_M_IOV (1<<16) /* Integer Overflow */ -#define EXC_M_INE (1<<15) /* Inexact result */ -#define EXC_M_UNF (1<<14) /* Underflow */ -#define EXC_M_FOV (1<<13) /* Overflow */ -#define EXC_M_DZE (1<<12) /* Division by zero */ -#define EXC_M_INV (1<<11) /* Invalid operation */ -#define EXC_M_SWC (1<<10) /* Software completion */ +/* Hardware interrupt (entInt) constants. */ +enum { + INT_K_IP, + INT_K_CLK, + INT_K_MCHK, + INT_K_DEV, + INT_K_PERF, +}; + +/* Memory management (entMM) constants. */ +enum { + MM_K_TNV, + MM_K_ACV, + MM_K_FOR, + MM_K_FOE, + MM_K_FOW +}; + +/* Arithmetic exception (entArith) constants. */ +enum { + EXC_M_SWC = 1, /* Software completion */ + EXC_M_INV = 2, /* Invalid operation */ + EXC_M_DZE = 4, /* Division by zero */ + EXC_M_FOV = 8, /* Overflow */ + EXC_M_UNF = 16, /* Underflow */ + EXC_M_INE = 32, /* Inexact result */ + EXC_M_IOV = 64 /* Integer Overflow */ +}; + +/* Processor status constants. */ +enum { + /* Low 3 bits are interrupt mask level. */ + PS_INT_MASK = 7, + + /* Bits 4 and 5 are the mmu mode. The VMS PALcode uses all 4 modes; + The Unix PALcode only uses bit 4. */ + PS_USER_MODE = 8 +}; + +static inline int cpu_mmu_index (CPUState *env) +{ + return (env->ps & PS_USER_MODE) != 0; +} enum { IR_V0 = 0, diff --git a/target-alpha/translate.c b/target-alpha/translate.c index 09edb0f..42a80e6 100644 --- a/target-alpha/translate.c +++ b/target-alpha/translate.c @@ -3359,7 +3359,7 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model) env->amask = amask; #if defined (CONFIG_USER_ONLY) - env->ps = 1 << 3; + env->ps = PS_USER_MODE; cpu_alpha_store_fpcr(env, (FPCR_INVD | FPCR_DZED | FPCR_OVFD | FPCR_UNFD | FPCR_INED | FPCR_DNOD)); #else