From patchwork Thu Apr 28 20:51:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 93314 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 1C4A51007DB for ; Fri, 29 Apr 2011 06:57:41 +1000 (EST) Received: from localhost ([::1]:45904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFYHJ-0007yU-BC for incoming@patchwork.ozlabs.org; Thu, 28 Apr 2011 16:57:37 -0400 Received: from eggs.gnu.org ([140.186.70.92]:47942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFYBf-0005Sa-MR for qemu-devel@nongnu.org; Thu, 28 Apr 2011 16:51:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QFYBd-0005dz-4P for qemu-devel@nongnu.org; Thu, 28 Apr 2011 16:51:47 -0400 Received: from mail-pz0-f45.google.com ([209.85.210.45]:41034) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFYBc-0005Xk-Rw for qemu-devel@nongnu.org; Thu, 28 Apr 2011 16:51:44 -0400 Received: by mail-pz0-f45.google.com with SMTP id 30so2296231pzk.4 for ; Thu, 28 Apr 2011 13:51:44 -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=I9JUA97KRKSsWxjtSkWFjd3ISqSax+ck85159+QwO06O9m+GJgPFnq5EkEnLAMd/L0 uIt/6jnG7QE5Nwovw0jAmq061BA1TwDtrLA5GPKo0MSKrCa4Ee9D0DYVo/MgDicSUOD6 Xfxdmt/9h1CIc35y1/b5Kk6KIyiFnhqWawPDo= 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=KUdLvO1HfYRFsJcalz0Zrbt8+OoL1FhAs4Hu5/s9gLADfAQ/JKhYsVfHybejZcNXm4 RRYz1x5Fl1XyM52oylhZqBoJG2COgBEt9exPvHoX+3wb9hB17BHMnOi1Cyt9+txRmvKq cOZIczRC90N/opjvkRwzCp+aIvVTFX6UT0aVw= Received: by 10.142.166.5 with SMTP id o5mr1306662wfe.206.1304023904361; Thu, 28 Apr 2011 13:51:44 -0700 (PDT) Received: from localhost.localdomain (are.twiddle.net [75.101.38.216]) by mx.google.com with ESMTPS id z10sm2266797wfj.12.2011.04.28.13.51.43 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 28 Apr 2011 13:51:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 28 Apr 2011 13:51:00 -0700 Message-Id: <1304023875-25040-19-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1304023875-25040-1-git-send-email-rth@twiddle.net> References: <1304023875-25040-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.45 Subject: [Qemu-devel] [PATCH 18/33] 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