public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: Pedro Falcato <pedro.falcato@gmail.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: Leif Lindholm <leif@nuviainc.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>
Subject: Re: [Patch 0/3] Ext4Pkg: Add Ext4Pkg
Date: Thu, 5 Aug 2021 16:02:27 +0000	[thread overview]
Message-ID: <SA2PR11MB49384AEB32D8E33C7A2AEC36D2F29@SA2PR11MB4938.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210730161641.7245-1-pedro.falcato@gmail.com>

Hi Pedro,

There is a build failure when building the Ext4Pkg.dsc file for a missing RegisterFilerLib mapping.

The correct fix for this issue is to add the following !include statement to the DSC file after the
the [Defines] section.

!include MdePkg/MdeLibs.dsc.inc

With this one change, the X64 VS2019 builds pass.

There is an additional issue for IA32 VS2019 NOOPT builds.

build -a IA32 -n 5 -t VS2019 -p Features\Ext4Pkg\Ext4Pkg.dsc -b NOOPT

Ext4.lib(DiskUtil.obj) : error LNK2001: unresolved external symbol __allmul
Ext4.lib(File.obj) : error LNK2001: unresolved external symbol __allmul
Ext4.lib(Inode.obj) : error LNK2001: unresolved external symbol __allmul
Ext4.lib(BlockGroup.obj) : error LNK2001: unresolved external symbol __allmul
Ext4.lib(Superblock.obj) : error LNK2001: unresolved external symbol __allmul
Ext4.lib(BlockGroup.obj) : error LNK2001: unresolved external symbol __allshl
Ext4.lib(Superblock.obj) : error LNK2001: unresolved external symbol __allshl
Ext4.lib(File.obj) : error LNK2001: unresolved external symbol __allshl
Ext4.lib(Extents.obj) : error LNK2001: unresolved external symbol __allshl
Ext4.lib(Directory.obj) : error LNK2001: unresolved external symbol __allshl
Ext4.lib(Inode.obj) : error LNK2001: unresolved external symbol __allshl

These are usually caused by doing 64-bit math operations when building for IA32.
There are BaseLib functions that do 64-bit path for multiply and left shift that
need to be used when operands are of type INT64 or UINT64.

From the disasm, the following functions are doing 64bit multiple (__allmull)
_Ext4GetFilesystemInfo:
_Ext4FilePhysicalSpace:
_Ext4Read:
_Ext4BlockToByteOffset:
_Ext4ReadInode:
_Ext4OpenSuperblock:
_Ext4ReadBlocks:


From the disasm, the following functions are doing 64-bit shift or power of 2 multiply (__allshl)

_Ext4GetFileInfo:
_Ext4MakeBlockNumberFromHalfs:
_Ext4SetPosition:
_Ext4ExtentIdxLeafBlock:
_Ext4InodeSize:
_Ext4RetrieveDirent:
_Ext4FileATime:
_Ext4FileCrTime:
_Ext4FileMTime:
_Ext4FilePhysicalSpace:
_Ext4InodeSize:
_Ext4Read:
_Ext4MakeBlockNumberFromHalfs:
_Ext4MakeBlockNumberFromHalfs:

For example, Ext4GetFileInfo, uses EXT4_INODE_SIZE() macro, which does a 32-bit shift:

    ext4disk.h:#define EXT4_INODE_SIZE (ino)  (((UINT64)ino->i_size_hi << 32) | ino->i_size_lo)

This can be changes to use the BaseLib function:

    UINT64
    EFIAPI
    LShiftU64 (
      IN      UINT64                    Operand,
      IN      UINTN                     Count
      );

    ext4disk.h:#define EXT4_INODE_SIZE (ino)  ((LShiftU64 (no->i_size_hi, 32) | ino->i_size_lo)

Best regards,

Mike

