From patchwork Mon Jul 2 15:10:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 140797 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp68501ljj; Mon, 2 Jul 2018 08:12:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcV/DfNlXxZMDn85kkDj6gD+ssLXzqp/Czo9d/NCEFqHjpe0nkQelMDeYSj1HaDNVZsykTO X-Received: by 2002:a37:a4d:: with SMTP id 74-v6mr23224574qkk.148.1530544360542; Mon, 02 Jul 2018 08:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530544360; cv=none; d=google.com; s=arc-20160816; b=suzKzUVux4U8qndR8kxKavHQi1l+fp9k9fPcUtit0FeOWkq21texvuukatiCVTM4C+ lK6vDXdzIQfh8rGx3cYhslu4XW5AgCrSW30BLEYVxT+kwqkHomBfDOeVnIgUhcEJATGJ Fg3j3mLa/5ziRYx7A/6eNy4B4E2cm/y3K7P/LddV9EzkLLioTllbxXZ9MTw/hddeRGcX 4fnssHvkacAGFtBxlRxldjWnXIsuJbmjHGjPsWHOLNXxJFu/kkeMoTNb29t5/TOIWbvz DmQYHnLN+goWHFVG61d0TESiKDLRYv0+/p5w+tH+M6qNTaPWmiSthalLuAhN+hd/aaM6 8urA== 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=Zf+D1raeWsoWAsHnT7ef46EOTupNmWqr70cskO2ieC0=; b=uFBb2i4GME+htblZcVh3jh+DVAgHfuPAOrY3mcoIU6mWpbNzUReJsA6GwvqPrSS4zF sUU1cBYiUEHlYvOjm+xQGqwk3F0dcV8610mCPvx7u7LfLZ40k7RmbMxhBdTzD2FoUo7O eTiRpC6O3KehqcDb74bBPXVoZD77UnTCV0zZBPoGEhxMDVngUC7ywwTX+5ynBzhlpzmh uYQk3Wcd3pDvWC4hn+uyW4ih0Sfr5qasSla6K26uMBtNku+QyG+FogVbJVNZ4BWeTTK5 WGyW3y+0EQ5WLCrPCBoCXebqgxn7oInQAIlgkT3I8XhLfi42A54vVo7go0DmThjkZt0H gMQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=MpTQSJNY; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 22-v6si1138016qvg.68.2018.07.02.08.12.40 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 02 Jul 2018 08:12:40 -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=@gmail.com header.s=20161025 header.b=MpTQSJNY; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from localhost ([::1]:33447 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa0VL-0005Ae-MQ for patch@linaro.org; Mon, 02 Jul 2018 11:12:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fa0TY-0003sQ-Vh for qemu-devel@nongnu.org; Mon, 02 Jul 2018 11:10:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fa0TX-0007kM-SB for qemu-devel@nongnu.org; Mon, 02 Jul 2018 11:10:48 -0400 Received: from mail-pl0-x22d.google.com ([2607:f8b0:400e:c01::22d]:36633) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fa0TX-0007jy-LR for qemu-devel@nongnu.org; Mon, 02 Jul 2018 11:10:47 -0400 Received: by mail-pl0-x22d.google.com with SMTP id a7-v6so8094534plp.3 for ; Mon, 02 Jul 2018 08:10:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Zf+D1raeWsoWAsHnT7ef46EOTupNmWqr70cskO2ieC0=; b=MpTQSJNYf34jcHrb8f56udGO6qYca7vW47nUe7DacLY9g0VUzMFi3F52ZnaOBGBM0G JY0470xOkuxnhB8wjY1TO5D5lY9XsiCAD43+XNGo4LV2tGkGjZGN7bZKnaz3i1MAqMsX pO0MRbA+WOdld4wGhV+h786rAwsp1iDIvjBard35/JPj3HwDl6enaRNdOLD8RkkeonOU d0hhGBkQ5UvIRxSExqQFJIojAxyiY0a69k/kIpHA9vv+cBhStRSMtFxKoHqujOk2lQnK JhAZm7Bc8Ebzg+m998HaGNVeE/1DWb+b1RKUTPWsfzcmyzmwgjO0M6eAjksE4R/eRENP FGvA== 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=Zf+D1raeWsoWAsHnT7ef46EOTupNmWqr70cskO2ieC0=; b=BsbEvxe12laeZkto1qg4vkrpWGULbBepAgX1A+iQ64teuEg5dFL2vDOZap7AUqkh15 XMc5JFYAf/cwJ2oyTYagJecYvujwhE9Q5uk6sv7Y5nE7sdpyKUWE2l0Xx87/jwGD9QSG 52TOXbuNDwgp8nK8XjQNzSswVqpNyoSHJ8tDxYip+t1Mm1pounN0X8oTLxRHPxRoWZ2V FlLtnsKoaAlSHqqcOa6duYIigV9wcqVFXrLl6I0yr5rQm4vqrrPrRmu6FTW+cnZ4bkk4 cKvMfCVBUu/EUxylmSb0dO4cemdxDSV1nKz9bP3nwGh+hVajJMywE+430WWOQFuMtmjl iaFw== X-Gm-Message-State: APt69E2lzycOVkHRkChA7vbX7OSfLRnznqJg4VdWHxriFW0uMr5kSOLi eb7gEhmcvHGGNqFne2u+qVE= X-Received: by 2002:a17:902:8f94:: with SMTP id z20-v6mr25952109plo.337.1530544246831; Mon, 02 Jul 2018 08:10:46 -0700 (PDT) Received: from localhost (g90.124-44-6.ppp.wakwak.ne.jp. [124.44.6.90]) by smtp.gmail.com with ESMTPSA id t76-v6sm4073052pfe.109.2018.07.02.08.10.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Jul 2018 08:10:46 -0700 (PDT) From: Stafford Horne To: Peter Maydell Date: Tue, 3 Jul 2018 00:10:01 +0900 Message-Id: <20180702151023.24532-4-shorne@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180702151023.24532-1-shorne@gmail.com> References: <20180702151023.24532-1-shorne@gmail.com> 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::22d Subject: [Qemu-devel] [PULL v2 03/25] 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: Stafford Horne , Richard Henderson , QEMU Development Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Signed-off-by: Stafford Horne --- target/openrisc/interrupt.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) -- 2.17.0 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