Commit Graph

885 Commits

Author SHA1 Message Date
Hermès Bélusca-Maïto
c4d60756dd [FREELDR][KDCOM][KDGDB][NTOS:KD] Some code "nits"
- 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`.
2026-03-19 22:49:29 +01:00
Hermès Bélusca-Maïto
4d0642b67f [FREELDR][KDCOM][KDGDB][NTOS:KD] Minor code comments enhancements 2026-03-19 22:14:00 +01:00
Hermès Bélusca-Maïto
b1a31610ac [FREELDR][KDCOM][KDGDB] Remove deprecated "IRQ" debugger command-line option
- 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!
2026-03-19 21:52:14 +01:00
Hermès Bélusca-Maïto
6a56468731 [BOOTDATA] Reorganize the mkisofs ISO boot-related options, making them modular (#4425)
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 ;)
2026-03-18 20:19:26 +01:00
Daniel Victor
b0bd092c0d [FREELDR] Make ASSERT bugcheck on failure (#8730)
Show a bugcheck with message showing where and why the ASSERT failed.
2026-03-17 16:24:14 +01:00
Hermès Bélusca-Maïto
f63df20bd4 [FREELDR:NTLDR] Fix GCC build
Addendum to commit ea93b886df.
2026-03-16 20:25:44 +01:00
Hermès Bélusca-Maïto
ea93b886df [FREELDR:NTLDR] Compile EMS support on all platforms
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.
2026-03-16 20:04:45 +01:00
Hermès Bélusca-Maïto
9833d3d8c8 [FREELDR][NTOS:INBV] Simplify headless-support initialization code
Also address few observations made by Serge Gautherie in PR #7885.
2026-03-16 18:42:57 +01:00
Hermès Bélusca-Maïto
50cb29ad4a [FREELDR][NTOS:INBV] SAL2-annotate headless-support functions 2026-03-16 16:49:53 +01:00
Hermès Bélusca-Maïto
3012af5e30 [CPORTLIB][FREELDR][KD][NTOS] Move duplicated UART settings into a common header 2026-03-16 16:18:43 +01:00
Dmitry Borisov
1cec553ed1 [FREELDR:PC98] Refactor PC-98 disk access routines (#8546)
- 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
2026-03-09 14:04:35 +01:00
Hermès Bélusca-Maïto
fb22bd74c6 [FREELDR:NTLDR] Pass the LoadOrderListHead list to LoadModule() instead of the full version-specific LoaderBlock 2026-03-08 19:52:04 +01:00
Hermès Bélusca-Maïto
4235244ac9 [FREELDR] Move the NTLDR-specific files from the generic CMakeLists file to rosload/uefi.cmake
The UEFI build doesn't use rosload.exe yet, thus some duplication still
exists. This will be cleaned up in the future.
2026-03-08 19:52:03 +01:00
Ahmed Arif
dc9ee34478 [FREELDR:UEFI] Fix broken boot menu countdown (#8714)
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
2026-03-08 21:40:15 +03:00
Hermès Bélusca-Maïto
26c126153f [BOOTDATA] Enable Alt Hex-numpad support by default in the LiveCD (#8680) 2026-03-08 18:35:43 +01:00
Hermès Bélusca-Maïto
ffdae843b4 [BOOTCDREGTEST] Install ReactOS in C:\Windows on the testbots to cope with unreliable Winetests (#8693)
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 ;)
2026-03-08 18:20:11 +01:00
Sylas Hollander
1d3f99a87a [FREELDR:UEFI] Add support for Apple Graphics Info Protocol (#8706)
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
2026-03-02 23:22:37 +03:00
Sylas Hollander
e1853c6621 [FREELDR:UEFI] Correctly pass through ACPI information and map its memory (#8669)
This prevents bugchecks in Windows due to the ACPI table being overwritten
because of the incorrect UEFI to E820 memory mappings.

CORE-11954
2026-03-01 22:26:35 +03:00
Katayama Hirofumi MZ
423d7031fe [CONIME][BOOTDATA][GITHUB][SDK] Add conime.exe (#8678)
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.
2026-02-26 09:28:22 +09:00
Hermès Bélusca-Maïto
08eddb2736 [BOOTDATA] Use HKCU instead of HKU\.DEFAULT to simplify the livecd.inf file
`HKU\.DEFAULT` is equivalent to `HKCU` for the LiveCD hives.
2026-02-21 17:32:33 +01:00
Sylas Hollander
492aeb639c [FREELDR:UEFI] Fallback to MmAllocateMemoryWithType if allocating the disk read buffer with AllocatePool fails (#8677)
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
2026-02-19 13:20:52 +03:00
Justin Miller
c8907598f5 [UEFILDR][FREELDR] Some x64 ABI violations and memory map fixes (#8668)
* [UEFILDR][FREELDR] Don't let LoaderPangesSpanned span half of mem space
* [FREELDR][UEFILDR] Fix x64 ABI Violations
2026-02-15 00:26:20 +00:00
Daniel Victor
23d38f4b64 [FREELDR] Fix AttributeList parsing on NTFS driver (#8103)
Fix incorrect $ATTRIBUTE_LIST parsing on NTFS driver of FreeLdr.
2026-02-14 22:59:34 +00:00
Justin Miller
5213cf717c [BOOT][ENVIRON] Remove Environ (#8667)
* [SDK][BOOT] Reimport the EDK2 headers

* [ENVIRON] Remove Environ
2026-02-11 14:01:16 -08:00
Hermès Bélusca-Maïto
00bbac600e [FREELDR:XBOX/UEFI] Enumerate video framebuffer information in the Hardware Configuration Tree (#8617)
- UEFI: Report GOP framebuffer information.
- UEFI: Update ARC versioning for configuration data.
- XBOX: Enumerate video display controller under the correct PCI bus.
- XBOX: Update ARC versioning for display controller configuration data.
2026-01-30 14:00:25 +01:00
Hermès Bélusca-Maïto
231de344d0 [FREELDR:ARCH] Improve configuration resource list size calculations (#8629)
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.
2026-01-30 13:48:08 +01:00
Timo Kreuzer
07de64139a [GCC_SSP] Turn the GCC stack protector lib into a normal library
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.
2026-01-29 17:13:40 +02:00
Katayama Hirofumi MZ
13c4ef9c40 [BOOTDATA][SHELL32][SHIMGVW] Populate HKCR\SystemFileAssociations (#8626)
JIRA issue: CORE-19355
- Modify boot/bootdata/hivecls.inf.
- Add dll/win32/shell32/res/rgs/
  systemfileassociations.rgs.
- Add dll/win32/shimgvw/res/
  systemfileassociations.rgs.
2026-01-29 07:13:30 +09:00
Justin Miller
2865b6353b [UEFILDR] Revise disk access code (#8623)
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.
2026-01-23 01:12:21 +00:00
Hermès Bélusca-Maïto
6a8c5f99a7 [FREELDR:NTLDR] Fix displaying the loaded modules list in SOS mode (#8616)
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.
2026-01-22 12:03:29 +01:00
Katayama Hirofumi MZ
44200f9142 [BOOTDATA][NTUSER] Enable LoadIMM setting (#8602)
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.
2026-01-18 11:17:56 +09:00
Dmitry Borisov
a55ceaf834 [FREELDR:HWIDE] Improve support for ATAPI devices (#8560)
- 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
2026-01-15 16:50:51 +03:00
Hermès Bélusca-Maïto
873abe88a9 [FREELDR] vidfb.c: Fix coordinates validation in VidFbOutputChar()
Its purpose is to verify that we don't output characters outside of the screen.
Addendum to commit 379eb14596 (PR #8530)
2026-01-14 22:49:50 +01:00
Dmitry Borisov
3bc4f3447f [BOOT][HAL] Fix BCD conversion macros (#8574)
- BCD_INT / INT_BCD: Evaluate macro parameter only once
- Remove the stdcall calling convention from PC-98 HAL private functions
2026-01-12 16:40:21 +03:00
Hermès Bélusca-Maïto
aab65cbeb7 [FREELDR:XBOX/UEFI] vidfb: stub-plement pixel bitmasks support (#8531)
This is the starting point where both support for generic framebuffer
video driver support (in bootvid and win32k) for XBOX, UEFI etc., and
in FreeLoader itself also for PC VESA, begins.
2026-01-03 17:11:53 +01:00
Hermès Bélusca-Maïto
60a0d027c6 [FREELDR] Support a "video=..." command-line option; use it in pcvideo.c (#8529)
This command-line option can be used when chainloading freeldr.sys from
another bootloader. In this case, pcvideo.c uses this option to set an
initial display mode.

settings.c: Simplify also parsing the separate options from the command-line.
2026-01-03 17:09:47 +01:00
Hermès Bélusca-Maïto
379eb14596 [FREELDR:XBOX/UEFI] Separate framebuffer functions with those pertaining to emulated text console (#8530)
- Framebuffer routines that output characters with text-like attributes,
  or return screen sizes in character units (columns/rows), pertain to a
  "framebuffer console" (FbCons) layer.
  Their interface may be extended a bit in the future.

- Add Doxygen documentation for some of them.

- The Xbox/UefiVideo* functions that are similarly character-oriented,
  invoke these framebuffer console routines.
2026-01-02 13:42:23 +01:00
Stanislav Motylkov
8785bed110 [BOOTDATA][INF][FONTS] Sync font substitutes for "MS Sans Serif"
Keep font substitutes in sync for LiveCD and localized installations.
Addendum to bac7d7f5cd and 0d7afe780e.

CORE‑15675 CORE‑15678
2025-12-31 11:36:21 +01:00
Hermès Bélusca-Maïto
bdf1b0ca5d [FREELDR:XBOX:PC98] Fix compilation dependencies and linking (#8512)
Addendum to commit 9e64fa837d (PR #8510)
CORE-16216, CORE-17977

pcmem.c: Surround more PC-specific routines in `!SARCH_XBOX || !SARCH_PC98`,
so that they aren't compiled for XBOX or PC98.

pcat.cmake: Inform that pcmem.c is used by pc98mem.c
2025-12-24 13:48:52 +01:00
Hermès Bélusca-Maïto
cf901f3b78 [FREELDR:XBOX] Fix GCC compilation (#8512)
CORE-16216

Addendum to commit 9e64fa837d (PR #8510)

Fixes GCC complaint when compiling for XBOX (or PC98)
```
boot/freeldr/freeldr/arch/i386/pc/machpc.c:1123:1: error: 'DetectKeyboardController' defined but not used [-Werror=unused-function]
DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey)
^~~~~~~~~~~~~~~~~~~~~~~~
```
2025-12-24 13:48:11 +01:00
Erdem Ersoy
66018d5e84 [BOOTDATA] Update Turkish localization timezone (#8528)
CORE-20403
2025-12-24 13:46:26 +01:00
Mark Jansen
07904ea449 [BOOTDATA] Add missed files for the vmware video driver 2025-12-24 13:45:50 +01:00
Mark Jansen
dea54fb53a [BOOTDATA] update caroots.inf
CORE-20398
2025-12-24 13:43:53 +01:00
Stanislav Motylkov
7f64cd986b [FREELDR:PC98] Fix build by doing a partial revert
Partial revert of 9decadee83.
It introduced a typo in the assembler code that broke the build.
Also, "Press any key" text fits into 512 bootsector space on both GCC/MSVC.

CORE-19882 CORE-17977
2025-12-19 23:58:01 +01:00
Hermès Bélusca-Maïto
ea90485339 [FREELDR:XBOX/UEFI] No need for a specific ScrollUp routine, just call the VidFb one (#8509)
And use the console `CurrentAttr` for screen filling, instead of
hardcoding it to white-on-black.
2025-12-19 13:21:49 +01:00
Hermès Bélusca-Maïto
d1445c8e69 [FREELDR:XBOX/UEFI] Unify the XBOX and UEFI linear framebuffer support together (#8509)
CORE-11954, CORE-16216

Here only moving and adjusting existing code has been done.
In the future, this code will be expanded to support other bits-per-pixel
formats and pixel bitmasks, available in UEFI platforms, and be used to
handle bios-based PC VESA framebuffer.
2025-12-19 13:21:23 +01:00
Hermès Bélusca-Maïto
9e64fa837d [FREELDR:XBOX] Fix compilation dependencies and linking for the XBOX build (#8510)
CORE-16216

machpc.c:
- Surround more PC-specific routines in `#if !defined(SARCH_XBOX)`,
  so that they aren't compiled for XBOX.