> -----Original Message-----
> From: Pedro Falcato <pedro.falcato@gmail.com>
> Sent: Friday, July 30, 2021 9:17 AM
> To: devel@edk2.groups.io
> Cc: Pedro Falcato <pedro.falcato@gmail.com>; Leif Lindholm <leif@nuviainc.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>
> Subject: [Patch 0/3] Ext4Pkg: Add Ext4Pkg
> 
> This patch-set adds Ext4Pkg, a package designed to hold various drivers and
> utilities related to the EXT4 filesystem.
> 
> Right now, it holds a single read-only UEFI EXT4 driver (Ext4Dxe), which consumes the
> DISK_IO, BLOCK_IO and DISK_IO2 protocols and produce EFI_FILE_PROTOCOL and
> EFI_SIMPLE_FILE_SYSTEM_PROTOCOL; this driver allows the mounting of EXT4 partitions and
> the reading of their contents.
> 
> Relevant RFC discussion, which includes a more in-depth walkthrough of EXT4 internals and
> driver limitations is available at https://edk2.groups.io/g/devel/topic/84368561.
> 
> Cc: Leif Lindholm <leif@nuviainc.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> 
> Pedro Falcato (3):
>   Ext4Pkg: Add Ext4Pkg.dec and Ext4Pkg.uni.
>   Ext4Pkg: Add Ext4Dxe driver.
>   Ext4Pkg: Add .DSC file.
> 
>  Features/Ext4Pkg/Ext4Dxe/BlockGroup.c | 208 ++++++
>  Features/Ext4Pkg/Ext4Dxe/Collation.c  | 157 +++++
>  Features/Ext4Pkg/Ext4Dxe/Crc16.c      |  75 ++
>  Features/Ext4Pkg/Ext4Dxe/Crc32c.c     |  84 +++
>  Features/Ext4Pkg/Ext4Dxe/Directory.c  | 492 ++++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/DiskUtil.c   |  83 +++
>  Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h   | 450 ++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c    | 454 +++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h    | 942 ++++++++++++++++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf  | 147 ++++
>  Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.uni  |  15 +
>  Features/Ext4Pkg/Ext4Dxe/Extents.c    | 616 +++++++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/File.c       | 583 ++++++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/Inode.c      | 468 +++++++++++++
>  Features/Ext4Pkg/Ext4Dxe/Partition.c  | 120 ++++
>  Features/Ext4Pkg/Ext4Dxe/Superblock.c | 257 +++++++
>  Features/Ext4Pkg/Ext4Pkg.dec          |  17 +
>  Features/Ext4Pkg/Ext4Pkg.dsc          |  68 ++
>  Features/Ext4Pkg/Ext4Pkg.uni          |  14 +
>  19 files changed, 5250 insertions(+)
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/BlockGroup.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Collation.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc16.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Crc32c.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Directory.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/DiskUtil.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Ext4Disk.h
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.h
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.inf
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Ext4Dxe.uni
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Extents.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/File.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Inode.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Partition.c
>  create mode 100644 Features/Ext4Pkg/Ext4Dxe/Superblock.c
>  create mode 100644 Features/Ext4Pkg/Ext4Pkg.dec
>  create mode 100644 Features/Ext4Pkg/Ext4Pkg.dsc
>  create mode 100644 Features/Ext4Pkg/Ext4Pkg.uni
> 
> --
> 2.32.0


  parent reply	other threads:[~2021-08-05 16:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30 16:16 [Patch 0/3] Ext4Pkg: Add Ext4Pkg Pedro Falcato
2021-07-30 16:16 ` [Patch 1/3] Ext4Pkg: Add Ext4Pkg.dec and Ext4Pkg.uni Pedro Falcato
2021-07-30 16:16 ` [Patch 2/3] Ext4Pkg: Add Ext4Dxe driver Pedro Falcato
2021-07-30 20:28   ` [edk2-devel] " Marvin Häuser
2021-08-02 15:56     ` Pedro Falcato
2021-07-30 16:16 ` [Patch 3/3] Ext4Pkg: Add .DSC file Pedro Falcato
2021-08-05 15:36 ` [Patch 0/3] Ext4Pkg: Add Ext4Pkg Michael D Kinney
2021-08-05 16:02 ` Michael D Kinney [this message]
2021-08-05 18:33 ` Michael D Kinney
2021-08-05 22:50   ` Pedro Falcato
2021-08-06 16:15     ` [edk2-devel] " Michael D Kinney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SA2PR11MB49384AEB32D8E33C7A2AEC36D2F29@SA2PR11MB4938.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox