From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by sourceware.org (Postfix) with ESMTPS id 7B60B3858D1E for ; Mon, 20 Feb 2023 16:16:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7B60B3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-x529.google.com with SMTP id s17so945040pgv.4 for ; Mon, 20 Feb 2023 08:16:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=w2gORHkSutxqEcmJXzh65z3dNpqyIkE+UORmJbmsXQc=; b=aZsYO12p/atzQg8WC4Pt2sS2ihIj69ROxx7HPFyvZ6FZtbqpsskMVPxLTqS4tDIXeg uACsOmQmjPcWqPd15w1OR3W+Z4lOR3s2Xb+UjUk3GU9C1hAakLS6kqLmWCUHcvGfxKi1 NpxM/R3kPWA4/kM8bfgJE5frMJmujWf5n7TlTvFRDiLoBniwvUj87qNwGhKpeHweX2hL FgYRZq+gJg5VGj4PnhPK+BYxPHb/YtOauatywaFmW67mwq3gJxS+BG8tBk2lLJ1UIfa2 NNj9zmlFabhllxDPnTcui+s/lQm8XV024uscHVD8yyEuYQqJN2UjZvhGNsgtft1NWARN qHiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=w2gORHkSutxqEcmJXzh65z3dNpqyIkE+UORmJbmsXQc=; b=em/qjU5KUqVFwAld+h/BYfy8F5MB+djTDVMeJyXmAs8wOs1JV0bOZqUh6/0nTX7hsh Kh8tTP9T5Qmv5zLmDhbxzt4aFXIra/BrhhZvDRPHpyDZz+yMg2OJu2HH6gO+Udp+pF0n YXedqUj+nAVsHJdA7bemZGk+HEPxvvOFuMuMYZxfMkxncb21EYvjQbOfskgDxzph3aCB zGo2H+uFpj3pVRYuTFf9mya/Pepg40nBLetk93+FmxoiXRdU81bn37aA1R+1iGsmx/aR E7HpSR4dljSvaJpE3BTHFl2BMy3+TbUMYSUUOICf3HjS0pkUXLvbiJtPX2LV/9rWrAI0 ARSQ== X-Gm-Message-State: AO0yUKWqT7W1cFnJz8Na2tPyvrPVgjJYA1IDasQX+gJZbjJlV7o3tdIg QqNLT9GMkUkbjAa++LwbSutimYdMNQVZ3Cdfg7jxK+86V+I= X-Google-Smtp-Source: AK7set+dTlwn78C8I7UpP9IR4luFEg44o54tIgFJbFnk0JnUuqKekXoXgZssghkkzTiZJownoKDdZHrb1O3nNlVPpbo= X-Received: by 2002:a62:2903:0:b0:5a8:f27e:408c with SMTP id p3-20020a622903000000b005a8f27e408cmr508498pfp.50.1676909781326; Mon, 20 Feb 2023 08:16:21 -0800 (PST) MIME-Version: 1.0 References: <20230218203717.373211-1-bugaevc@gmail.com> <20230218203717.373211-8-bugaevc@gmail.com> <20230220000111.umchmzgk4vzgpayq@begin> In-Reply-To: <20230220000111.umchmzgk4vzgpayq@begin> From: Sergey Bugaev Date: Mon, 20 Feb 2023 19:16:10 +0300 Message-ID: Subject: Re: [RFC PATCH 7/9] hurd: Generalize init-first.c to support x86_64 To: Samuel Thibault Cc: bug-hurd@gnu.org, libc-alpha@sourceware.org, =?UTF-8?B?RmzDoXZpbyBDcnV6?= Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, Feb 20, 2023 at 3:01 AM Samuel Thibault wrote: > That won't work on x86_64: there, arguments are passed mostly through > registers, so &argc won't actually give you the address of arguments on > the stack. Right, good point. I wish I had a better understanding of just what's going on in this file. Maybe a lot of the hacks can be rewritten in a nicer way. For instance, do we really need to hijack the return addresses and jump to init1 in this weird way, only to enable it to access argc/arg0? Since we know where they are on our stack (__builtin_frame_address (0) + 2 or something like that), can't we just pass it a pointer? Let me actually try just that... Sergey