From patchwork Thu Jun 28 03:03:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 140386 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1645024ljj; Wed, 27 Jun 2018 20:06:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfgLGJMk3zBw08FG4PVTEE1AkUNlJL6mB+p+wY6g+0meBxYyfW3JDa9zkX2hF7X+oZO0gsr X-Received: by 2002:a0c:ac85:: with SMTP id m5-v6mr7188871qvc.197.1530155203055; Wed, 27 Jun 2018 20:06:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530155203; cv=none; d=google.com; s=arc-20160816; b=d3pmG01qE/qfdXORgpO2CIT/xVkj7lfFxkVvZNvVPzsvutyZr4j+r37yNEGD/ceNV5 7XPAJBNZxJq3kje/htFRb1D7mZabEIrXFvySP9eXFKe9+4lt4+9gMcJCRHDSB3pOIA2J hzr68Fz/5jhvkUipZqaulROaOYGxGKqj/Ry2TXMlaRKkw1TCQOKpcmi6FVq4GNyoQzx6 Ytug2pp+R0UVwXWxMT/ctl4B2IOUp2n6DvME6q/4PSaj477XHe8HBQ4Qc6Pfpj+VCs6O vTDYeqne+N5uvvnsfuRNgZfl75TzQ54NU5cNLSORcZsoCEokVakRy23M8358NosShpcQ KtCw== 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=gdll25WvOZuztr1hmk/CT+S5g3LKYtpRoC2GPEK/peQ=; b=KJg7vSeAvhyTJDGGzn6LtvBLMi4kb6QE6KTjLQ0V2v+RVj1J/d0of5y2OkF8J8HxW7 nt45UYaCD9JU8JJniJNnh70qmkj3pr2JbLeUIYf0i5FxnGeAYXJqFylfQSWSEshw2Nqq NQCbmzJmKMkrBJZzlNsJZj/lqYBbk71vCOP+Kl9ID2fVdhH9nX1XfsbSguVRomwot6jA 6b8zZoXd5b7DtNdzlAqK3wWkp/rt4KGrCiY7TVbQw/ZtdjmAOAXK1mcBAG7ZqRf2VbbG iCJOMce2lFhR4wyYiCCMG6qsCmUF7PzGi4lHKjOBr6rmPw2SkcAW9SybUwWRqQ+S/hvE HdHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UkrJvCWh; 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 n128-v6si5035314qkd.20.2018.06.27.20.06.42 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 27 Jun 2018 20:06:43 -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=UkrJvCWh; 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]:34246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYNGc-0006Hh-D3 for patch@linaro.org; Wed, 27 Jun 2018 23:06:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYNDf-0004tf-Hw for qemu-devel@nongnu.org; Wed, 27 Jun 2018 23:03:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYNDe-0007dZ-85 for qemu-devel@nongnu.org; Wed, 27 Jun 2018 23:03:39 -0400 Received: from mail-pf0-x235.google.com ([2607:f8b0:400e:c00::235]:35360) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fYNDe-0007dB-2M for qemu-devel@nongnu.org; Wed, 27 Jun 2018 23:03:38 -0400 Received: by mail-pf0-x235.google.com with SMTP id c22-v6so1891881pfi.2 for ; Wed, 27 Jun 2018 20:03:37 -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=gdll25WvOZuztr1hmk/CT+S5g3LKYtpRoC2GPEK/peQ=; b=UkrJvCWhxGV/2o6iO17EzCzdaOdV6NsSk54F6o6NJ28hbU9V5RCmYki8k8ZK9+O2QB 7c0eeMVGqES+8cvLoS9WL6i/IL4rAmY8tlUSQN90Rl96rue2K0vwIQnhf2kxNCEH1kAM nv3cdX9pH6e+lkw5/yBWUMlAk49i/Qnec3ytQ= 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=gdll25WvOZuztr1hmk/CT+S5g3LKYtpRoC2GPEK/peQ=; b=OugAOuHzNz76ePowBZf13RYGGHEl8KkDqsx6W3YKBlCa/pKlu8TFRVVsmW1a3FA6eX JckblQwNk/1pjLXTjH3wKHBkcC36cRztvSe5Z1Yn8dNdh11zVgRrV4sZxDbT/1D+mpWE jocT886Ew4CaA9RTUqCccWs+XslC42zedQKv5GAL6QEnWvn7oYYdkvNFAV14SjCBho1P yB29g1cTG8Pium8Lkf8EedAlCWyVVAxi9OhR8HmOr5NG8SysAK1r3RfjNEUHH85hbaU0 QQHwAaUZg2qnDgZQ0pp/qkbwt8NDqKc9EGYe+p1s4L2WmvlrxgBzMNR/OvwzWWZBkL3D nWtA== X-Gm-Message-State: APt69E3iw48cJ1XhJUmUM1NoJ3/NVyioeurpYvSHODWXW46McQuXSeX5 l0uWfHyFhtRNcCa3eIsQEBsDwWPZ+Dk= X-Received: by 2002:a62:4395:: with SMTP id l21-v6mr8454307pfi.196.1530155016706; Wed, 27 Jun 2018 20:03:36 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-112-211.tukw.qwest.net. [97.126.112.211]) by smtp.gmail.com with ESMTPSA id y15-v6sm8030489pfm.136.2018.06.27.20.03.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Jun 2018 20:03:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 27 Jun 2018 20:03:10 -0700 Message-Id: <20180628030330.15615-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180628030330.15615-1-richard.henderson@linaro.org> References: <20180628030330.15615-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:c00::235 Subject: [Qemu-devel] [PATCH v3 03/23] 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 3959671c59..25351d5de3 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; } @@ -66,8 +67,27 @@ void openrisc_cpu_do_interrupt(CPUState *cs) env->tlb->cpu_openrisc_map_address_code = &cpu_openrisc_get_phys_nommu; 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; } @@ -76,7 +96,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