[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 6 Aug 2019 20:30:54 +0000 (22:30 +0200)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 6 Aug 2019 21:40:05 +0000 (23:40 +0200)
commitd05be0da3f4d8c5c3bc60e1b8249b586212642bc
tree5d7ed53214fd6da3a352ae4954bcf3f2464dd158
parentd21ffe6336b327894a9f85daf0da7c6b0089e3b2
[FREELDR] Some ARC-spec compatibility refactoring + simplifications & fixes.
CORE-9023

- During loading and initialization of the list of operating systems
  available in freeldr.ini, convert any legacy operating system entry
  encountered -- they are like those in NTLDR's boot.ini file, i.e.:

    ArcOsLoadPartition="LoadIdentifier" /List /of /Options

  into a new operating system INI entry, like those used by default in
  FreeLoader. This allows us to avoid treating this corner-case later in
  different parts of the code. Also, the "BootType" value is now
  determined there, only once.

- Convert the OS loaders entry-points to ARC-compatible ones, following
  the "Advanced RISC Computing Specification, Version 1.2" specification
  https://www.netbsd.org/docs/Hardware/Machines/ARC/riscspec.pdf

- Introduce helpers for retrieving options values from the argument vector
  in a simple way.

- Simplify LoadOperatingSystem(), since now the "BootType" value has
  been determined once while loading the list of OSes (see above) and
  is well-defined there. Use the BuildArgvForOsLoader() helper to build
  the ARC-compatible argument vector from the corresponding INI settings
  for the selected operating system entry, and use it when calling the
  corresponding OS loader.

- In the OS loaders, since we can now directly read the settings from
  the argument vector (instead of using INI settings), we can avoid
  using a bunch of fixed-size string buffers, and avoid potentially
  failing IniOpenSection() calls as well.

- Simplify code in the Linux loader (and the RemoveQuotes() function).

- Add UiShowMessageBoxesInArgv() that acts on the "MessageBox=" settings
  passed through the argument vector (equivalent to
  UiShowMessageBoxesInSection() ).

- Use string-safe functions where needed (copy/concatenation/printf on
  fixed-size buffers).
19 files changed:
boot/freeldr/freeldr/CMakeLists.txt
boot/freeldr/freeldr/bootmgr.c
boot/freeldr/freeldr/custom.c
boot/freeldr/freeldr/include/arcsupp.h [new file with mode: 0644]
boot/freeldr/freeldr/include/freeldr.h
boot/freeldr/freeldr/include/linux.h
boot/freeldr/freeldr/include/miscboot.h
boot/freeldr/freeldr/include/oslist.h
boot/freeldr/freeldr/include/ui.h
boot/freeldr/freeldr/include/winldr.h
boot/freeldr/freeldr/lib/arcsupp.c [new file with mode: 0644]
boot/freeldr/freeldr/linuxboot.c
boot/freeldr/freeldr/miscboot.c
boot/freeldr/freeldr/ntldr/setupldr.c
boot/freeldr/freeldr/ntldr/winldr.c
boot/freeldr/freeldr/ntldr/winldr.h
boot/freeldr/freeldr/oslist.c
boot/freeldr/freeldr/ui/directui.c
boot/freeldr/freeldr/ui/ui.c