From patchwork Wed Mar 24 14:30:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 407829 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp470922jai; Wed, 24 Mar 2021 07:41:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUAcFuAbORAOpibFeP0UNQt8b+EKrYIS/ni/Y7/Z1yF+vdUQHbAxJWUlh98Qoc0i9992Xr X-Received: by 2002:a05:6e02:188f:: with SMTP id o15mr3072169ilu.178.1616596872843; Wed, 24 Mar 2021 07:41:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616596872; cv=none; d=google.com; s=arc-20160816; b=hDnpSId8ctEqjfo3iWbsBjm8hN3axViqx+jQjfaH2s007fsfyT94kcdRK83VCgne65 65D/+HgnkjNfX2oe44MLe5ZxXZbMrtj70iufaT3MbPfupGfAuwwXhkNOQ+8ksA1SSzNn H6sG+EmhZWeg/b4bwgNohd4yxVyKT8Jtftb7LVCmo8ATnYwZrIDyS3pOkm3VmqPimY22 LXlTM7ODkd20eL2pCBinna4OTmoR+U4GODpd34B2gEzInCqDoD2AdzCGMZUJjfVZABmC dHBcmeI9tEQR5jEAcI/NgO8xnnnAS+IzBl0e49gpmM4BTTbKvL53cBQ0qW6zTjSrMLYG UDcQ== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ma50U0tSPKQlNSM/2UIXylhE0jwIndZoBnvcG4UWEO8=; b=u4Bgr7ACQf3U5BWR5CwOQ1KGP8rAOy9GtKARUH3Qjcpn414Jkv8jqDr863ngB3V+Ze j21Qj8Nu1rtTAfoZCaK3SHC8F2Lupedg3Yez1EdWMZjEtha4v1pyKQvwR14QCzF4uueH t75ieMC54449ATc8/mWma5Gm0br6HiGEh81qYwvQlenALjD/eSgDbZJE3sWCJPlcqniI F+fC7osm0arahz9nhVPFhWCcBuWoYQE95/6tiW7ri5NoRINyjfcxCAKWwlpMMUQxu213 1y8/v4n3OmB4LZQRm18LLLL1QIZUig/XuyQXjEEeF6FJWyN2+SAilnCDGlQ6TkqFIlom lbxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=N8xKYFey; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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. [209.51.188.17]) by mx.google.com with ESMTPS id o12si1911936ils.62.2021.03.24.07.41.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Mar 2021 07:41:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=N8xKYFey; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 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]:45498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lP4h5-0001aN-Sd for patch@linaro.org; Wed, 24 Mar 2021 10:41:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lP4Ww-0006dG-0O for qemu-devel@nongnu.org; Wed, 24 Mar 2021 10:30:42 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:52846) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lP4Wo-0007Mx-0n for qemu-devel@nongnu.org; Wed, 24 Mar 2021 10:30:41 -0400 Received: by mail-wm1-x32b.google.com with SMTP id d191so13010135wmd.2 for ; Wed, 24 Mar 2021 07:30:33 -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=ma50U0tSPKQlNSM/2UIXylhE0jwIndZoBnvcG4UWEO8=; b=N8xKYFeyoAcogtXdsFkVQaPlupP2THGf6rpxHeV1qksM8QCEiC/YLuZPpiX8cXEmRu 8mrqyffuXXTekUyIMKPOuqUgQLeLUSmQm+rsJVr6WoIk6r/zQclBDwuddhCWeh/C0EI+ kwwCUz4gjurDsqdQstUKIyhwbg9uBVoOcsTmHcAOGwvIiEdadS9Ax7M9oiavSSDrniGN QFGxmDKE6Aa6igv+YeK/o3Bjs3QzzifIQiBpmD4Tzvv0LdhrQKWi11CfWYO822O1hKG6 YwYDl5k76NhE0QLnFYdsnfSjy1qfIRyS+19YvvvVh1jbtINWgPjW+UKneI81Ft39Hp4a 8MSg== 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=ma50U0tSPKQlNSM/2UIXylhE0jwIndZoBnvcG4UWEO8=; b=W9qK2t+zH37j+C1dE0wEBhWUo7zdlnyIfajjNFeHK3z9y77cH/Y/eIB+M9tBApUTB9 y7+nhYBcHABBjx0ilth+cnbNQMhINvp4V17anZPEP8U5PyqtIbe6tSDcJJRQBsiitO16 Ao3emP98uK8rQ9h25r9Ctd6w/e/+iHC2Dnekx5fYSGILSLBDW9mTtzzRuiyM7NiO02zf XF56rwCw3vDyACSvkF1BeCvAF/EclEOi53l27Wi82UAli14Wnr60abVyoYIXS4k+BRly ADNpWNPgu+j51r++pVY5fuuVmH4IeLWDvDjgmRdMgpZD/AU7nPWu3LH9OW+i9ZeIBf1F gWPw== X-Gm-Message-State: AOAM532d2MNVc+cJY+lCHUMoiEpixS06IXQZSXQRWfWDcbIkNzjph6lj 0C+8If2M6sszxz9SCHXuVvjkWA== X-Received: by 2002:a1c:6543:: with SMTP id z64mr3248739wmb.50.1616596232560; Wed, 24 Mar 2021 07:30:32 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id u4sm3488701wrm.24.2021.03.24.07.30.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 07:30:26 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 7A04D1FF96; Wed, 24 Mar 2021 14:30:22 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 08/22] linux-user/riscv: initialise the TaskState heap/stack info Date: Wed, 24 Mar 2021 14:30:07 +0000 Message-Id: <20210324143021.8560-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210324143021.8560-1-alex.bennee@linaro.org> References: <20210324143021.8560-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Arguably the target_cpu_copy_regs function for each architecture is misnamed as a number of the architectures also take the opportunity to fill out the TaskState structure. This could arguably be factored out into common code but that would require a wider audit of the architectures. For now just replicate for riscv so we can correctly report semihosting information for SYS_HEAPINFO. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Acked-by: Alistair Francis Message-Id: <20210323165308.15244-9-alex.bennee@linaro.org> -- 2.20.1 diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c index 6767f941e8..74a9628dc9 100644 --- a/linux-user/riscv/cpu_loop.c +++ b/linux-user/riscv/cpu_loop.c @@ -135,4 +135,9 @@ void target_cpu_copy_regs(CPUArchState *env, struct target_pt_regs *regs) error_report("Incompatible ELF: RVE cpu requires RVE ABI binary"); exit(EXIT_FAILURE); } + + ts->stack_base = info->start_stack; + ts->heap_base = info->brk; + /* This will be filled in on the first SYS_HEAPINFO call. */ + ts->heap_limit = 0; }