- In particular since commit 246f2d29db (PR #8418), the PC-specific
  `DiskGetConfigType()` was compiled at the same time as the XBOX one.
  This is now fixed.

machxbox.c
- Add a dummy `ChainLoadBiosBootSectorCode()` to make freeldr exports working.

xboxdisk.c
- Minimal Disk I/O error support routines.
- Add a dummy `DiskResetController()`, invoked in pchw.c
- Add a dummy `DiskStopFloppyMotor()`, needed for entry.S/linux.S

miscboot.c
- Still compile `LoadAndBootSector()` (avoids lots of changes elsewhere),
  but display an error message if it's run, and directly return with an error.

pcat.cmake
- Remove unnecessary dependencies on pcdisk.c and pcvesa.c
2025-12-19 12:15:02 +01:00
Hermès Bélusca-Maïto
f7aa25044e [FREELDR:PC] pcvideo.c!PcVideoSetMode(): deduplicate VESA mode setting code (#8508)
Group VESA text/graphics modes setting together.
2025-12-18 16:40:44 +01:00
Hermès Bélusca-Maïto
b050a4544e [FREELDR:PC] Add a mechanism to retrieve the initial video mode on startup (#8506)
This allows FreeLoader to know which initial video mode it has been
started with (e.g. if chainloaded from another bootloader that has
set the display to something different from 80x25 text mode), and,
either update its internal state and use the video mode if supported,
or, fall back to a known supported video mode (80x25 text).
2025-12-18 16:36:05 +01:00
Hermès Bélusca-Maïto
e04838086a [FREELDR:PC] pcvideo.c: Move PcVideoVesaGetSVGAModeInformation() and PcVideoSetBiosVesaMode() at the top
Will be used in the next commit.
2025-12-18 16:35:55 +01:00