Commit graph

46 commits

Author SHA1 Message Date
Victor Perevertkin 447ef2aa4a
[CMAKE] Do not use USE_CLANG_CL variable in CMake scripts 2022-05-27 01:37:37 +03:00
Hermès Bélusca-Maïto 94874baf19
[FREELDR:NTLDR] Use NTOS kernel's CMBOOT functions to enumerate and build the boot-time driver list.
They are correct and are more performant.

- Rewrite WinLdrAddDriverToList() on the model of CmpAddDriverToList()
  with support for CmpIsDriverInList().

- Disable RegEnumKey() as it is now unused.
2022-04-17 04:57:42 +02:00
Hermès Bélusca-Maïto 24cb57fdea
[BOOT][SDK:RTL] Compile a reduced RTL library for FreeLdr / NT bootloader...
... as it should have always been done (and must be done for NTDLL
and NTOS kernel as well). This allows using the RTL with the correct
definitions and the reduced functionality available at boot-time.

+ Make the RTL main header compatible.

In addition, this will permit re-using existing code that already
uses the RTL (mostly string conversions).

See commits 427c90af3 (r36761) and b46e8cc18 (r36980) for some
background.
2022-04-07 03:19:09 +02:00
Hermès Bélusca-Maïto 06fc2e72a6
[FREELDR:UI] Disable GUI code from compilation as it is currently stubbed.
Rename "ShowGui" -> "ShowUi" as this variable was actually unrelated
to *graphical* aspects of the UI.
2022-02-06 17:52:39 +01:00
Victor Perevertkin 8e1fa03456
[CMAKE] Replace custom scripts in compilerflags with standard ones
- add_target_link_flags changed to target_link_options
- add_target_property changed to set_property(... APPEND ...)
2021-09-14 17:56:22 +03:00
Jérôme Gardou 54ecf703f2 [CMAKE:GCC] Produce RosSym data even when building with separate debug symbols 2021-06-29 11:49:20 +02:00
Jérôme Gardou 5c332f6d36 [CMAKE] Get rid of freeldr_pe_dbg target
objcopy bug is now solved and I can't remember how this used to work anyway.
Use strip instead.
If you need to debug freeldr
 - set SEPARATE_DBG cmake var to TRUE
 - use qemu GDB stub
 - In GDB : add-symbol-file <build_dir>/symbols/freeldr_pe.exe
2021-06-29 11:49:20 +02:00
Jérôme Gardou 2bf116359b [FREELDR] Force alignment of .text section on disk
Fixes boot for clang & GCC-amd64 build
Also rename freeldr_i386.lds to freeldr_gcc.lds for better clarity
2021-04-28 13:10:23 +02:00
Victor Perevertkin f82eb0fede this seem to be the only combination which works on msbuild-msvc 2021-03-03 08:34:32 +01:00
Jérôme Gardou 1ea6157cbf [FREELDR] Use target_link_options instead of add_target_link_flags
CORE-17423
2021-03-03 08:34:32 +01:00
Jérôme Gardou e7f08b3e30 [FREELDR] Use decimal numbers for section & file alignment
CORE-17423
2021-03-03 08:34:32 +01:00
Hervé Poussineau bfedf9760c [FREELDR] Disable SSE instructions for GCC x64
Even if all x64 CPUs can handle SSE instructions, prevent GCC x64 to
generate them, as FreeLoader is not ready to handle them.
2021-02-01 19:57:12 +01:00
Jérôme Gardou c8d07514c8 [CMAKE] Fix GCC -fstack-protector usage 2021-01-05 13:38:57 +01:00
Hermès Bélusca-Maïto d887308b2f
[FREELDR] Parse NT kernel load options in a consistent manner.
- Introduce a set of NtLdrGet(Next)Option(Ex) helpers that allow
  retrieving respectively, the "next" option in an options string,
  and retrieving a given named option in such an options string,
  by correctly parsing that string.

  Valid syntaxes:
      /OPTION1 /OPTION2/OPTION3 OPTION4 /OPTION5(=...) ...

  Options separators are slashes, or whitespace (space, tab), mandatory
  if no slash is used, and otherwise optional.

- Use these functions wherever NT load options are being parsed.

- Simplify the parsing of /DEBUGPORT=... using these functions.

- When parsing the /HAL=... or /KERNEL=... options, only the first
  encountered one is taken into account, any other ones are discarded.

- When parsing the other load options, only their first occurrences are
  taken into account, any other repetitions are discarded.
  * The NOPAE option overrides any previous PAE option.
  * Any NOEXECUTE(=) option should override any previous
    NOEXECUTE=ALWAYSOFF (or equivalently, EXECUTE) option.
