Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1673094ioo; Sun, 22 May 2022 23:54:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHBkcvGnM+qlHlSsfC1NCUstbnt9s/Qy/yu22OFb4ZmQ0QePMo0/9+/vKvLB1nMG55cG7T X-Received: by 2002:a63:de01:0:b0:3fa:1a35:36e0 with SMTP id f1-20020a63de01000000b003fa1a3536e0mr6515494pgg.92.1653288855790; Sun, 22 May 2022 23:54:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653288855; cv=none; d=google.com; s=arc-20160816; b=F1r+KuKfagoRQxTxYi9gvI/Y8Y0oBcpe8JUjgQA1EEX98r0jAcQBFne7fsiRxzYCAB B8BWirMHa89D/jBydm6bZibE3pVGhgZL6v9ZkLe9sTOoV1gDUVTZ2qbOorzaAnvqm5pb ubLRdT8ZabhdKPW1bevljMjsafGV8oIg49B08FfRpVrtOlJlBA4Qwcu1OiZuvozeJfK+ hKCm+XHAx06UN7AFjVi3QbsCXZTH9LkvW5gq00+55MS2h29NZJ29DZLvsBqJFsCJvJ3K RLySXrn0b+op1dLiauOAZWbY9BkIk+ZzJ33b0s4bj/4XD+3egCS/W0tgJf3davWqiFnT EXFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=URPrkUOTksZy0vkIOlXm6I32VTQjSzL208bMcPxmSHk=; b=pOqyYzukb0mRX5XjN3Cp4Nv5GyFByjkIAu3nKXXaFx8yqmZJgSEhOp8TnBX8J22sbd Nz491LJk7yHuSYMipdiFME3YWqYnQraVY0UXuuPrmxcLGCtehGTureT9hdc7dgc8g5u5 oGajlYPq8p3s+OXehgu1BXgl0njEfzqrq0OccV+dX9Zl9QDkr5rIIIhQf090k1+DNpwN ad1C2+Yt9geRixOiE+0H2KaJStJe+mWopxUxHYVAlKEp+7ELP7VT1+pbuWovx4zIqBRw /jZDThqNhEmcYZ7S2kL2U7iiovuD/RgOiLz6fNezq+VQ+B4D/CClfz996QacmSPA9zAF d6Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MxywOSFH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k7-20020a635a47000000b003f23d76de06si9290245pgm.432.2022.05.22.23.54.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 23:54:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MxywOSFH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D0E5C579BA; Sun, 22 May 2022 23:21:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354897AbiEUNOe (ORCPT + 99 others); Sat, 21 May 2022 09:14:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353316AbiEUNN6 (ORCPT ); Sat, 21 May 2022 09:13:58 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53D735FF3C for ; Sat, 21 May 2022 06:13:51 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id t11-20020a17090a6a0b00b001df6f318a8bso13641284pjj.4 for ; Sat, 21 May 2022 06:13:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=URPrkUOTksZy0vkIOlXm6I32VTQjSzL208bMcPxmSHk=; b=MxywOSFHz7PZ/XnD//EDP0QUHLfj+as9iHe+yiq4nk06+24WLMwUQcJ27b5V2I/xsL tAISylV4H1lBAdvOk9R41xYs6l5RrJfv5iBxwFXtA7wk7oXbPgB/YdVNQ5p6XaB1bEon gBx8Yj/1ssUEJsUF4W4RBm0g977FZrkapO1+0Xwv+H9drf/J+lB7gCQbxd+zPdWcSlys uClIymNljdApPgJ6zSv2I4GYZP34o1VUqM33Botm50uW4o/7kEH12NsN4fnS4woK3aQI 7Mi4Ec8pQWSQwgqWFw7DrCTWhBQI8Lfy6OhoS6O72clVydI7yB4fj5CZFakrtgv8OsoM lq4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=URPrkUOTksZy0vkIOlXm6I32VTQjSzL208bMcPxmSHk=; b=aokrMdb/H/lyeypS36v9A4TGie7tVbnYjvmyQHAZpDNovyFpbVWAXIPrTKqVGBrn5e V3Y0ioF5RHPhhfI/OwXeqdDnbSkSf79PD8spCATXNs8ikf4vwCmUIDzv76E2kT1V9ZWv l35xDnXmvC4Xvi9NhGxxZNC7L8UXzLnRbsYwYaU7oAdL1Rzufanb9TOVxltBXVZOrPfD rNEmttN21C9pry6DY9zqzuCzfmmzp7JhZzowJH7CPKpvg7AKmUBKx62RXtTx4Pxinm3V SdBhxvFRKFJb77PnbmOlnnojJ8BqCkM0xgTWjku/Hz7OF03FOfJkSQn81N9NflHzsg6Q mq1Q== X-Gm-Message-State: AOAM530xnPIzzHMUSHn8nhbs0pGQXamLqYhCHGSfg2lehyFLSvsogfuD 1/p56trMiXo0rHr7T/x41U/m/Jz28pnwAw== X-Received: by 2002:a17:902:7c8c:b0:161:f5b4:9aa6 with SMTP id y12-20020a1709027c8c00b00161f5b49aa6mr7028272pll.79.1653138830133; Sat, 21 May 2022 06:13:50 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id m5-20020a654385000000b003c14af5062csm1470295pgp.68.2022.05.21.06.13.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 06:13:49 -0700 (PDT) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Andrey Bacherov , Jonas Bonn , Stefan Kristiansson , Randy Dunlap , Petr Mladek , Mark Rutland , Marc Zyngier , Chris Down Subject: [PATCH v3 04/13] openrisc: Add syscall details to emergency syscall debugging Date: Sat, 21 May 2022 22:13:14 +0900 Message-Id: <20220521131323.631209-5-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220521131323.631209-1-shorne@gmail.com> References: <20220521131323.631209-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When bringing linux on the or1k Marocchino we ran into issues starting init. This patch adds the syscall number and return address to assist tracing syscalls even before strace is able to be used. By default this is all disabled but a developer could adjust the ifdef to enable debugging. Cc: Andrey Bacherov Signed-off-by: Stafford Horne --- arch/openrisc/kernel/entry.S | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S index 3ca1b1f490b9..54a87bba35ca 100644 --- a/arch/openrisc/kernel/entry.S +++ b/arch/openrisc/kernel/entry.S @@ -601,7 +601,7 @@ UNHANDLED_EXCEPTION(_vector_0xb00,0xb00) */ _string_syscall_return: - .string "syscall return %ld \n\r\0" + .string "syscall r9:0x%08x -> syscall(%ld) return %ld\0" .align 4 ENTRY(_sys_call_handler) @@ -679,15 +679,25 @@ _syscall_return: _syscall_debug: l.movhi r3,hi(_string_syscall_return) l.ori r3,r3,lo(_string_syscall_return) - l.ori r27,r0,1 + l.ori r27,r0,2 l.sw -4(r1),r27 l.sw -8(r1),r11 - l.addi r1,r1,-8 + l.lwz r29,PT_ORIG_GPR11(r1) + l.sw -12(r1),r29 + l.lwz r29,PT_GPR9(r1) + l.sw -16(r1),r29 l.movhi r27,hi(_printk) l.ori r27,r27,lo(_printk) l.jalr r27 - l.nop - l.addi r1,r1,8 + l.addi r1,r1,-16 + l.addi r1,r1,16 +#endif +#if 0 +_syscall_show_regs: + l.movhi r27,hi(show_registers) + l.ori r27,r27,lo(show_registers) + l.jalr r27 + l.or r3,r1,r1 #endif _syscall_check_trace_leave: -- 2.31.1