From patchwork Mon Apr 26 02:53:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 427489 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp3321799jao; Sun, 25 Apr 2021 19:54:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOHDTV2I2T1wPzBOUFvzQJiVdlIVayWlDe2pv/GefDEG0r3dgOyD4A5yiMexz9H6qGrIau X-Received: by 2002:a02:7f86:: with SMTP id r128mr14305208jac.136.1619405653986; Sun, 25 Apr 2021 19:54:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619405653; cv=none; d=google.com; s=arc-20160816; b=swEmLAmkiYoY3601L+lAbFEzz2wmIyZqXJ0SQpzdWpKUwIH7+aXrnCMoKAoLtauUJe sMX4SQN5TQzOcm6zAjnY8WkscH5aU1FleMBmRDaX1LuFvudCiUTCzjokGorZ2gznsX1T UISjZ8GdWQAdAuVkv2i09llQgUix0rHwGe/TJYVU1Pbad5M+mzZnfxMXW2fIigYf8eN5 YyzrndDLUKyN/Azec8zZcTRT2qKXQaNguTOnj1U8Vz+16QzDclvTrlK8NBpVT1ZAfZrp 7VSWC/KIweQznsfUH0xmPgSRsLOIcx9d7Y4qtr8x1w4vKXNUTrB94+Q5pcHbGo5yYriL dwwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:to:from :dkim-signature; bh=KAt4KJIdZ2Rn7oZ7gMKlRXoCjHm7a4NbLhrIC4Pyqtg=; b=c+1pHqIH9DccB9miKCQIuROZkaLwp5XFHq0aYQncJhECy26xJwO0v43psPpXRnT98N fbAcfIGmx+yPsx0XGmh2vqTQORt+Slv0yeAMYUfHTpCiZ1xs+k6NoibVN3gvj9CUMXSF cFUU1o4Gy+82ysq1ufsMaXhGaOrarW1jQti4m0wxlcN0XJ5h+6R3GYB5V3T5l0/yBWFk 92AISHl1zh5qipbaH3eK2MvldD9ZJWJ78PebMHcbOxSwOr66rMPtkoSrHNG98X4XXbLK XVylnoMYxly+D9S/vOiEd+lkLDxKozjbewaDx2wA65oQX9fAr6xGIubwmRv/V/Or88C4 PGEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HFvd6fwH; 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=pass (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 q1si14935212jaj.82.2021.04.25.19.54.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 25 Apr 2021 19:54:13 -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=pass header.i=@linaro.org header.s=google header.b=HFvd6fwH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1larO1-0007vS-D7 for patch@linaro.org; Sun, 25 Apr 2021 22:54:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1larNa-0007ta-Fz for qemu-devel@nongnu.org; Sun, 25 Apr 2021 22:53:47 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:34693) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1larNW-0007YO-ET for qemu-devel@nongnu.org; Sun, 25 Apr 2021 22:53:46 -0400 Received: by mail-pl1-x633.google.com with SMTP id t3so846688plz.1 for ; Sun, 25 Apr 2021 19:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=KAt4KJIdZ2Rn7oZ7gMKlRXoCjHm7a4NbLhrIC4Pyqtg=; b=HFvd6fwHj1g4Yp7MCdvzD9Y8L5ZpmoEWJtxUQrHIKHeRmfzsnL3VhCWTTLrx6Crw62 neDZu9J4daGPUMhsp5qq6oVwDpU9W4L1VgopkY6TfPhZAEDhoJXIqJCdE05v7qlyTvBL fZkQXJVkcOuxgC/e4jNN6jS+Y1Mj5Ym19zqalgDVbChkGhDMW+hc4TUhHvSs/oly6Ny0 ZPrrNmFHqgG264bHju8tg82qTH4ST8jwcaP75ixIY/MH8J0/Q5r6CzmDQt0utv/attBl Ng7X13elyh2swBMSa08/ZF2Y3cjlZVQgPr1T1YnHdmfBzBvw+Il+R/OAahayZYYOZvA1 YkpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KAt4KJIdZ2Rn7oZ7gMKlRXoCjHm7a4NbLhrIC4Pyqtg=; b=bTChE62cy7t1EDqxtu/q8sfLZwmaPvyR4yeRb0IZgZOOhqd32LNWzA3mo0x1XOK/rt u7gvWvDGPiwNkI1jJqhdgzMDcEs8fcfvdFFlhZkW8qC2MWP8dCMRGk2kyC5BEo9xq9MQ MkUhm3b/n4zBXW+yFGOj7eHr4iyxaIkj2tZrQIyufcYHcb3vWBgpOt9sJN7dVXTHHUgQ AWkoubZ3JOxz5kgQPGSC2kGsd9WZXb3jY55p4bhY9YHXwNhSKSG4Zegu+NHBDeyRA+87 hBaHrDtbcBFHJYiFbIEY+LA+GfOP0A1MKCFpZ2omIJ9P4Wo3L9JM3PqZyNAxWB3mLQ9F LMJw== X-Gm-Message-State: AOAM532bAZzVzEew0rmLF3GBUwQ9iCBUeEffyXPA0PoT3gq6zyHXbRXn g5c+NC3PC+Y1bFz36YbdIxVlWfaO0mdlnQ== X-Received: by 2002:a17:90a:f2c7:: with SMTP id gt7mr20634352pjb.157.1619405620837; Sun, 25 Apr 2021 19:53:40 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id e23sm9805680pgg.76.2021.04.25.19.53.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Apr 2021 19:53:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 06/25] linux-user/sparc: Clean up init_thread Date: Sun, 25 Apr 2021 19:53:15 -0700 Message-Id: <20210426025334.1168495-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210426025334.1168495-1-richard.henderson@linaro.org> References: <20210426025334.1168495-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Share code between sparc32 and sparc64, removing a bit of pointless difference wrt psr/tstate. Use sizeof(abi_ulong) for allocating initial register window. Use TARGET_STACK_BIAS. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) -- 2.25.1 diff --git a/linux-user/elfload.c b/linux-user/elfload.c index c6731013fd..cd8b81103f 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -663,48 +663,25 @@ static uint32_t get_elf_hwcap2(void) #define ELF_CLASS ELFCLASS64 #define ELF_ARCH EM_SPARCV9 - -#define STACK_BIAS 2047 - -static inline void init_thread(struct target_pt_regs *regs, - struct image_info *infop) -{ -#ifndef TARGET_ABI32 - regs->tstate = 0; -#endif - regs->pc = infop->entry; - regs->npc = regs->pc + 4; - regs->y = 0; -#ifdef TARGET_ABI32 - regs->u_regs[14] = infop->start_stack - 16 * 4; -#else - if (personality(infop->personality) == PER_LINUX32) - regs->u_regs[14] = infop->start_stack - 16 * 4; - else - regs->u_regs[14] = infop->start_stack - 16 * 8 - STACK_BIAS; -#endif -} - #else #define ELF_START_MMAP 0x80000000 #define ELF_HWCAP (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | HWCAP_SPARC_SWAP \ | HWCAP_SPARC_MULDIV) - #define ELF_CLASS ELFCLASS32 #define ELF_ARCH EM_SPARC +#endif /* TARGET_SPARC64 */ static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) { - regs->psr = 0; + /* Note that target_cpu_copy_regs does not read psr/tstate. */ regs->pc = infop->entry; regs->npc = regs->pc + 4; regs->y = 0; - regs->u_regs[14] = infop->start_stack - 16 * 4; + regs->u_regs[14] = (infop->start_stack - 16 * sizeof(abi_ulong) + - TARGET_STACK_BIAS); } - -#endif -#endif +#endif /* TARGET_SPARC */ #ifdef TARGET_PPC