From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-vs1-f42.google.com (mail-vs1-f42.google.com [209.85.217.42]) by mx.groups.io with SMTP id smtpd.web11.11786.1687356980607181107 for ; Wed, 21 Jun 2023 07:16:20 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@gmail.com header.s=20221208 header.b=iBcCEBet; spf=pass (domain: gmail.com, ip: 209.85.217.42, mailfrom: pedro.falcato@gmail.com) Received: by mail-vs1-f42.google.com with SMTP id ada2fe7eead31-440cff7870aso721281137.1 for ; Wed, 21 Jun 2023 07:16:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687356979; x=1689948979; 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=V8sWykDPgMMqIUmklwHKftl7RBWOF1C5N2wFsVKbero=; b=iBcCEBetPoCusZt+bKhVXajZtRaLaZzS3JpeYHRKKUxSZm8zolzDoNxcYhQiiYvhQc vJgjxLpKIk8zzErrEoax8JshblnN6FxGuYY4RqtfSfwKKoOwAr2lceWORC3vOCdkZwPP QBg/qkMs9SX9QE0SDxBfqHfO/xmQiEDPFxVB0zspWJ/Mg97yEf7XKSTtA2BXtouhH/cd 1mFKXtKerr9UGe6AzNYLa4swWLivPzJfqm8y/jO7Hik+uFe2+WchwFTmr5cnnku32ujb f8Hf++NXkphJDSWc+w+OWnc+lWgXPB4zgGKa9AmBbUB1jrY1SWsuhfnF2xpoqCxwfA94 GUvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687356979; x=1689948979; 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=V8sWykDPgMMqIUmklwHKftl7RBWOF1C5N2wFsVKbero=; b=KJJPZnTX8yn1oRhd+ujUcEWinngyNagnWGQwt+AZ3FXYWAw0zEgij9iW+yXVXQY6eT Xz9Hw+J070rFlwjK1nz/i2nTY6dDQP3FhxM98uBA+vf9mjN96tgi7hD0zUSomFoiuecF HNJQ/rutusRZYx88Nk0HpXzSFHR7IIDLY2yP5fMXeaDi2xtdBo4avAd6gIq4kiEtSB1M NeQiPJfJO34ZkArwUmKmKvEEvdhqMyq5E6Rs/7qcPXy/KnB+08c+27EubWGSvnihiSs/ atBZQQiUSG7JkUMc2Ein5mPN3UKagb+ejoz3zNzTex2k2VEyk1oja+koOyurkIINU+wi SKXg== X-Gm-Message-State: AC+VfDx0ktgonlP+NaSyBniYQIDVUU+HUt880PlN0xqho6gDzBL9T8oF utzZJRbi8Llys8o1JkyXk8O6Ak08LuCYHO0uXMr8lTTLWIw= X-Google-Smtp-Source: ACHHUZ5Pgha2CAFXnuObc5pQEYOGbbcGDlUNe7X9cq8wX9kPlPLwK7d+A3m6VHOmPyaKhev5rNukwdy6QYhqefYFlug= X-Received: by 2002:a67:e00f:0:b0:43f:5fcc:7eee with SMTP id c15-20020a67e00f000000b0043f5fcc7eeemr3892010vsl.8.1687356979593; Wed, 21 Jun 2023 07:16:19 -0700 (PDT) MIME-Version: 1.0 References: <20230616072257.1989-1-gavin.xue@intel.com> In-Reply-To: From: "Pedro Falcato" Date: Wed, 21 Jun 2023 15:16:08 +0100 Message-ID: Subject: Re: [edk2-devel] [edk2 PATCH] MdePkg: Use same ProcessorBind symbol define for RISCV64 To: "Xue, Gavin" Cc: "devel@edk2.groups.io" , "sunilvl@ventanamicro.com" , "Warkentin, Andrei" , "Wang, Yimin" , "Sheng, Alan" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jun 16, 2023 at 4:52=E2=80=AFPM Xue, Gavin wr= ote: > > Hi Sunil/Pedro, > > 1. As you know, ProcessorBind.h file of CPU Architecture file declares se= ts of base types for edk2 code compiling. > So data type in edk2 code doesn't rely on specific compiler (msvc, gcc et= c.), which is a good design. > > But in practice, for the purpose of reuse, some code can be built with ed= k2, and also can be built to a standalone application (e.g. Win App). > Just like below code piece: > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > #ifndef __WRAPPER_BASE_TYPES_H__ > #define __WRAPPER_BASE_TYPES_H__ > > // > // To avoid definition conflict during EDK2 build, it must include > // ProcessorBind.h before xxx.h > // > #ifndef __PROCESSOR_BIND_H__ > > #include > typedef uint8_t UINT8; > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > In this case, if this is a edk2 build, the code will refer to data types = from ProcessorBind.h, otherwise, it will refer to stdint.h from compiler. > > 2. Regarding the guard name, it's same __PROCESSOR_BIND_H__ macro in AArc= h64/Arm/Ebc/Ia32/X64, but it is PROCESSOR_BIND_H_ > in RiscV64 and LoongArh64. For above code, if we build BIOS for RISCV64, = it will try to include stdint.h due to different guard name. > > I am not sure if we can use same guard name to keep code alignment, or gi= ve some comments. Thanks. Hi, Hmm, interesting problem. Have you tried to #ifndef with some other define? Like, I don't know, MAX_UINTN or EFIAPI? --=20 Pedro