It’s just… there are so many places that the code violates its own specification that ships with it, and I’m here having to rewrite chunks of the library so that my application that does follow the EFI spec will run on it.
…this is how you would write a console application in C and is how most of the provided applications are formatted, and does appear to work… somehow… but -
- is how it should be handled for an EFI executable, so that the EFI environment services can be accessed through the EFI_SYSTEM_TABLE, and command line arguments are contained under the EFI_HANDLE.
malloc() and free(), again, appear to function as as expected, but cause issues when interacting with the EFI library functions. They should be using the EFI runtime service memory functions AllocatePool() and FreePool() instead.
Same with printf() should be using Print(L"").
And variables should be using the EFI definitions of UINTN/UINT32, CHAR8, CHAR16, etc.
There are places all throughout the libraries where instead of dynamically allocating a buffer of the correct size, there are just some magic numbers that are “bigger than they should need to be” defining the size of things. Which has caused problems as PCs have a lot more hardware now than they did ten years ago.
…
They’re trying to make this available globally but this person obviously doesn’t know how extern works. Also why are we giving shit single letter variable names.
Same thing again, this should be:
Things return SUCCESS when they fail.
Initialization functions report the value requested by the user in their status messages instead of the actual value used after being adjusted by MIN/MAX/etc. (“Successfully created 2048MB RAM disk” when it only makes a max of 512MB).
Etc etc etc
It’s not all bad to the point of needing rewritten, but there’s obviously either one person or a team of people that wrote a significant chunk of the TianoCore library that have the qualifications of a freshman CS student in their first Intro-to-C++ class.
Not trying to be an ass here but this is why I look down on people who claim to be ‘software engineers’ until they’ve proven they actually know what they’re doing. Some of these are released with Intel’s name on them. Sorry. It’s getting frustrating, and if I asked someone at work to write a library for something and got this, it would be scrapped. Times like this I understand why people complain about silicon valley tech company interviews so much, it’s to weed this sort of thing out.