From patchwork Tue Feb 25 16:34:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 868115 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f56:0:b0:38f:210b:807b with SMTP id cm22csp388713wrb; Tue, 25 Feb 2025 08:35:37 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU5hA/it54nFZkCs8A0Hdgippy2vOFPXbGoWWsOEy+chNUUoaguik3fh7xDTsys9AlgjH/r/A==@linaro.org X-Google-Smtp-Source: AGHT+IFVjZLYUDGr+74cCTf4LSXBRh56MPL5fOvW6HpYNBsYxHt2GtRfDk9L8WEfzgeZ9qomeUn9 X-Received: by 2002:a5d:6d84:0:b0:38f:34a7:ebfb with SMTP id ffacd0b85a97d-38f6f0b7344mr14047798f8f.55.1740501337160; Tue, 25 Feb 2025 08:35:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1740501337; cv=none; d=google.com; s=arc-20240605; b=RIndzDAFV4QszcAU0gAK3WtLtkUu0g3vMJA/XILovOijAjxOG9s/YN2zJ04Q7mIWVV belZyDnoJ6Lokd5KKCu//v3I9XTmxa3V6cRFbrudna4aY4jKEgIYcbuXBl1n8gnSlirI yyvnlGteVEHCFtHz+I42ijNZv4bOvKZvir5rO9Hq8Apso/b9DEUcSMn78sP2iQiVi/5+ SqLPIJEZ9OibkHFmP9zR3HwvAmtoljFv7HEfT/SznYxgEbO5Zv5fsjpKwsw/MYWfC5tn HD9buYdqKKcu8O/SZO3DyIfLFUtMr4qbszBnwajINnvVD+h35j9nEwTMbFz10mUbW4lM thqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FNw2IjE2pzkh8kOG8gbCKeyHG7nPC9wPKaPR6juqTg0=; fh=VT4NZvbs6JSRJgFq629DWEjP1Ykvv/xWeKwNnZX1Oxk=; b=Zse52M4ZdP8pXFEHwgyZ4g/bweNO06USkUiQqMZke4WkQJsjtQd62Dos8iZ4zoRIIz JF1QMupCsLAW64dFux0RAVEqxQc7LzjwlC0Fci64BDN9YGw9aWxMc/esxpbKMhW3ZU++ O5OTG37BPcezIMmvczSuSLddJgijsvJWlV8Heq/nbEZOpksWBuuxqH+JCbvQAGMmbhyx 1YCJxH/Wy5xknijWDNOhU3/5HIlBfNW8Xk+/E7KwAH3nl0u40Do711x5FSkocZ4Z0i9u 2hu0f776ZwiCgl7xtmLVnQ9/w5+aqWtSq/lP5FFifvHcV1kI45Eo6LnQ3sd65yuXHfSe WncQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dGG5pYTU; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 5b1f17b1804b1-439b02cf73asi66273945e9.47.2025.02.25.08.35.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 08:35:37 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dGG5pYTU; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 066D980FE1; Tue, 25 Feb 2025 17:35:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="dGG5pYTU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C521B80F7B; Tue, 25 Feb 2025 17:35:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CA04A807EE for ; Tue, 25 Feb 2025 17:35:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-43aac0390e8so14719715e9.2 for ; Tue, 25 Feb 2025 08:35:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1740501313; x=1741106113; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FNw2IjE2pzkh8kOG8gbCKeyHG7nPC9wPKaPR6juqTg0=; b=dGG5pYTUnI9S9aeX/yOXlFBuBqrscI3j/fJSowSKrk2sZJ14AAq8k94n8kI9UjF/Ds 173g8+aeRhCjjkpBj9oYW9C8jP5yKoQKYeqdXyoDMLDSAIhBHO91UIlwZQyNd1M4mwzz FidIXEjXqcJt1T/I+pUMaIqAka8FJTSLkrUaFYhPbXVvYawZ2peVbm648cRqV3gKQSSb 4Cz1LV3LlyFteWYZElbUKXSRnoVcPnWlUtQrerEc74LrXQvuipOXCPcE3KAP7gRBiBa+ Npv+x0TJ9jA97E/TImtcK9Vt+6gX+lWAQhwawdqaL4BmJNHVrsUEFL+GHDufcOXtsJKl BXKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740501313; x=1741106113; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FNw2IjE2pzkh8kOG8gbCKeyHG7nPC9wPKaPR6juqTg0=; b=qjR1vy71y8aeQ7Hjqg0OueAmMQ72KF5M4wSzfs/v9iNTi+q2hJB9oXt6Xa/y6PqrgG Mi3azDZPEdN3aSIa9LEzzGGH/nAgSMV+cX8AJl8u6YNLRUdB1Xzr9FyuhnDmVoiKcKc3 R7NuGpBenUOWMZOX8JqodbxxGHuhMjv/NXgeDJkIEaMk7gG1wqkfEne9cEk1i76J2axx 1DITMf9D6QLjTGHkw5UgpkfGOx8+UVFz9SFo9EnrO7kvIUQirfQcdJ1O1rtaLGmpt+lw +GoF8QKF+ZX53kIFiysoIbwRdBKEC9w1wxad+hgjNsjBj7rOraxiZTLScO2Dgsn7zvd9 QgIw== X-Gm-Message-State: AOJu0YzzR/20nVr22rqXaH/iMA94ZwXpZf8QJPYHx7/R2E4HDY3P0PsO GxiJrDO7rddxKUctkfxYfVewEfGHA3bL2FUNhzmQQM9yPqCT9righh0COzuMLrvobXE5NrpiZ2M +qQ8eVA== X-Gm-Gg: ASbGncuHQ2TIECNPJoF+a0hSkblOoiiDpXq9C0WdZ7YtAAeKE+bIGtbX+Oc2ST6C3Gt 9vz0PIZnTSoeYdhm91tuD/vEP0blDw60p/anvUunc6z+Rys2mj8v1hOXHGq5EGir603hna0LyxO IZBm99qL0Kj4PjZhKRYPfz28dpCl5I3ri2b4m7LZv74yc6GPP5wjKCd39whIqAGFRfcfwIG4GiU fmUFjAcOrX2nsc8b6KSNnNcpGWLm6fUZKQVjhd7UonSUe1YFP4ar/vOwN4EDi1CAFRO4WTY2kx9 zdZ+PeUBfvdy11yYk2kfXe8Za22gI9VKX68= X-Received: by 2002:a05:600c:3582:b0:434:f131:1e64 with SMTP id 5b1f17b1804b1-439ae1e960dmr140911985e9.9.1740501313059; Tue, 25 Feb 2025 08:35:13 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:af71:dfb2:66ef:80c3]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-439b02ce735sm146356195e9.3.2025.02.25.08.35.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Feb 2025 08:35:12 -0800 (PST) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Jerome Forissier , Tom Rini , Rick Chen , Leo , Dan Carpenter , Simon Glass , Heinrich Schuchardt , Yu-Chien Peter Lin , Jiaxun Yang , Andrew Goodbody Subject: [PATCH v2 03/14] riscv: add initjmp() Date: Tue, 25 Feb 2025 17:34:29 +0100 Message-ID: <16aa0caab1aa196bb19e5e9b1c837b873e1beadb.1740499185.git.jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Implement initjmp() for RISC-V. Signed-off-by: Jerome Forissier --- arch/Kconfig | 1 + arch/riscv/include/asm/setjmp.h | 1 + arch/riscv/lib/setjmp.S | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/arch/Kconfig b/arch/Kconfig index 57695fada8d..b745222bfbe 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -152,6 +152,7 @@ config RISCV bool "RISC-V architecture" select CREATE_ARCH_SYMLINK select HAVE_SETJMP + select HAVE_INITJMP select SUPPORT_ACPI select SUPPORT_LITTLE_ENDIAN select SUPPORT_OF_CONTROL diff --git a/arch/riscv/include/asm/setjmp.h b/arch/riscv/include/asm/setjmp.h index 72383d43303..98ea157eb3b 100644 --- a/arch/riscv/include/asm/setjmp.h +++ b/arch/riscv/include/asm/setjmp.h @@ -21,5 +21,6 @@ typedef struct jmp_buf_data jmp_buf[1]; int setjmp(jmp_buf jmp); void longjmp(jmp_buf jmp, int ret); +int initjmp(jmp_buf jmp, void __noreturn (*func)(void), void *stack_top); #endif /* _SETJMP_H_ */ diff --git a/arch/riscv/lib/setjmp.S b/arch/riscv/lib/setjmp.S index 99d6195827e..6f952a16eee 100644 --- a/arch/riscv/lib/setjmp.S +++ b/arch/riscv/lib/setjmp.S @@ -59,3 +59,13 @@ ENTRY(longjmp) ret ENDPROC(longjmp) .popsection + +.pushsection .text.initjmp, "ax" +ENTRY(initjmp) + /* a1: entry point address, a2: stack top */ + STORE_IDX(a1, 12) + STORE_IDX(a2, 13) + li a0, 0 + ret +ENDPROC(initjmp) +.popsection