2020-11-03 01:52:47 +01:00
Jérôme Gardou 00ed72d7e8 [CMAKE] Get rid of add_compile_flags
Use add_compile_options and the like instead
2020-10-20 21:44:54 +02:00
Jérôme Gardou 7e116f0ef3 [CMAKE] Get rid of replace_compile_flags
Introduce a finer-grained remove_target_compile_option instead
2020-10-20 21:44:54 +02:00
Victor Perevertkin 7e069ccdb2
[CMAKE] Replace custom functions to built-in ones
add_target_compile_definitions -> target_compile_definitions
add_target_compile_flags -> target_compile_options
add_target_include_directories -> target_include_directories
2020-04-16 15:59:38 +03:00
Victor Perevertkin 92dfec219d
[CMAKE][CONFIGURE] Enable runtime checks on MSVC by default.
Remove RTC switch from configure.cmd, now MSVC runtime checks are
supposed to be enabled/disabled via CMake define (-DRUNTIME_CHECKS=1)
Prepare for adding more dynamic analysis options
2020-04-11 02:48:12 +03:00
Stanislav Motylkov dc7eac583f
[FREELDR] Move built-in VGA font to better location (#2429)
Addendum to 97eacb9.
2020-03-14 18:13:49 +01:00
Dmitry Borisov c14cc22bfd [FREELDR] Add ARC-emulation support for NEC PC-98 series
- Add ARC-emulation support for NEC PC-98 series
- Add global definition for PC-98 port into CMakeLists.txt
- Add floppy verison of freeldr.ini for PC-98 CD boot
2020-03-07 00:52:40 +01:00
Dmitry Borisov 74eda39118
[FREELDR] Move the PC VESA and hardware detection libraries into the PC directory (#2355)
Because it contains platform-specific code.
2020-03-01 20:41:47 +01:00
Dmitry Borisov 747d50c52e
[FREELDR] Separate PC beep routines out into its own file (#2347)
- Remove now unused i386rtl.c (and it doesn't contains RTL functions nowadays).
- Separate PC beep routines out into its own file.
- Also use delay function instead of BIOS interrupts.
- Improve as well the accuracy of KeStallExecutionProcessor() by using the same HW delay function.
2020-02-14 19:22:17 +01:00
Stanislav Motylkov 571407c7d2 [FREELDR] Separate PC and Xbox platform-specific code (#2185)
CORE-16216
2020-02-14 16:02:04 +01:00
Stanislav Motylkov 6c4e591ea9 [FREELDR] Restructure platform-specific code. No code changes. 2020-02-14 16:02:04 +01:00
Dmitry Borisov 065afd93fd [FREELDR] Add FAT12 file system boot sector for NEC PC-98 series (#2025)
The first part of PC-98 Port - https://reactos.org/wiki/PC-98

- Add FAT12 file system boot sector for NEC PC-98 series.
- Add a new build target for a PC-98 bootable floppy disk.
- Add a new sub-architecture into config.cmake.
2020-01-18 19:16:23 +01:00
Dmitry Borisov 9a12473280
[FREELDR] Add ATA/ATAPI driver. (#2167)
CORE-16220 CORE-16216

* Create a new driver.
* Use the functions from the library in xboxdisk.c

Driver now supports PC, Xbox and NEC PC-98.

Co-Authored-By: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2020-01-12 21:18:07 +01:00
Hermès Bélusca-Maïto 25badcfbbd
[FREELDR] Add support for loading Linux in x64 FreeLdr. Part 1/2: ASM code.
Add also ASM implementation for intrinsics that may not be always
present on MSVC (e.g. MSVC 2010).
2019-10-07 02:57:48 +02:00
Hermès Bélusca-Maïto fc29a6c41c
[FREELDR] Minor code improvements + 1 bug-fix.
- "FrldrBootPath" -> "FrLdrBootPath";
- Get rid of GetFreeLoaderVersionString() and use FrLdrVersionString
  directly instead;
- Rephrase some comments;
- Use RTL_NUMBER_OF();
- Reduce indent level in LoadOperatingSystem() and EditOperatingSystemEntry().

Bug fix:
- Fix DissectArcPath() for "ramdisk(0)" case.
2019-09-17 23:24:51 +02:00
Hermès Bélusca-Maïto fba4ad4ceb
[FREELDR] Move files where they are only used.
- Merge fade.c/palette.c/video.c into video.c and move it into UI.
- Move inffile.c into NTLDR.
2019-08-11 22:01:36 +02:00
Hermès Bélusca-Maïto bc3314d4aa
[FREELDR] Better fix for x64. Addendum to 268cdf57. 2019-08-07 19:30:55 +02:00
Hermès Bélusca-Maïto 268cdf5702
[FREELDR] Fix x64 build. 2019-08-07 18:49:19 +02:00
Hermès Bélusca-Maïto d05be0da3f
[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).
2019-08-06 23:40:05 +02:00
Jérôme Gardou 157a509a0f [CMAKE] Also set blank DEFINE_SYMBOL property for freeldr helpers 2019-04-06 17:43:38 +02:00
Hervé Poussineau a15160cd45 [FREELDR] Prevent a warning in Xbox memory initialization 2019-04-01 11:38:32 +02:00
Hermès Bélusca-Maïto 7d0cd6e937
[FREELDR][SDK:CMAKE] Move the `MSVC "linker script" file' functionality out of FreeLdr's cmake file and place it in the dedicated files instead. 2019-02-10 00:43:31 +01:00
Oleksandr Shaposhnikov a5c5ba17e5 [FREELDR] Fix VSSolution configuring and build
"configure.cmd VSSolution" was failing due to add_asm_files macro
 expansion. It was using the same 'freeldr_linker_file' variable name
 as a temporary filename base twice. This patch uses '_target'
 parameter to make those variable names differ.
2019-02-10 00:25:04 +01:00
Andrew Cook d8e92b5a0a Merge pull request #1335 from ariscop/CMP0065
Fixes for upstream cmake
2019-02-03 12:57:20 +01:00
Hermès Bélusca-Maïto 6b1e1df5c9
[FREELDR] Re-integrate the ASM files (and corresponding C code) in MSVC builds, that were previously compiled just for GCC builds. (#1224)
- Multiboot support added back in FreeLdr MSVC builds so that it can be
  booted using e.g. GRUB. See CORE-15563.

- Re-introduce the disk drive mapper code.
2019-01-27 00:51:26 +01:00
Hermès Bélusca-Maïto ed83552229
[FREELDR] Introduce a MSVC "linker script" file that centralizes the commands for defining section-limit symbols, and the ordering and merging of PE sections, and the necessary CMake code to use it. (#1224)
As the MSVC linker alone doesn't permit such control, the file uses
ASM language (C can alternatively be used), together with extra linker
command-line switches.

It is pre-processed 3 times: first for generating the ASM code, second
for the C code and the third time for generating the linker response
file.

In our case, the ASM code defines the __bss_start__ and __bss_end__
symbols that allow us to find the limits of the .bss section (which is
by the way automatically appended to the .data section by the MSVC linker).
The C code is used to specify the list of linker switches that can be
passed through the `#pragma comment(linker, ...)' directive (the can be
alternatively specified in the linker response section).
Finally the linker response section contains all the linker switches
that cannot be specified with the `#pragma comment(linker, ...)'
directive.

Using all this we can recycle the BSS initialization code, that has been
written originally for GCC only, also for the MSVC builds.

Also, remove the outdated .text16 section merging.
2019-01-27 00:51:25 +01:00
Hermès Bélusca-Maïto aaee856cea
[FREELDR] Minor code maintenance.
- Whitespace;

- Explicitly use string pooling (option "/GF"), so that even if it's
  used globally in the main ReactOS CMAKE file or not, we still have it
  there, because we are quite size-constrained;

- Rename the source lists (OK, we understand it's _COMMON_ ...);
- Remove redundant double inclusion of linuxboot.c;
- In the 'freeldr_common' static library, compile the ASM code first.
2019-01-27 00:51:19 +01:00
Timo Kreuzer 71fefa32db
[NDK][NTOS] Add global definition of INIT_FUNCTION/INIT_SECTION (#779)
* Add an NDK header to define INIT_FUNCTION/INIT_SECTION globally
* Use _declspec(allocate(x)) and _declspec(code_seg(x)) on MSVC versions that support it
* Use INIT_FUNCTION on functions only and INIT_SECTION on data only (required by MSVC)
* Place INIT_FUNCTION before the return type (required by MSVC)
* Make sure declarations and implementations share the same modifiers (required by MSVC)
* Add a global linker option to suppress warnings about defined but unused INIT section
* Merge INIT section into .text in freeldr
2018-12-30 12:19:11 +01:00
Victor Perevertkin 3b69eee7a6 [FREELDR][BTRFS] Implemented BTRFS support in Free Loader. Now it supports case-insensitive path lookup, symlink folowing and reading uncompressed files.
Volume boot record is also implemented, it supports reading BTRFS tree structures with upto 64k node size.
This support required to change all path in Free Loader to lowercase for better performance.
CORE-13769
2018-08-20 08:26:56 +02:00
Thomas Faber f6dea8b734
[CMAKE] Avoid some uses of the LOCATION target property. CORE-14509 2018-03-30 20:28:20 +02:00
Amine Khaldi 9397f280c3 [FREELDR] The work done in r70692 overlooked the need to update the PCH lists of source files as well.
- We use this as a chance to also update the CMake file in terms of consistency.
- The clang-cl build applies the /Os flag on all the source files that are now using the PCH too.
2017-12-09 14:18:43 +01:00
Amine Khaldi 09c06a2f45 [CLANG-CL] Initial commit that allows us to compile ReactOS with clang-cl. 2017-11-23 14:09:57 +01:00
Colin Finck c2c66aff7d Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
Renamed from reactos/boot/freeldr/freeldr/CMakeLists.txt (Browse further)