CORE-9023
Make also the advanced boot menu depend on the operating system type.
It can be opened by pressing F8, or F5, as in the Windows' bootloader.
The FreeLoader-specific options are moved to a separate menu,
accessible via the F2 key from the main menu.
Work-in-progress: display the boot options that correspond to the
currently-selected boot entry.
Use `NtLdrGetNextOption()` to loop over each individual option and move
it to its proper place. This automatically trims any '/' option
separator, including repeated ones and whitespaces, and allow for
straightforward replacement with one single space.
instead of returning an erroneous value, since the rosload.exe entry point
`RunLoader()` doesn't return any value. This allows exiting from rosload.exe
and NOT having the `LaunchSecondStageLoader()` returning 0, for example,
which would then be interpreted as an error condition and showing the
"Unable to load second stage loader." error box.
- `AtaInit()` returns the number of detected ATA devices. Therefore,
when iterating over them, go from index 0 to the count _minus_ 1,
in `Pc98InitializeBootDevices()` and in `XboxDiskInit()`.
- Initialize `DiskDrive->Type` to `DRIVE_TYPE_HDD` for detected SCSI
hard-disk drives in `pc98disk.c!InitScsiDrive()`.
- Rearrange `XboxDiskInit()` and reduce its indentation level.
Move the `DiskReportError()` and `DiskError()` routines into the
`freeldr/disk/disk.c` file, reviving it as a collection of disk
devices helpers (and more in the future).
The architecture-specific disk modules only define the error code mapping
`DiskGetErrorCodeString()` function, that is then used by `DiskError()`.
- Let it take a `MachFindPciBios` parameter, similar to the
`GET_SERIAL_PORT MachGetSerialPort` parameter of `DetectSerialPorts()`.
- Remove the `FindPciBios` global.
- Reduce indentation level.
Skip x86 BIOS emulator initialization on EFI boots by having FreeLdr populate EFI boot state in the loader block and making HAL consume it.
This keeps BIOS behavior unchanged while avoiding legacy BIOS/INT10 setup in the EFI path and preventing early EFI boot failures caused by entering the BIOS emulator path at all.
* [FREELDR][UEFI] Add BGRT logo support and center it on the loading screen
* [FREELDR][UEFI] Rework BGRT support and localize ACPI definitions
* [FREELDR][UEFI] Handle signed BGRT BMP height explicitly
* [FREELDR][UEFI] Use shared ACPI BGRT definitions
---------
Co-authored-by: Ahmed ARIF <arif.ing@outlook.com>
- Fix #GP crash on UEFI x64 boot caused by `call ExecuteLoaderCleanly[rip]` and `mov rax, UefiExitBootServices[rip]; call rax` generating indirect calls that read function code bytes as a pointer.
- Reload CS and data segments after `lgdt` to avoid #GP from stale UEFI selectors (e.g. CS=0x38) exceeding the new GDT limit.
Detect whether we run on XBOX or PC98 (on x86 builds), or on (U)EFI or on
a BIOS-based PC, or whether a generic linear framebuffer mode is used, in
order to choose the correct bootvid module to load, based from a predefined
file names list (ideally it should be derived from txtsetup.sif...).
Supersedes PR #8701.
Use `KeFindConfiguration*Entry()` to spelunk the hardware configuration
tree in the NT loader module.
Alternatively, allow the user to override the choice with a new `BOOTVID=`
boot option. In any case, if the selected bootvid module failed to be loaded,
silently fall back to the default bootvid.dll file. The fallback is done
by just letting the PE loader resolve the necessary exports from hal.dll
and ntoskrnl.exe.
This is the same feature as the one that already exists in the
NTOS:KD!kdmain.c module used by the in-kernel KDBG debugger
(GCC builds), first introduced in commit 4ce30245de (r54473),
and documented at:
https://reactos.org/wiki/Debugging#Changing_the_serial_port_address
This feature is useful if one uses a PCI, PCIe, PCMCIA, or ExpressCard
serial card on real hardware (these cards are used e.g. with laptops
without a built-in serial port), or with AMT serial over LAN.
After determining the serial port I/O address (say, 0xCC00), specify
the debug port as follows:
/DEBUGPORT=COM:0xCC00
instead of the usual syntax: /DEBUGPORT=COMn (n an integer).
The same syntax can be used for debugging FreeLoader as well: in the
FREELDR.INI file, add a "Debug" line in the "FREELOADER" section,
as follows:
```
[FREELOADER]
Debug=/DEBUG /DEBUGPORT=COM:0xCC00 /BAUDRATE=115200
```
----
NOTE for KDCOM/KDGDB:
Since `strtoul()` is used, but isn't exported by ntoskrnl, link against
the "strtol" static library that has been introduced in commit d317d4fbcc
(r71481).
Don't loop past the end of the command-line buffer, if the command-line
terminates with a lone "DEBUGPORT" without any extra parameter following.
For example: "some things DEBUGPORT "
- Don't hardcode constant string lengths.
- Use `_strnicmp()` -- Ideally we shouldn't have to unconditionally upcase
the global kernel command-line string to perform substrings comparisons.
- Cast `atol()` returned value to `ULONG`.
- The "IRQ" debugger option was introduced in commit 5a6adb4f13 (r2546).
It was used by the in-kernel GDB stub, to manually wire an interrupt
handler `GspBreakIn()` to allow the debugger to break into the system
when a command is received on the GDB serial port.
Side-remark:
The hooking was done via `HalGetInterruptVector()` + `IoConnectInterrupt()`,
but only at phase 1 initialization when the memory manager was up, which
can be "late" enough during system boot initialization.
Instead of using `IoConnectInterrupt()`, one could have used explicit
`KeInitializeInterrupt()` + `KeConnectInterrupt()` calls that would
have worked much earlier in the boot stage.
- This functionality was soon after disabled in commit c804ca06be (r2946)
in the GDB stub (see `ntoskrnl/kd/gdbstub.c!KdGdbStubInit()`), never
to be re-enabled again.
It was removed completely in commit e160c0fb26 (r14799).
- Since ReactOS was (until recently) always debugged locally using the
in-kernel KDBG debugger, break-in was done with TAB-K keypress,
intercepted by the keyboard driver that triggered a `DbgBreakPoint()`,
thus no break-in via serial port interrupt was necessary.
- Remote debugger break-in detection, which is the standard method that
is used when remote-debugging using KD transport DLLs and WinDbg, was
introduced in commit 12e7593f24 (r25984). As with the rest of debugger
communication and as done on Windows, detection is done by polling the
serial port at certain times, namely in the `KeUpdateSystemTime()`
kernel procedure periodically invoked by the timer interrupt.
This break-in detection was then erroneously removed in commit bf8b9467dc
(r45140), and reinstated in commit 014b23b9a (r56194).
- Parsing of this "IRQ" option was copy-pasted in other modules (FreeLoader,
KDCOM, and KDGDB), even though it was never used. The parsing was then
removed in KDBG itself in commit 95faf65ebf, but left in the other
modules... until now!
CORE-11954, CORE-16216, CORE-17518, CORE-17604, CORE-17977
The mkisofs options are quite long and repetitive (mostly duplicated 4 times
for the current 4 different ISO targets), and are also hard to read (i.e.
which group of options go together).
Reorganize the mkisofs ISO boot-related options in different thematic sets
and make them modular too. This also allow to conditionally add/remove ISO
boot entries for different platforms, for example:
- BIOS-based PC builds (only x86/x64) get the BIOS bootsector (excluded from IA64 and ARM32/64);
- EFI-based architectures get the EFI boot entry.
Based on a suggestion by Mark Jansen (see PR #4407).
Dedicated to Justin Miller ;)
EMS support isn't platform-specific, so we can compile it everywhere
(as this is already done for the kernel and the SAC driver).
The only platform-specific code currently existing is the retrieval of
the system GUID, which is done on BIOS-based PC by reading the SMBIOS
table in the low-MB ROM region, but should be done differently on other
platforms. Add a compile-time warning for this.
- Fix incorrect IDE controller ownership leading to strange and inconsistent behavior during boot.
- Fix a mismatch between the type and flags of the drive.
- Remove obsolete definitions.
- Use SAL2 annotations.
CORE-17977
The UEFI boot menu countdown was broken for two reasons:
- StallExecutionProcessor and UefiHwIdle were empty stubs, so the countdown
had no actual delay and no proper idle, it ran instantly without waiting
KbHit used ReadKeyStroke to poll for input, which consumed the keystroke
before GetCh could read it.
This fixes both: StallExecutionProcessor and UefiHwIdle now have real
implementations using BootServices->Stall and a timer event.
KbHit is changed to use CheckEvent(WaitForKey) which polls availability
without consuming the key.
CORE-11954
ROSTESTS-416
More and more winetests we import from Wine hardcode the `C:\Windows`
path and thus, are brittle (read: unreliable) whenever they are run
on any other configuration where Windows (or ReactOS) is **NOT**
installed in this path.
Dedicated to Carl Bialorucki ;)
Intel Macs released before late 2008/early 2009 are missing the UEFI GOP,
resulting in a frozen/white screen when booting FreeLoader.
These Macs only have the UGA protocol, which does not support direct
framebuffer access, and Apple's proprietary Graphics Info Protocol
(sometimes also called Screen Info Protocol) which can be used
to get all the graphics information we need.
CORE-11954
Prepare for Console IME Input for East Asian.
JIRA issue: CORE-20243
- Modify .github/labeler.yml.
- Add base/system/conime/ .
- Modify boot/bootdata/hivesft.inf for Console
settings.
- Add imm32!ImmCallImeConsoleIME prototype
into <imm32_undoc.h>.
- Add IMS_CONSOLEIME_1A and IMS_CONSOLEIME_1B
values into <imm32_undoc.h>, for WM_IME_SYSTEM
message.
On many Intel Macs and likely other EFI 1.x devices, allocating
the disk buffer with AllocatePool fails with `EFI_OUT_OF_RESOURCES`.
This causes FreeLoader hardware detection failure on Macs.
Workaround this issue by allocating with `MmAllocateMemoryWithType`
if `AllocatePool` via Boot Services fails.
CORE-11954
Prefer using the syntax:
`FIELD_OFFSET(CM_PARTIAL_RESOURCE_LIST, PartialDescriptors[k]) + ...;`
which is in general clearer and explicitly specifies the actual
number of resource descriptors used, over the other one:
`sizeof(CM_PARTIAL_RESOURCE_LIST) + (k-1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) + ...;`
Based on a suggestion by Dmitry Borisov.
Stop pointless target_sources(xxx PRIVATE $<TARGET_OBJECTS:gcc_ssp_nt>). The only effect it has is to force the object file into the target, which was already done by specifying the libraries as OBJECT libraries, which is also pointless, and only leads to problems.
This commit reworks how the uefidisk code works so it's not longer... completely wrong.
This also allows GPT disks to now be used on uefildr.
It's not perfect (as the correct solution is having freeldr load full efi device paths instead of arc like bootmgr does)
but this will work perfectly fine now. Well should.
Fix minor regression after commits f81c1910ee and e56911f66b (PR #7488).
The `PeLdrImportDllLoadCallback` variable was exported as a function,
instead of as data, which was incorrect since it is a data pointer,
that is set by winldr code (in rosload.exe) to tell the PE loader
(residing in freeldr.sys) to perform an action when an imported DLL
is being loaded.
Enable IMM mode and reduce
imm32_apitest failures.
JIRA issue: CORE-19268
- Enable LoadIMM registry setting.
NOTE: We have already DontLoadCTFIME
setting to avoid loading CTF IME.
Supporting CTF IME will be future work.
- Adjust DRQ timeout to fix some slow ATAPI devices.
- Add a fix for devices that clear BSY before raising the DRQ bit.
- Enable use of 32-bit I/O on Xbox.
CORE-17977 CORE-16216