From patchwork Mon Jun 18 18:40:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 139063 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4295957lji; Mon, 18 Jun 2018 12:00:33 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLLh96kajA9Hmlj59ivZf4Ml3snIp9UJd2Avuw+DOeGpi8kUeco5IJpjJ0aPjeIyMDcayHg X-Received: by 2002:a37:7e04:: with SMTP id z4-v6mr10891639qkc.66.1529348433359; Mon, 18 Jun 2018 12:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529348433; cv=none; d=google.com; s=arc-20160816; b=HKaGEwOCPXLlJ1DZ/iQgzqAIpwt9Lme6zeN9vACnIcdw0LGLCQAXoi4NUEyUpyEz4w lLhSD4rwqTLgUyeePhKn33FckU4UfbkAMfIeGUwkqC5BLsXUAS3fbJb6G7EQ4fCZjVWr suZa5jU/lRtjV9M5qy3Q0tE7hz5UTZ7AUyZh3ykkGuBXKAA8fYdk36Yfrl8j8toKFJJ8 11CEfbi4gJZfO0kBJEY1K5bqeOT9wp4C5Az9sTQWnBPTPCZodz/OA7VXte8BKgPfTHFc IsCSRx4X9nk8U+tJez/DUUpmnMIs7HFcPX9uW1hVjHjkkV8E3/1kIi7RFXYpPpjyvZrh nOFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=ZBFXVHb8oEn5W3bnIqvhmT0QND9o29BCX1TtsvICkS0=; b=j07y+qwWulfJSRFA8tcTn3uQUmUfQgHyjZr/jNKzr2M9B4x0szmiQUsXIq+NDL8i9M RYDcUE0CAvocg+yBF7jne7KJxVXcJz8yjaRV2XTOuF5CIOmE9X0v0LWVvTuoJpX/wb8k vwG3GwLCPaCwv/vEvu+ThghyvcyfUr39OX3tS3Yvi/rDuiTCCfGsJPHIyJWZlXBjCBdb Cyjn17NlvrG6oOzM/MBRqWS7JjTb+fe4jsWx0cP+0MQkR+YGAnNVNbLhhb2XRjl0vVc/ 41A+39cQ34dGHAXYiWaM4JQI/REc85LzkX2fPxkzGCHYClgswjqbNMQ7BFBFr6vOsPXM k0KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=c9qdcke3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id u3-v6si1542832qte.53.2018.06.18.12.00.33 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Jun 2018 12:00:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=c9qdcke3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUzOC-0002Ed-Pg for patch@linaro.org; Mon, 18 Jun 2018 15:00:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57455) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUz5f-0003ZI-CX for qemu-devel@nongnu.org; Mon, 18 Jun 2018 14:41:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fUz5c-0004wE-7V for qemu-devel@nongnu.org; Mon, 18 Jun 2018 14:41:23 -0400 Received: from mail-pl0-x234.google.com ([2607:f8b0:400e:c01::234]:45151) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fUz5c-0004vS-1J for qemu-devel@nongnu.org; Mon, 18 Jun 2018 14:41:20 -0400 Received: by mail-pl0-x234.google.com with SMTP id c23-v6so9486822plz.12 for ; Mon, 18 Jun 2018 11:41:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZBFXVHb8oEn5W3bnIqvhmT0QND9o29BCX1TtsvICkS0=; b=c9qdcke3dvmYy1K9qFBdbpRHj7ch8lUZC0i5uq/XmVaDWwqqlI0DLJS2SjQbUJIHCn bV2Ve0wtEHma+p6FczvnP1uiAV30dD97YlYAy8R6nYuPs/3HBFxWw9gVbzFrRE8TqO8y md3Q417q+YSq42eYQHnlF0da8RPHypNWrklIQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZBFXVHb8oEn5W3bnIqvhmT0QND9o29BCX1TtsvICkS0=; b=g8GyV7tL8bpnyhafX5kWLWTpK71dTqgf9Sdg+sVrEGg8lZakMRN8o3zpmrgF53s+D+ FfADy6vbjaHGgOGoej3Mo6e98Pkxxi3AWizhd+P8qsupPzplys17Q/Ot4WI9c5776aSh zjmzaBb2Za/FTRy/Mjq4d2JysBplU58IEdFGnth8F4gWhqkxkWVxycfFKiQOPGpKxNAw C6nwP5nuj6X899lFRVtOi2tWHNXuoXJeKoMT0G3sZo4pa+CbbECfeO67DkSowEvKlG59 qm3CQwnEF0P3y5H8bD6K3A3kK+FboXTCb1Gng13tQBRBTQHYNpK3QjJMlCzAe+mqRAbs TtvQ== X-Gm-Message-State: APt69E0D9GvLkZzIugtqYMrB2u0odMcCSmIBfjlneIB2EWzYl+p+oeyY +Vz0XtcTcw7yVBDSDT8vftmZyOeaalM= X-Received: by 2002:a17:902:6bc7:: with SMTP id m7-v6mr15591274plt.162.1529347278797; Mon, 18 Jun 2018 11:41:18 -0700 (PDT) Received: from cloudburst.twiddle.net (mta-98-147-121-51.hawaii.rr.com. [98.147.121.51]) by smtp.gmail.com with ESMTPSA id i65-v6sm49457254pfd.17.2018.06.18.11.41.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 11:41:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 18 Jun 2018 08:40:40 -1000 Message-Id: <20180618184046.6270-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618184046.6270-1-richard.henderson@linaro.org> References: <20180618184046.6270-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::234 Subject: [Qemu-devel] [PATCH v2 16/22] target/openrisc: Log interrupts X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: shorne@gmail.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/openrisc/interrupt.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/target/openrisc/interrupt.c b/target/openrisc/interrupt.c index e28042856a..138ad17f00 100644 --- a/target/openrisc/interrupt.c +++ b/target/openrisc/interrupt.c @@ -32,6 +32,7 @@ void openrisc_cpu_do_interrupt(CPUState *cs) #ifndef CONFIG_USER_ONLY OpenRISCCPU *cpu = OPENRISC_CPU(cs); CPUOpenRISCState *env = &cpu->env; + int exception = cs->exception_index; env->epcr = env->pc; if (env->dflag) { @@ -41,12 +42,12 @@ void openrisc_cpu_do_interrupt(CPUState *cs) } else { env->sr &= ~SR_DSX; } - if (cs->exception_index == EXCP_SYSCALL) { + if (exception == EXCP_SYSCALL) { env->epcr += 4; } /* When we have an illegal instruction the error effective address shall be set to the illegal instruction address. */ - if (cs->exception_index == EXCP_ILLEGAL) { + if (exception == EXCP_ILLEGAL) { env->eear = env->pc; } @@ -60,8 +61,27 @@ void openrisc_cpu_do_interrupt(CPUState *cs) env->pmr &= ~PMR_SME; env->lock_addr = -1; - if (cs->exception_index > 0 && cs->exception_index < EXCP_NR) { - hwaddr vect_pc = cs->exception_index << 8; + if (exception > 0 && exception < EXCP_NR) { + static const char * const int_name[EXCP_NR] = { + [EXCP_RESET] = "RESET", + [EXCP_BUSERR] = "BUSERR (bus error)", + [EXCP_DPF] = "DFP (data protection fault)", + [EXCP_IPF] = "IPF (code protection fault)", + [EXCP_TICK] = "TICK (timer interrupt)", + [EXCP_ALIGN] = "ALIGN", + [EXCP_ILLEGAL] = "ILLEGAL", + [EXCP_INT] = "INT (device interrupt)", + [EXCP_DTLBMISS] = "DTLBMISS (data tlb miss)", + [EXCP_ITLBMISS] = "ITLBMISS (code tlb miss)", + [EXCP_RANGE] = "RANGE", + [EXCP_SYSCALL] = "SYSCALL", + [EXCP_FPE] = "FPE", + [EXCP_TRAP] = "TRAP", + }; + + qemu_log_mask(CPU_LOG_INT, "INT: %s\n", int_name[exception]); + + hwaddr vect_pc = exception << 8; if (env->cpucfgr & CPUCFGR_EVBARP) { vect_pc |= env->evbar; } @@ -70,7 +90,7 @@ void openrisc_cpu_do_interrupt(CPUState *cs) } env->pc = vect_pc; } else { - cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index); + cpu_abort(cs, "Unhandled exception 0x%x\n", exception); } #endif