From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 95D7D3858D28 for ; Wed, 3 Jan 2024 08:18:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 95D7D3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sifive.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 95D7D3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704269884; cv=none; b=icGrpsG15XEyZarM5ew87m/gzh1CHRVOcN8KJ0/Fip7VOv9+SEsu50QBKpWSwkg/0UDiou3daN0pHPw7r3g2111AVFktkodEZLqSd9KJPnOgb+E1cAcYZBt+9tvKSudz9bfJATS372dTTFTehwotbIRNf/16bbYgTLW4ZN1InSk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704269884; c=relaxed/simple; bh=K2JYycRtP2h7iqXzbF4L9c+SnK/+FOgrss7ZWaue+LY=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=Pk5rCYY+gOqRXAMZWcdCpzhg1+E24a0BC53FmA/1CBMGkeJFfeeQEMde+VR12Zi/OFxZXRpao31Sm/6iKhrd4MpIttSofBaGyNfmQqKWRerm6FO/jEWU8BFUdtmtgONabs52TVuOA+TjMk7xJw2pBumDgsqc2qR6o4QAsJRzg+Y= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6d9e62ff056so5021721b3a.1 for ; Wed, 03 Jan 2024 00:18:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1704269881; x=1704874681; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=qez7IZw08pAe5+/vYqpBPlhUxPqgpbKAPm32aK52+u0=; b=db4IGqWU85Y+kyRRjpLrPUgOE6yntBTYBiMxgDes9f5gP1+hjc6FBG1C0IwPf6HOwO GTAWpixI8niNV3A4OcHoqGexxAa8FD6t1Ezv812nmv9QoibzidqAeDuT4pSr5s5E8Lym DLCf7aQiiRjIzri4nU3nJQW/s+wfhuMbMyoIxJefQCOlUdskMF96PXw46ZG7CpChmxYi IJBmHKjUigZXEqQispgLbBh/Vg0R6aK4oHOQetZFfxWgwVdiFXpBQLRPw6y+3U0W6nIu fhrXFn8kt2iIYylFGB5sND6Xg+LIm6mjvO3ReywviGHryglYbxMWBU0vlqFJAcCLVuyI /wsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704269881; x=1704874681; h=content-transfer-encoding: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=qez7IZw08pAe5+/vYqpBPlhUxPqgpbKAPm32aK52+u0=; b=RIoSYVUQ25qAoOI8jaug8oj30gSOXi9fFDuR9EEU49f4xdl9qCBmDUVMKzUtvFWKLg A5ppNWRr5Y+/mDl7haqI9vr0MXD9YBe6Za6uhp6fXI+n/DxiNTEH+8uQNKVW16zjYe3t qLHIBAwmU3ko5PBfU9qJ6iLjuCfF1gy8LG26CRJ9+9gtUCDijVqBR6BZ8EEQTFp/52XU ovAsJnvykZnHYRMF+YyA0u8bMv1NTi2e7ntWhaRHo0EsrxKxPwBVrkhJBps35p277BTv FeL2ExO5dfeY9V3X0qfEQp+7c0JD/jM8a6hoFemu50JVJLKRNI9lO1m8KQWD1kt2/XY/ Pybw== X-Gm-Message-State: AOJu0YznsRouAqrWQhq53hKNJhqlNNSvb1u2/m/ktS6aGEnYuLLrSgpV 9hGv+yZsu5Qhyj7MYYLiniYStChmaZH7XyUmvjD3L6H2x1iX8zK7E/ZsO4rLtyJogQ== X-Google-Smtp-Source: AGHT+IGf0541mn50L/PB2/c7Lg9DT1PrnlqZG+alJyUEHhf4uIW4mL4SQdwqNrVmcsaRTwsXm+6xC2Qcpcl0BSB9Fxk= X-Received: by 2002:a62:e504:0:b0:6d9:c70e:acd3 with SMTP id n4-20020a62e504000000b006d9c70eacd3mr11782015pff.39.1704269881496; Wed, 03 Jan 2024 00:18:01 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Kito Cheng Date: Wed, 3 Jan 2024 16:17:50 +0800 Message-ID: Subject: Re: [PATCH] RISC-V: fix setting up std streams in init_semihosting() To: "Ram Nalamothu (QUIC)" Cc: "newlib@sourceware.org" , "craig.blackmore@embecosm.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: The change seems weird to me at my first time reading, however it makes sense after reading _open and __add_fdentry. So LGTM, thanks for fixing this issue :) (BTW, I don't have commit right either :P) On Wed, Jan 3, 2024 at 4:03=E2=80=AFPM Ram Nalamothu (QUIC) wrote: > > Without this patch, the following simple test would fail to run as expect= ed. > > #include > int main() { > int n; > printf("Enter a number\n"); > scanf("%d", &n); > printf("Entered number: %d\n", n); > return 0; > } > > If the patch looks good, could someone please commit it on behalf of me a= s I don't have commit rights. > > -- 8< -- > > Currently init_semihosting() assumes the return value from _open() > call as the file descriptor handle and that is incorrect. > > The semihost _open() call returns the fdtable index returned by the > __add_fdentry() for the file opened.