Commit graph

353 commits

Author SHA1 Message Date
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 5dd0b32799
[FREELDR] EMS boot options: Parse NT kernel load options in a consistent manner. Addendum to d887308b.
In particular the parsing should not care about the letter case.
2020-12-27 00:51:57 +01:00
Hermès Bélusca-Maïto 4792c007aa
[FREELDR] Add the possibility to change the boot load options from TXTSETUP.SIF
at runtime from the boot selection menu or from FREELDR.INI.

CORE-17350, CORE-9023

For a proper override of the options by new user options, specify the
/SIFOPTIONSOVERRIDE switch in addition. Otherwise, user options are
merged with those retrieved from TXTSETUP.SIF, with priority given to
the former ones.

- Update the documentation for the 'ReactOSSetup' OS type in the
  FREELDR.INI file template.

- Use a different prompt in the custom boot options editor for the
  'ReactOSSetup' OS type, with adequate explanation.

- Get rid of the ReactOS-specific TXTSETUP.SIF 'DbgOsLoadOptions' value,
  and use instead the Windows-compatible 'SetupDebugOptions' value that
  is added to the other load options when debugging is to be enabled.
2020-11-04 19:59:28 +01:00
Hermès Bélusca-Maïto d45b268127
[FREELDR] Fix x64 compilation warning (addendum to commit d887308b). 2020-11-04 19:59:27 +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
Hermès Bélusca-Maïto d8547a8f20
[FREELDR] In LoadReactOSSetup(), verify that our BootType is really ReactOSSetup. 2020-11-03 01:52:47 +01:00
Hermès Bélusca-Maïto 3033580c1a
[FREELDR] Minor code formatting / renaming some variables. 2020-11-03 01:52:46 +01:00
Hermès Bélusca-Maïto 04b4e3b05d
[FREELDR] Fix the parameter type of WinLdrSetupEms()
It's a NULL-terminated string. And thus avoid an unelegant cast.
2020-11-03 01:52:36 +01:00
Hermès Bélusca-Maïto 58866a112a
[FREELDR] Remove the 'Setup' parameter of the LoadAndBootWindowsCommon() function.
This parameter is not needed since it's possible to determine, from
within this function, whether or not we are in Setup mode, by just
looking for the presence of a non NULL LoaderBlock->SetupLdrBlock.
2020-11-03 01:51:48 +01:00
Hermès Bélusca-Maïto 64ca7f6427
[FREELDR] Remove trailing whitespace. 2020-11-03 01:51: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
Stanislav Motylkov 8a4273b6ee
[FREELDR] Add variable for default text color
On PC/AT-compatible machines it's Gray, and on NEC PC-98 series it's White.
2020-10-17 19:28:08 +03:00
Stanislav Motylkov db1b04340f
[FREELDR] Use BIOS font and accelerated text drawing on NEC PC-98
Both features are switchable via global variables.
2020-10-17 19:28:05 +03:00
Serge Gautherie 889b077b23
[REACTOS] *.spec: Fix some function/parameter types (#3154) 2020-09-20 19:21:11 +02:00
Timo Kreuzer 2aca4b2795 [ASM] Fix boot with VS 16.7.3 / MSVC 19.27
See https://developercommunity.visualstudio.com/content/problem/1180800/ml-x86-assume-directive-causes-invalid-code-genera.html
2020-09-12 15:01:04 +02:00
Stanislav Motylkov 2a77e359e4
[XBOX] Move NV2A XGPU definitions into header file
TODO: helper functions should be also moved. CORE-16216
2020-08-26 16:58:01 +03:00
Stanislav Motylkov f420f2e5df
[XBOX] Move SuperIO definitions and helpers into header file
CORE-16216
2020-08-26 02:06:19 +03:00
Thomas Faber 794d00c303
[FREELDR][NETKVM][ATL_APITEST] Pick the GCC code path for clang in some cases. CORE-17202 2020-08-23 12:07:37 +02:00
Thomas Schneider a245c98fc6
[FREELDR] Bootsector fix for CHS read on old BIOSes which lack INT 3e (#3078)
At line 263 a 'pop es' is missing before 'ret' in ReadCHS() function,
just like in the ReadLBA() function. CORE-17178

Co-authored-by: Dmitry Borisov <di.sean@protonmail.com>
2020-08-19 19:10:02 +03:00
Stanislav Motylkov 415c737cc3
[FREELDR] Add display controller detection for Xbox
Also add system identifier here.

[BOOTDATA] Fix some typos

CORE-16216
2020-06-09 22:02:09 +03:00
Stanislav Motylkov 092bc78a42
[FREELDR] Fix register offset
Addendum to 10e52f6.
2020-06-03 02:04:07 +03:00
Hervé Poussineau 468b8f3719 [FREELDR] Fix I/O range size of serial ports 2020-05-17 23:08:26 +02:00
Dmitry Borisov 98c17d3120
[FREELDR] Add vertical screen scrolling for Xbox with console mode (#2745)
Also turn off debug messages to screen before setting up the CPU (To print a character to the screen on some ports the MMIO access should be executed, so it throws an exception).

CORE-16216
2020-05-10 18:35:51 +02:00
Stanislav Motylkov 10e52f68b2
[FREELDR] Fix some more register accesses and magic values
Addendum to 764e884.
2020-05-08 23:02:42 +03:00
Joachim Henze 7c81fb8f56 [FREELDR] Workaround regression CORE-16469
This prevents ReactOS asserting when 'My computer'
is opened, while it tries to send commands to floppy drive.

Many thanks to patches author Doug Lyons.

The regression was introduced by 0.4.13-dev-1081-g
eeff926ede

patch was committed to 0.4.13rls and 0.4.14rls as well.

Today it was committed to master as well, as
the initially planned investigation for the root cause
did still not happen and we can not afford the time
to retest and workaround this over and over again.
Thank god that Oleg Dubinskiy was still around to retest
this again and confirmed it can still happen, because
unlike initially, personally I was not able to reproduce it
today anymore!

Since every release was work-arounded, we did never
expose the bug in any final release.
2020-05-06 23:45:37 +02:00
Stanislav Motylkov 764e884f5e
[FREELDR] Work with Xbox GPU memory registers properly
Bug was noticed with GCC 8.4
2020-05-02 23:23:33 +03:00
Dmitry Borisov 4501bbac8f
[KDCOM][NTOS:INBV][FREELDR] Decrease default baud rate for PC-98 target (#2601)
According to PC-9801 Bible p. 50, divisor for PIT will become unsupported in some cases after having removed the fractional part. Replace 19200 value with 9600 which is supported by both 10 MHz and 8 MHz machines.
2020-04-21 23:22:42 +03:00
Dmitry Borisov 61d966bf1a
[FREELDR] Fix typos and PC-98 boot (#2564)
- INT 18h, AH=A0h doesn't exist, it was meant to be AH=0Ah. Thanks to SimK (@simk98l) on twitter for bug reporting and fix.
- Adress -> Address.
2020-04-17 20:27:20 +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
Adam Słaboń 7b24d00ef1
[FREELDR][INSTALL][FDEBUG] Include FreeLDR tools in LiveCD and HybridCD (#2550)
It might be useful to have them on LiveCD/HybridCD as well.
2020-04-15 12:37:21 +02: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
Mas Ahmad Muhammad b8dd046ee4
[TRANSLATION] Add and update Indonesian translations (#2506)
- CMDUTILS: attrib, label (update translation)
- USETUP (add translation)
- HOTPLUG (add translation)
- CONSRV  (update translation)
- USERSRV (update translation)
- USER32  (update translation)
- ACLUI  (update translation)
- LICCPA  (update translation)
- SUBST  (update translation)
- REGSVR32  (update translation)
- REGEDIT-CLB  (update translation)
- ACPPAGE  (update translation)
- TIMEDATE  (update translation)
- SOLITAIRE  (update translation)
- FDEBUG  (update translation)
- SYSSETUP (update translation)
2020-04-09 18:49:45 +02:00
Vadim Galyant 305e856ef8
[FREELDR] Add parsing boot options from .ini files. (#2511)
Co-Authored-By: Stanislav Motylkov <x86corez@gmail.com>
2020-04-09 16:25:25 +02:00
Mark Jansen 177ae91bf6
[RTL] Introduce RtlpImageNtHeader,
which implements the required functionality.
ntdll and ntoskrnl now have a wrapper for this, with SEH.
This protects the function against malformed / bad images,
whilst still being able to use the code in freeldr et al.
Idea from Thomas.
CORE-14857
2020-03-29 21:27:38 +02: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 97eacb9fb4 [FREELDR] Minor code improvements
- Add missing allocation check in DetectApmBios()
- Check 'PM' signature in FindApmBios()
- Properly set machine type in hardware detection
- Set Component->Key value for hard drives
- Get rid of the unused XboxBeep()
- Cast Xbox LPC I/O ports to PUCHAR
- Improve shadow rendering with VGA font
- Include ntoskrnl.h in the proper order
2020-03-07 00:52:40 +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
Hermès Bélusca-Maïto 93beefacbe
[CMAKE][FREELDR] Take the global defines into account when compiling ASM files.
Now the SARCH_xxx can be used in ASM files too.
Dedicated to Dmitry Borisov ;)
2020-03-06 22:55:12 +01:00
Dmitry Borisov 222e79232c
[CPORTLIB][NTOS:INBV][KDCOM][FREELDR] Add ComPort library for NEC PC-98 series (#2407)
There are 2 known serial ports:
    COM1 - based on Intel 8251A
    COM2 - National Semiconductor 16550
2020-03-06 19:50:31 +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
Victor Perevertkin 1d069269f5
[FREELDR] Fix build by adding a missing header 2020-02-15 18:25:57 +03: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 a55bab8d1d
[FREELDR] Fix IDE driver failures on real hardware. (#2255)
- Changes in device detection code:
    * Properly check device signature.
    * Сorrectly reset the IDE controller.
    * Remove check for device type code.
- Fix CD-ROM sector read issue:
    * Changed ATAPI packet opcode to be more universal (Some devices may not have READ12 support).
    * Always use 2048 bytes as sector size when reading the data from a disc.
    * Modify WaitForFlags() to stop polling if the error bit was set.
    * Changed timeout to 31 seconds (ATA default value).
- Add more informational messages in DEBUG mode.
- Fix invalid IDE register value.
- Fix registers names.

Tested by Stanislav Motylkov and Daniel Reimer on XQEMU and on real
hardware MS Xbox revision 1.3 with Philips DVD drive.
It has also been tested manually on PC with a SONY DVD drive.

CORE-16628 CORE-16216
2020-02-13 18:10:02 +01:00
Dmitry Borisov dc81ecf84b
[FREELDR] Fix indentation. No code changes 2020-02-13 18:10:01 +01:00
Dmitry Borisov e00ea7dadd
[FREELDR] Properly set keyboard flags in hardware detection (#2288)
See https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_cm_keyboard_device_data
2020-01-29 16:49:31 +01:00
Hermès Bélusca-Maïto 94dab57ef9
[FREELDR] Rework BTRFS filesystem to not be tied to a fixed global volume. CORE-16646 2020-01-26 18:48:17 +01:00
Hermès Bélusca-Maïto f4fdc957c5
[FREELDR] Use RTL copy/zero-memory helper functions. 2020-01-26 18:48:14 +01:00
Hervé Poussineau 46fdc89e4f [FREELDR] Comment out useless variable 2020-01-22 20:56:51 +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
Stanislav Motylkov afdb42023c [FREELDR][XBOXVMP] Check only low 28 bits for framebuffer address (#2249)
Fixes framebuffer detection on real hardware Xbox.
2020-01-14 20:20:22 +01:00
disean e5c0052466 [HAL][FREELDR] Fix system timer oscillator frequency on a Xbox (#2245)
See https://xboxdevwiki.net/Porting_an_Operating_System_to_the_Xbox_HOWTO#Timer_Frequency
2020-01-14 18:47:36 +01:00
disean 7c93350e05 [FREELDR] Cache INT13h drive data in pcdisk.c (#2097)
* [FREELDR] Cache the drive geometry in the PcDiskReadLogicalSectorsCHS()

Speed up the loading time a bit.

* [FREELDR] Generalize the cache to all the geometry data + INT 13h extensions-supported status.

The data structure used is "PC_DISK_DRIVE".

- Adapt the associated functions;
- Make DiskGetExtendedDriveParameters() private to pcdisk.c

- Introduce PcDiskDriveNumberToDrive(), that is similar to the XBOX
  function XboxDiskDriveNumberToDeviceUnit(), that retrieves a valid
  pointer to the cached disk corresponding to the given BIOS DriveNumber.
  If needed the cached data gets initialized.

- Make XboxDiskDriveNumberToDeviceUnit() simpler by just returning the
  pointer to the corresponding drive, of NULL if there is none.

Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2020-01-14 04:08:53 +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
Serge Gautherie fa2e4e9537
[FREELDR] Update ACPI Extended Attributes support to 6.3 (#1782)
Update BIOS_MEMORY_MAP and PcMemGetBiosMemoryMap() from ACPI 6.2-A to ACPI 6.3.

Co-Authored-By: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2020-01-01 21:43:28 +01:00
Hermès Bélusca-Maïto 60fbf459c3
[FREELDR] Simplify the PrintText() and FrLdrBugCheckWithMessage() routines by using a new PrintTextV() helper. 2020-01-01 21:15:05 +01:00
Serge Gautherie ad43210b41
[FREELDR] Reimplement i386PrintText(), adding line wrap handling. CORE-16268
Co-Authored-By: Stanislav Motylkov <x86corez@gmail.com>
2020-01-01 21:14:08 +01:00
Serge Gautherie 043307624f
[FREELDR] xboxcons.c, i386bug.c: Formatting and whitespace fixes.
Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2020-01-01 21:12:24 +01:00
Stanislav Motylkov 96692636e4 [FREELDR] Obtain Xbox memory map via multiboot spec (#1971)
- Also obtain framebuffer memory size the same way.

References:
https://wiki.osdev.org/Detecting_Memory_(x86)#Memory_Map_Via_GRUB
https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#Boot-information-format

CORE-16216 CORE-16300
2019-12-31 16:10:34 +01:00
Hermès Bélusca-Maïto ff722ac72e
[FREELDR] Support setting up the EBP register on INT386() entry only if EBP != 0, otherwise use it only as output. 2019-12-23 21:06:40 +01:00
Dmitry Borisov 96040ecff9 [FREELDR] Fix triple fault with debug on screen
Move the trace call after the MachInit()
CORE-16507
2019-11-13 22:52:20 +01:00
Mark Harmstone 77e2dc42a0 [FREELDR] Use less memory when doing unaligned reads on Btrfs 2019-10-30 22:57:25 +03:00
Stanislav Motylkov 183a81ee82 [FREELDR] MiniTui: Fix progress bar width on custom resolutions (#1964)
+ Sync with the "direct-UI" i.e. with less bugs.
Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2019-10-23 13:54:33 +02:00
Mark Harmstone 43a8d871bf
[FREELDR] Set LDRP_IMAGE_INTEGRITY_FORCED if necessary. (Part of PR #1905)
+ Add extra information.
Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2019-10-14 00:49:00 +02:00
Hermès Bélusca-Maïto 3c9e562bd3
[FREELDR] Fix build with the 'Grossly Crying Compiler' (aka. GCC). 2019-10-13 21:07:23 +02:00
Hermès Bélusca-Maïto c85ef31f6a
[FREELDR] Improvements for GDT descriptors initialization.
Triggered by a fix attempt by M.Harmstone in PR #1905.

- Introduce #defines and helper functions so as to initialize the
  descriptors in a human-readable and tractable way, without magic values.

- Rework some comments.

- Document what the changes are in (Longhorn and) Vista+.

Data has been obtained through using the WinDbg command: dg 0x00 0xFF
(for example), that lists all the selectors from 0x00 to 0xFF included.
See https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/dg--display-selector-
for more details.
2019-10-13 19:57:54 +02:00
Stanislav Motylkov 297abde716 [FREELDR][XBOXVMP] Retrieve screen resolution directly from NV2A GPU (#1962)
CORE-16216
2019-10-09 23:27:22 +02:00
Hermès Bélusca-Maïto 7909284220
[FREELDR] Advance the file pointers every time a read operation is performed, in accordance with the ARC specification. 2019-10-09 03:26:48 +02:00
Hermès Bélusca-Maïto db15c921e8
[FREELDR] Improvements for the RamDisk support.
- Implement support for the "RDIMAGELENGTH" and "RDIMAGEOFFSET" boot
  options. Fixes CORE-15432.

- Separate the initialization of the global gInitRamDiskBase /
  gInitRamDiskSize variables from the FreeLdr command-line, and the
  actual initialization of the internal variables of the RamDisk.
  The latter are initialized via calls to RamDiskInitialize().

- Implement 'SeekRelative' mode in RamDiskSeek().

- Make RamDiskLoadVirtualFile() internal function that gets called by
  RamDiskInitialize(), and we use the latter in the NT loader instead.
2019-10-09 03:26:41 +02:00
Stanislav Motylkov 034820ca55 [FREELDR] Xbox memory management improvements (#1961)
- Reuse the framebuffer address that was set up by the firmware.
- Get rid of XboxMemReserveMemory() and use ReserveMemory() instead.

CORE-16216
2019-10-09 02:35:07 +02:00
maharmstone 90ac794bf2 [FREELDR] Handle Btrfs sparse extents (#1959) 2019-10-08 16:50:57 +02:00
Hermès Bélusca-Maïto 63e22b8287
[FREELDR] Add support for loading Linux in x64 FreeLdr. Part 2/2: C code.
- Re-enable custom and Linux boot menu entries.
- Fix compilation and add address limit checks for x64 build of linux loader.
2019-10-08 01:30:25 +02:00
Hermès Bélusca-Maïto 0d6631c2da
[FREELDR] Fix an inconsistency bug when switching the CPU state back to 16-bit real mode.
Basically it appeared that without this fix, the CPU was somehow residing
in an inconsistent state, that made it crash when a full 16-bit real-mode
to 32-bit protected mode transition occurred. (Encountered when trying
to load Linux, see problem description below.)
In that situation, Bochs reports that the CPU is in "compatibility mode".

The fix is based from information from Fig.1-6 "Operating Modes of the
AMD64 Architecture" (page 12) and Chapter 14 (pages 429-446) of the
"AMD64 Architecture Programmer’s Manual Volume 2: System Programming"
https://www.amd.com/system/files/TechDocs/24593.pdf

*** THE PROBLEM ***

When booting Linux using x86 FreeLdr everything goes well.

When trying to do the same using x64 FreeLdr, the Linux code (both the
boot sector, the setup sector and the main kernel contents) is all
correctly loaded and relocated in memory as in the x86 case. We then pass
control to the decompressing code that appears to succeed. However, once
it has finished and "Parsing ELF file..." step has been run, the next
step "Booting the kernel..." crashes with a CPU Triple-Fault.

This problem **DOES NOT HAPPEN** when booting from GRUB.

Log excerpt from Bochs:

<snip>

00089459736i[BIOS  ] Booting from 07c0:0000
00089782775i[SER   ] com1: FIFO enabled
00095994535i[BIOS  ] int13_harddisk: function 41, unmapped device for ELDL=81
00095998517i[BIOS  ] int13_harddisk: function 08, unmapped device for ELDL=81
00397139785i[BIOS  ] KBD: unsupported int 16h function 03
00397143625i[BIOS  ] *** int 15h function AX=e980, BX=0000 not yet supported!
00523008104e[CPU0  ] interrupt(long mode): vector must be within IDT table limits, IDT.limit = 0x0
00523008104e[CPU0  ] interrupt(long mode): vector must be within IDT table limits, IDT.limit = 0x0
00523008104i[CPU0  ] CPU is in compatibility mode (active)
00523008104i[CPU0  ] CS.mode = 32 bit
00523008104i[CPU0  ] SS.mode = 32 bit
00523008104i[CPU0  ] EFER   = 0x00000500
00523008104i[CPU0  ] | RAX=00000000e0000011  RBX=0000000000000000
00523008104i[CPU0  ] | RCX=0000000000000000  RDX=0000000000000000
00523008104i[CPU0  ] | RSP=00000000004f8000  RBP=000000000082e003
00523008104i[CPU0  ] | RSI=0000000000099800  RDI=00000000c0611000
00523008104i[CPU0  ] |  R8=0000000000109000   R9=0000000000009020
00523008104i[CPU0  ] | R10=00000000000007e3  R11=000000000000e958
00523008104i[CPU0  ] | R12=0000000000000000  R13=0000000000000000
00523008104i[CPU0  ] | R14=0000000000000000  R15=0000000000000000
00523008104i[CPU0  ] | IOPL=0 id vip vif ac vm RF nt of df if tf SF zf af PF cf
00523008104i[CPU0  ] | SEG sltr(index|ti|rpl)     base    limit G D
00523008104i[CPU0  ] |  CS:0010( 0002| 0|  0) 00000000 ffffffff 1 1
00523008104i[CPU0  ] |  DS:0018( 0003| 0|  0) 00000000 ffffffff 1 1
00523008104i[CPU0  ] |  SS:0018( 0003| 0|  0) 00000000 ffffffff 1 1
00523008104i[CPU0  ] |  ES:0018( 0003| 0|  0) 00000000 ffffffff 1 1
00523008104i[CPU0  ] |  FS:0018( 0003| 0|  0) 00000000 ffffffff 1 1
00523008104i[CPU0  ] |  GS:0018( 0003| 0|  0) 00000000 ffffffff 1 1
00523008104i[CPU0  ] |  MSR_FS_BASE:0000000000000000
00523008104i[CPU0  ] |  MSR_GS_BASE:0000000000000000
00523008104i[CPU0  ] | RIP=0000000000409327 (0000000000409327)
00523008104i[CPU0  ] | CR0=0xe0000011 CR2=0x0000000000409327
00523008104i[CPU0  ] | CR3=0x005b5000 CR4=0x000000a0
00523008104i[CPU0  ] 0x0000000000409327: (instruction unavailable) page not present
00523008104p[CPU0  ] >>PANIC<< exception(): 3rd (13) exception with no resolution

<snip>
2019-10-08 01:30:15 +02: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 21c51eed05
[FREELDR] Several changes regarding chainloading and Linux boot.
- Introduce "Relocator16Boot()". So far its aim is just to correctly set
  the CPU state (segments, registers, flags) to what is expected by a
  given boot image before running it.
  This function can be seen as the embryonic state of a future boot relocator
  (see e.g. GRUB or SYSLINUX) that would also relocate the boot image at
  the correct places. (Such feature is needed when boot images have to
  be loaded in memory areas that cover where the boot loader is in memory.)

- Implement ChainLoadBiosBootSectorCode() around it.

- Replace BootOldLinuxKernel() and BootNewLinuxKernel() by a new
  BootLinuxKernel() function (in assembly) that relocates the kernel
  to a given position and then boot it, using Relocator16Boot().
  Ideally the relocation should be done by a future boot relocator...

Implementation notes for Relocator16Boot():
===========================================

For setting the CPU state the function is based on a similar code as the
Int386() helper, namely it takes a pointer to REGS structure and pass
this information through the 32->16 bits call before setting the CPU state
in accordance.
New stack segment/pointer and code segment/pointer are also specified.
For passing these values through the 32->16 bits call the 16-bit BSS
memory offsets "BSS_CallbackReturn" and "BSS_RealModeEntry" (respectively)
are reused.
2019-10-07 02:54:07 +02:00
Hermès Bélusca-Maïto 2d1a6b2db9
[FREELDR] NT loader: Allocate the Loader Block Extension much earlier in the process. 2019-10-06 18:24:48 +02:00
Hermès Bélusca-Maïto eeeca29c6c
[FREELDR] INFFILE Parser: Fix while-loop conditions, this bug existed for 16+ years (commit 939d5316, revision 4758). 2019-10-06 18:18:34 +02:00
Mark Harmstone 9ad0dd1856
[FREELDR] Retrieve the correct ACPI RSDP table address. (#1951)
Use either the RSDT (ACPI 1.0) or the XSDT (ACPI >1.0).
This fixes ACPI issues with Vista on VirtualBox.
2019-10-05 23:20:53 +02:00
Mark Harmstone f551caa840
[FREELDR] Load the Firmware Errata file specified in the registry. (#1951)
On Windows <= 2003 (and current ReactOS), this is the "InfName" value
in the "HKEY_LOCAL_MACHINE\CurrentControlSet\Control\BiosInfo\" key.
(The default file name found there is 'biosinfo.inf'.)

On Vista+, this is the "InfName" value in the
"HKEY_LOCAL_MACHINE\CurrentControlSet\Control\Errata\" key.
(The default file name found there is 'errata.inf'.)

For 1st-stage setup, the file is specified in the "InfName" value of
the "BiosInfo" section in the TXTSETUP.SIF file.

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2019-10-05 23:20:53 +02:00
Mark Harmstone 22fbfb0df9
[FREELDR] Insert DLLs into load order before what references them. (#1951) 2019-10-05 23:20:52 +02:00
Mark Harmstone fc9c3fe6f7
[FREELDR] Set LDRP_DRIVER_DEPENDENT_DLL where necessary. (#1951) 2019-10-05 23:20:52 +02:00
Mark Harmstone b3f45a25c5
[FREELDR] Fix bug in Btrfs filename lookups. (#1951) 2019-10-05 23:20:51 +02:00
Pierre Schweitzer 17db4217a8
[FREELDR] Stop asking people to report bugs on ros-dev@reactos.org
That should be merged to 0.4.13
2019-10-03 02:55:45 +02:00
Victor Perevertkin 220bc820eb [FREELDR] Optimize and refactor the FAT driver.
Do not read the whole cluster chain for file on opening.
This removes restriction for opening files which span
within a large amount of clusters (>65k). That happened because
FrLdrTempAlloc cannot allocate more than about 256 KiB of memory.

Adjacent clusters for file are now read using one disk driver call.
2019-09-29 13:24:31 +03:00
Victor Perevertkin 195dc30484 [FREELDR] Add FAT caching to FAT filesystem driver.
This significantly increases the reading speed
2019-09-29 13:24:31 +03:00
Eric Kohl 2ed695fc83 [FREELDR] Hack: Boot ReactOS even when a cdrom-drive does not report a proper geometry
We need to find a way to retrieve the LBA sector count of a drive, not only its CHS geometry.
2019-09-19 23:27:11 +02:00
Hermès Bélusca-Maïto 658d5a3ff5
[FREELDR] Rename the PE loader functions 'PeLdr*' instead of 'WinLdr*'. 2019-09-19 02:53:57 +02:00
Hermès Bélusca-Maïto e18e7b100c
[FREELDR] Implement 'SeekRelative' mode for the *Seek() methods for disks & filesystems. 2019-09-18 02:42:56 +02:00
Hermès Bélusca-Maïto dd46d40fd2
[FREELDR] Addendum / actual fix for ef76709b
According to the Advanced RISC Computing Specification v1.2, for partitions,
StartingAddress and EndingAddress are the start and end positions of the
partition in terms of byte offsets from the start of the disk.
CurrentAddress is the current offset into (i.e. relative to) the partition.

Fix also the FAT filesystem in accordance.

- FIXME fix: Retrieve the size of the disk in number of sectors in DiskOpen().
- Add extra validity checks in the DiskSeek() functions.
- Explicitly call PcDisk* functions in machpc.c and pcdisk.c, and
  XboxDisk* functions in machxbox.c (the code in these files is not
  called cross-platform).

CORE-16216 CORE-16248
2019-09-18 01:12:58 +02:00
Hermès Bélusca-Maïto ff85aa0c38
[FREELDR] Other enhancements.
- Modify DiskReportError() to use an internal "display counter", so that
  imbricated DiskReportError(FALSE) ... DiskReportError(TRUE) can behave
  as expected.
- Merge LoadAndBootDrive(), LoadAndBootPartition(),
  LoadAndBootBootSector() into one LoadAndBootDevice() function + its
  helpers (in progress...).
2019-09-18 00:27:53 +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 a9411fb658
[FREELDR] Minor code style - use RtlZeroMemory(); shorter member name; use different debug channel. 2019-09-13 15:18:28 +02:00
Hermès Bélusca-Maïto eeff926ede
[FREELDR] Limit the usage of DiskStopFloppyMotor() in hardware/platform-specific code.
- Move DiskStopFloppyMotor() calls into the implementations of
  Boot(New)LinuxKernel() and Reboot() HW functions, and the explanation
  comments in ChainLoadBiosBootSectorCode().

- Remove unneeded DiskStopFloppyMotor() dummies in ARM and PPC code.

- Use more adequate bitmask value to be sent to floppy's Digital Output
  Register for shutting down its motor (based on OSDev & our floppy
  controller driver).
2019-09-13 15:18:27 +02:00
Hermès Bélusca-Maïto 4843c1a954
[FREELDR] Other enhancements.
- Add optional arguments BootDrive and BootPartition to
  ChainLoadBiosBootSectorCode() so as not to modify explicitly the
  FrldrBootDrive and FrldrBootPartition variables, that should remain
  purely internal.

- Implement ChainLoadBiosBootSectorCode() for x64.

- Get rid of the machine-specific DiskGetBootPath(), and instead do its
  job only once in the machine-specific InitializeBootDevices() (or in
  MachInit() for PPC).
  Cache the result of this operation into the globally-accessible
  FrldrBootPath buffer. This avoids the unneeded calls to (Mach)DiskGetBootPath()
  we used to do before.
  Also remove the separate distinction between the PC and XBOX versions
  of this functionality.

- Move the PC-specific DiskIsDriveRemovable() and DiskGetBootPath()
  as well as the disk-IO-error functionality, back into the
  corresponding PC-arch files.

- Simplify IniFileInitialize(), getting rid of IniOpenIniFile().
2019-09-13 15:18:07 +02:00
Hermès Bélusca-Maïto bd451f240f
[FREELDR] Code fixes and enhancements.
CORE-9023

FIXES:
======

- Fix parsing of the multiboot options string.
  NOTE: They are not yet treated in a case-insensitive manner!

- Fix a bug in ArcOpen() so that it correctly skips the first path
  separator (after the adapter-controller-peripheral ARC descriptors).
  The path separator can be either a backslash or a slash (both are
  allowed according to the specs); they were also already handled
  correctly in other parts of the code.

- Fix DissectArcPath() so as to:
  * **OPTIONALLY** (and not mandatorily!) return the path part that follows
    the ARC adapter-controller-peripheral elements in the ARC path;

  * make it correctly handle the (yes, optional!!) partition() part in the
    ARC path, for the multi(x)disk(y)rdisk(z) cases.

ENHANCEMENTS:
=============

- Directly retrieve the default OS entry as we enumerate them and
  build their list (i.e. merge the GetDefaultOperatingSystem() helper
  within InitOperatingSystemList()).

- Directly use the opened 'FreeLoader' INI section via its ID in the
  different functions that need it.

- Make the custom-boot and linux loaders honour the boot options they are
  supposed to support (see FREELDR.INI documentation / template).
  This includes the 'BootDrive' and 'BootPartition' (alternatively the ARC
  'BootPath').
  This also allows them to take into account the user-specified choices in the
  FreeLdr custom-boot editors.

- Modify the FreeLdr custom-boot editors so as to correctly honour
  the  priorities of the boot options as specified in the FREELDR.INI
  documentation / template.

- Use stack trick (union of structs) to reduce stack usage in the
  FreeLdr custom-boot editors, because there are strings buffers that are
  used in an alternate manner.

- Extract out from the editors the LoadOperatingSystem() calls, and
  move it back into OptionMenuCustomBoot(), so that when this latter
  function is called there is no risk of having a stack almost full.

- When building the ARC-compatible argument vector for the loaders, add
  the mandatory "SystemPartition" path. This allows the loaders to NOT
  call the machine-specific MachDiskGetBootPath() later on (this data is
  indeed passed to them by the boot manager part of FreeLdr).

- Improve the FsOpenFile() helper so as to make it:
  * return an adequate ARC_STATUS instead of a mere uninformative BOOLEAN;
  * take open options, as well as a default path (optional) that would be
    prepended to the file name in case the latter is a relative one.

- Make RamDiskLoadVirtualFile() return an actual descriptive ARC_STATUS
  value, and make it take an optional default path (same usage as the one
  in FsOpenFile() ).
  + Remove useless NTAPI .

- UiInitialize() and TuiTextToColor(), TuiTextToFillStyle(): load or
  convert named settings into corresponding values using setting table and
  a tight for-loop, instead of duplicating 10x the same parameter reading
  logic.

- UiInitialize(): Open the "Display" INI section just once. Remove usage
  of DisplayModeText[] buffer.

- UiShowMessageBoxesInSection() and UiShowMessageBoxesInArgv(): reduce
  code indentation level.

ENHANCEMENTS for NT OS loader:
==============================

- Don't use MachDiskGetBootPath() but use instead the "SystemPartition"
  value passed via the ARC argument vector by the boot manager
  (+ validation checks). Use it as the "default path" when calling
  FsOpenFile() or loading the ramdisk.

- Honour the FreeLdr-specific "Hal=" and "Kernel=" options by converting
  them into NT standard "/HAL=" and "/KERNEL=" options in the boot
  command line.

  Note that if the latter ones are already present on the standard "Options="
  option line, they would take precedence over those passed via the separate
  "Hal=" and "Kernel=" FreeLdr-specific options.

  Also add some documentation links to Geoff Chappell's website about
  how the default HAL and KERNEL names are chosen depending on the
  detected underlying platform on which the NT OS loader is running.
2019-08-31 01:42:46 +02:00
Hermès Bélusca-Maïto 602fc29ad4
[FREELDR] Formatting only. 2019-08-31 01:42:40 +02:00
Hermès Bélusca-Maïto 98a44b4f9b
[FREELDR] Update the FREELDR.INI documentation / template. 2019-08-31 01:42:23 +02:00
Hermès Bélusca-Maïto 41ad62ea69
[FREELDR] Move around & static-ify some disk/partition functions. 2019-08-31 00:25:06 +02:00
Mark Jansen 93b2d5597e
[FREELDR][ARM] Suppress error about unused var 2019-08-20 22:28:11 +02:00
Mark Jansen 28b866cc9c
[CMAKE] Add explicit failure message
Previously this would show up as dependency cycle
2019-08-20 22:28:10 +02:00
Hermès Bélusca-Maïto dca43193c8
[FREELDR] Demote the ArcOpen() trace in WinLdrLoadImage() to a warning only. 2019-08-18 15:26:25 +02:00
Stanislav Motylkov 87845a1cc2 [FREELDR] Add missing VideoSetTextCursorPosition handler for Xbox
This fixes null pointer call bug, which was revealed in 85d44fc. Spotted by Mark Jansen. CORE-16216

Co-authored-by: Mark Jansen <mark.jansen@reactos.org>
2019-08-17 01:47:34 +02:00
Stanislav Motylkov 7497b81e5b [FREELDR] Add Serial ports detection in DetectIsaBios() (#1829)
CORE-16216
2019-08-16 20:00:25 +02:00
Stanislav Motylkov c08beef1cf [FREELDR] Add PCI BIOS emulation and PCI bus enumeration for Xbox (#1830)
CORE-16216 CORE-16308
2019-08-16 19:14:10 +02:00
Timo Kreuzer cbb7ad6f5b [FREELDR] Improve debug output 2019-08-15 18:04:57 +02:00
Hermès Bélusca-Maïto 423d1e2e09
[FREELDR] Minor fixes.
- Add some forgotten, or move some misplaced ArcClose() calls so as
  to avoid leakages in failure paths. (Thanks to Serge Gautherie for
  having caught some of them.)

- Simplify some code; remove unneeded casts; use string-safe functions.
2019-08-14 16:36:50 +02:00
Hermès Bélusca-Maïto 85d44fca59
[FREELDR] Minor enhancements for disk/partition boot and UI.
- Factor out disk & partition opening in LoadAndBootPartition() and
  LoadAndBootDrive() into a LoadAndBootPartitionOrDrive() helper.

- Use ARC paths and ArcOpen()/ArcRead() instead of calling the
  machine-specific BIOS-oriented DiskGetPartitionEntry() and
  MachDiskReadLogicalSectors() functions to open the disk/partition
  and read their boot sectors.

- Don't forget to close the opened boot sector file in LoadAndBootBootSector().

- Add assertions for DiskReadBufferSize in PcMemFinalizeMemoryMap()
  and EnumerateHarddisks().

- x86/amd64 only:
  * Add a DisableA20 helper for disabling the A20 line, before rebooting
    back, or chain-load a boot sector, into 16-bit world.
    Also pulse the output port of the keyboard controller to clear out
    its state after having set the state of the A20 line.

  * In addition to disabling the A20 line when rebooting or chain-loading
    a boot sector, reset the video back to 80x25 text mode.

- Reset the cursor position back to the origin when initializing or
  terminating the TUI.
2019-08-13 23:07:01 +02:00
Hermès Bélusca-Maïto 7b5fab40c1
Addendum to fba4ad4c. 2019-08-11 22:06:27 +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 8823a0c51e
[FREELDR] Addendum to 31a3f317. 2019-08-10 19:47:49 +02:00
Hermès Bélusca-Maïto 31a3f3177c
[FREELDR] Some changes that accumulated since years in my local copy. Also initialize SetupBlock->ArcSetupDeviceName to some valid value. 2019-08-10 19:15:37 +02:00
Hermès Bélusca-Maïto c9a20ced91
[FREELDR] Rework EXT2 filesystem to interface with ARC and not be tied to the boot volume.
See 28bf1f3b (r42537) and c599bd7d (r43267) for additional information.
2019-08-10 16:41:29 +02:00
Hermès Bélusca-Maïto 8d94b2a68d
[FREELDR] Diverse enhancements.
- Get rid of the FsCloseFile(), FsReadFile(), FsGetFileInformation(),
  FsGetFileSize() and FsSetFilePointer() wrappers and use the ARC
  functions directly instead. Make FsOpenFile() return an ARC file
  descriptor ID of the correct type. Get rid of unused FS_* defines.

- Use TRACEs in the ***Mount() filesystem functions for diagnostics
  purposes.

- Remove a leak in FatGetFatEntry(). Assign stuff via QuadPart where
  possible in FatMount(). Remove an unused member in FAT_FILE_INFO.

- Reduce code indentation in BtrFsMount() and remove a leak there.

- Disable reading the "BootPath" parameter in the linux loader since
  we don't use this parameter (yet??)
2019-08-10 16:41:29 +02:00
Hermès Bélusca-Maïto 75623bb1fa
[FREELDR] Fix erroneous change from d05be0da regarding RAMDISK loading in SETUPLDR.
Restore the correct position of (optional) RAMDISK loading code, before
attempting to open txtsetup.sif since the bootcd ISO might be the RAMDISK.
2019-08-08 23:09:43 +02:00
Victor Perevertkin 304e281099 [FREELDR] Verbose error output for FS errors 2019-08-08 02:33:10 +03: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 15bf4d18d6
[FREELDR] Fix EditBox initial string display length: do not count the NULL-terminator. 2019-08-07 19:18:04 +02:00
Yaroslav Kibysh bc7c689448
[FREELDR] Add ReactOS Setup as a custom boot type. (#1763)
CORE-9023 CORE-16260

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2019-08-07 18:50:26 +02:00
Yaroslav Kibysh b34d516e81
[FREELDR] Add "Edit Boot Command Line" feature. (#1763)
CORE-9023 CORE-16260

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2019-08-07 18:50:23 +02:00
Hermès Bélusca-Maïto 5d5b6a5600
[FREELDR] Some enhancements for the UI code. (#1763)
- EditBox: Display the initial contents of the text buffer.
  This allows modifying already existing text in the passed buffer.

- Menu:
  * Make both MenuHeader and MenuFooter optional (but the latter is
    more "optional" than the former...).

  * Allow passing a user-provided "Context" structure to the key-press
    filter callback, and pass also the index of the menu item that has
    been selected.

- Minor formatting fixes.
2019-08-07 18:50:20 +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 5b326e74cd
[FREELDR] Don't call twice strlen() implicitly (in the min() macro). 2019-08-07 18:49:18 +02:00
Stanislav Motylkov 2811d2f990 [FREELDR] xboxmem: Fix array out-of-bounds access (#1775)
Memory map array should be large enough to fit additional descriptors.

CORE-16216 CORE-16267
2019-08-07 12:06:37 +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
Hermès Bélusca-Maïto d21ffe6336
[FREELDR] Add an INI helper that allows modifying an existing setting's value in memory. 2019-08-06 23:39:53 +02:00
Hermès Bélusca-Maïto 909bfff460
[FREELDR] Some initialization fixes.
- Initialize BootPath and BootOptions buffers when fallback behaviour is not taken.
- Correctly skip all the understood whitespace (space & tabs) and the
  quotes before reading the boot options when using the alternative syntax:

  [Operating Systems]
  section_name = "ReactOS" /bootoptions

  Fixes the minor regression introduced in 370e8564 (r43875).
2019-08-04 17:47:04 +02:00
Hermès Bélusca-Maïto b978d42bd9
[FREELDR] Whitespace, minor code styles and comments fixes only. 2019-08-04 17:47:04 +02:00
Hermès Bélusca-Maïto e79e7bf53c
[FREELDR] Unload freeldr.ini file before booting. 2019-08-04 17:47:03 +02:00
Hermès Bélusca-Maïto 5cdb76094c
[FREELDR] Use NOGUIBOOT when booting in Safe-Mode. 2019-08-04 17:47:03 +02:00
Hermès Bélusca-Maïto b382145539
[FREELDR] Improve some *GetFileInformation() traces. 2019-07-30 00:57:22 +02:00
Stanislav Motylkov ef76709b3d [FREELDR] Fix remaining hwdisk and FATX bugs (#1766)
- DiskGetFileInformation() should return relative addresses -- relative to the beginning of the "device" (partition, or disk) in question.
- FatXSearchDirectoryBufferForFile() should assign file attributes.
- Minor code style improvements in FatOpenVolume().

CORE-16216 CORE-16248

Co-authored-by: Victor Perevertkin <victor@perevertkin.ru>
2019-07-30 00:27:36 +02:00
Stanislav Motylkov 06b77b8572 [FREELDR] Implement proper partition type detection and handling (#1762)
- This allows to detect and dynamically handle different partitioning schemes.
- Implemented detection of MBR, GPT, Xbox-BRFR, and partitionless disks.
- Currently only MBR and Xbox-BRFR partitions are handled and tested.

CORE-9841 CORE-15768 CORE-16216 CORE-16248
2019-07-29 14:25:54 +02:00
Stanislav Motylkov 8f25e464c2 [FREELDR] Trivial improvements (#1757)
* [FREELDR] Fix uninitialized string in DiskGetBootPath()

CORE-16216 CORE-16248

* [FREELDR] xboxdisk: Add comment and fix code style
2019-07-28 18:20:53 +02:00
Timo Kreuzer 8f050e66fd [FREELDR] Use RtlStringCbPrintfA instead of sprintf
Fixes GCC 8 warnings like:
boot/freeldr/freeldr/disk/scsiport.c:806:31: error: 'partition(0)' directive writing 12 bytes into a region of size between 1 and 64 [-Werror=format-overflow=]
     sprintf(PartitionName, "%spartition(0)", ArcName);
                               ^~~~~~~~~~~~
boot/freeldr/freeldr/disk/scsiport.c:806:5: note: 'sprintf' output between 13 and 76 bytes into a destination of size 64
     sprintf(PartitionName, "%spartition(0)", ArcName);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-07-20 13:56:18 +02:00
Stanislav Motylkov 74bcf3083d [FREELDR] Abstract VGA BIOS specific code (#1736)
* [FREELDR] Abstract VGA BIOS specific code

WinLdrSetupSpecialDataPointers() uses INT 10h video interrupts, but they are not available on Xbox, so make them machine-specific.

CORE-16204 CORE-16210

* [FREELDR] Abstract getting extended BIOS data area

WinLdrSetupSpecialDataPointers() uses INT 15h AH=C1h to get extended BIOS data area, but it's not available on Xbox, so make it machine-specific.

CORE-16204 CORE-16210
2019-07-18 23:09:59 +02:00
Stanislav Motylkov 7547f85b7e [FREELDR] Abstract floppy drive detection code (#1735)
Make floppy detection code machine-specific, because Xbox CMOS cannot be used to detect floppies. Based on a patch by Matt Borgerson.

CORE-16204 CORE-16207

Co-authored-by: Matt Borgerson <contact@mborgerson.com>
2019-07-18 22:50:48 +02:00
Stanislav Motylkov bca8093b89 [FREELDR] Fix memory initialization on Xbox
- Refactor and use PC memory map init functions
- This fixes filesystem detection and probably some other problems

Based on a patch by Matt Borgerson.

CORE-16204 CORE-16206

Co-authored-by: Matt Borgerson <contact@mborgerson.com>
2019-07-18 22:49:51 +02:00
Stanislav Motylkov 8c55fdd17c [FREELDR] Whitespace improvements - no code changes 2019-07-18 22:49:51 +02:00
Stanislav Motylkov 31aca248a1 [FREELDR] hwdisk: Add sanity checks to avoid infinite loop (#1731)
CORE-16204 CORE-16205
2019-07-18 22:49:11 +02:00
Victor Perevertkin 12542f271d
[FREELDR] Fix Release build 2019-06-26 00:56:21 +03:00
Yaroslav Kibysh f37fb1f7f8
[FREELDR] Always change video mode back to text-mode before starting up ReactOS.
CORE-16116

- This allows getting the /NOGUIBOOT mode working correctly, as the latter
  expects text-mode. Then, usetup (via BLUE driver) will change to a
  different text-mode, or, GUI boot will change (via BOOTVID) to VGA
  640*480 16-color.

- Always hide the VGA cursor.

- Remove also the deprecated boolean "Setup" in the *PrepareForReactOS()
  functions.

Co-authored-by: Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
2019-06-25 02:32:09 +02:00
Hermès Bélusca-Maïto 2e1f594d5e
[FREELDR] Add some missing UiDrawBackdrop() calls. 2019-04-22 19:33:20 +02:00
Timo Kreuzer f9a967b2ae [REACTOS] Fix misc 64 bit issues 2019-04-13 14:07:50 +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
Adam Słaboń 7047aa80ef [TRANSLATION] Polish translation update
Polish translation update for calc, fltmc, magnify, notepad, osk, sndvol32, usetup, fdebug, appwiz, mmsys, sysdm, acppage, ziplfdr, browseui, cryptui, jscript, shell32, themeui and inf. Added translation for cyrptext, vcdcontroltool, and (not yet complete) getuname.
2019-04-05 10:34:10 +02:00
Hervé Poussineau a15160cd45 [FREELDR] Prevent a warning in Xbox memory initialization 2019-04-01 11:38:32 +02:00
Michael Fritscher 4928e800a6 [FREELDR] PXE: Fix network packet size
1024 bytes should fit into a single network packet. CORE-15706
2019-02-19 16:04:20 +01: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 8077da05e0
[FREELDR] Remove unneeded ASSUME line. 2019-01-31 23:51:00 +01:00
Mark Jansen 71e13274ee [FREELDR] Fix msvc boot (#1329)
CORE-15700
2019-01-31 23:42: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
Hermès Bélusca-Maïto d272866550
[FREELDR] Minor code formatting; constify some non-mutable data. 2019-01-06 18:42:01 +01:00
Luo Yufan 95564d5e30 [TRANSLATION] Update Chinese translation. (#1223)
[CLIPBRD][SOLITAIRE][RAPPS][REGEDIT][WINHLP32][WORDPAD][FDEBUG][SYSDM][BROWSEUI][DEVMGR][IEFRAME][OLEDLG][SHELL32][SYSSETUP][INF][WINFILE][NTVDM][USER32]
2019-01-07 00:35:11 +09:00
Hermès Bélusca-Maïto 5053f1f571
[FREELDR] Simplify code by using a AddReactOSArcDiskInfo() helper, and few extra additions.
- Introduce the AddReactOSArcDiskInfo() helper to get rid of the
  duplicated reactos_arc_disk_info usage scattered amongst different
  files.

- GetHarddiskInformation(): If we cannot read the disk that has been
  enumerated by the BIOS, return a default identifier string.

- GetHarddiskInformation(): The last character of the disk identifier
  string corresponds to whether its MBR is "valid"/has the 0xAA55
  signature (use 'A') or whether it's not (use 'X'). Tested on Windows.

- Split PcInitializeBootDevices() in two: the first part of this
  function that enumerates hard disks from the BIOS is now moved into
  EnumerateHarddisks().

- The 'ValidPartitionTable' field of the ARC disk signature records must
  be initialized with correct value that is specified in the different
  AddReactOSArcDiskInfo() calls.
2019-01-05 19:39:32 +01:00
David Quintana 01e5cb0c04
Resource file strings cleanup (#581)
[CMDUTILS/AT] Fix missing translation strings in certain files.
[NOTEPAD] Fix SUBLANG code to brazillian.
[RAPPS] Fix missing translation strings in certain files.
[FDEBUG] Fix translation string ID.
[CPL/INPUT] Fix missing translation strings in certain files.
[ACPPAGE] Fix incorrect resource IDs.
[NETSHELL] Fix incorrect resource IDs.
[DEVMGR] Fix missing translation strings in certain files.
[LSASRV] Fix missing translation strings in certain files.
[RASDLG] Fix missing translation strings in certain files.
[SHELL32] Fix missing translation strings and incorrect resource IDs.
[TAPIUI] Fix missing translation strings in certain files.
[WINFILE] Fix incorrect resource IDs.
[NTVDM] Fix missing translation strings in certain files.
[USERSRV] Fix missing translation strings in certain files.
[BROWSEUI] One more missing string.
[FLTMC] Fix missing translation strings in certain files.

Detected using the TransDiffer tool (early alpha).
This doesn't include everything anymore, but I wanted to get the PR out of the way.
2019-01-05 15:44:16 +01:00
Timo Kreuzer cfd1647914
[REACTOS] Fix misc 64 bit issues (#783)
* [WIN32K] Fix handle calculation in DbgGdiHTIntegrityCheck
* [NOTEPAD] Fix MSVC warnings
* [PSDK] Simplify *PROC definitions in windef.h
* [VIDEOPRT] Don't try to use NtVdmControl on x64
* [FREELDR] Fix some macros
* [CRT] Make qsort 64 bit compatible
* [NTOS] Use #ifndef _WIN64 instead of #ifdef _M_IX86 around C_ASSERTs
* [FAST486] Fix 64 bit warnings and change DWORD to ULONG, so it can be used in kernel mode
* [APPHELP_APITEST] Fix 64 bit issue
2019-01-05 10:50:11 +01:00
Hermès Bélusca-Maïto 6d5a7b1ce3
[FREELDR] Explicitly call RamDiskInitialize() in RamDiskLoadVirtualFile(). 2018-12-30 15:26:44 +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
Hermès Bélusca-Maïto dd11f4c34b
[FREELDR] Add FreeLdr debug tool GUI program, and FreeLdr command-line installer to the bootcd. 2018-12-10 00:27:58 +01:00
Luo Yufan 39a478d17b [TRANSLATION] Update Simplified Chinese translation. (#1096) 2018-12-05 16:50:05 +01:00
Hermès Bélusca-Maïto f8d3f9de29
[FREELDR] Check for any user keypress in menu even when the timeout is zero.
Before taking any default action if there is no timeout, check whether
the supplied key filter callback function may handle a specific user
keypress. If it does, the menu timeout is cancelled.

This allows e.g. handling F8 press for displaying boot options even when
the timeout is zero.

CORE-14046
2018-11-25 17:09:19 +01:00
Luo Yufan a2819679ec [TRANSLATION] Update Simplified Chinese translation. (#1057) 2018-11-23 16:24:47 +01:00
Ercan Ersoy 89090b1618 [FDEBUG][OSK][WINHLP32] Turkish translations update. (#1022) 2018-11-08 18:52:56 +01:00
Hermès Bélusca-Maïto c34fc6329f
[FREELDR] Silence a debug print. 2018-10-28 18:17:33 +01:00
Hermès Bélusca-Maïto 0b2b53b9c3
[FREELDR] Adjust WinLdrInitSystemHive() and its callers to load at startup either the regular SYSTEM hive, or the SETUPREG.HIV setup system hive.
We now run the 1st-stage setup with a regular system hive, similarly to
what's done for the LiveCD, or for a regular ROS installation.
The ExpInTextModeSetup hacks I previously removed are now completely unneeded.

svn path=/branches/setup_improvements/; revision=74762
2018-10-25 00:40:05 +02:00
Hermès Bélusca-Maïto 5e705d0683
[FREELDR] Small code re-organization for the "ntldr" sub-module.
Split the "main" winldr.h header into the one containing global code
that actually doesn't really depend on the "windows" NT loader part,
and one that actually concerns code just for the NT Loader.
The latter goes into "ntldr".

svn path=/branches/setup_improvements/; revision=74743
2018-10-25 00:40:04 +02:00
Extravert-ir d0e29db1cb [FREELDR] Fix MSVC warnings C4146 (#863) 2018-09-16 16:14:07 +02:00
Katayama Hirofumi MZ 31019e8c0c [TRANSLATION] Update Romanian translation (#851)
Translation from Stefan Fulea.
CORE-15023
2018-09-14 11:04:36 +02: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
Timo Kreuzer 81a9ce44e9
[FREELDR] Don't insert a driver into the BootDriver list twice (#755)
This happened for the livecd, where the cdfs driver was inserted twice - once since it is the driver for the boot device, and the 2nd time, because it was specified in the registry - which was then initialized twice by the kernel, leading to a name conflict when trying to create another device object, which resulted in the newly created device object to be dereferenced again and the driver unloaded. This can be seen from the debug message "(ntoskrnl\mm\ARM3\sysldr.c:955) Leaking driver: cdfs.sys"
2018-08-18 16:41:30 +02:00
Timo Kreuzer 6da93539a9
[FREELDR] Fix calculation of page lookup table (#761)
On x64 we only map 1GB of pages, so adjust MM_MAX_PAGE accordingly and also respect that value when searching for the best location of the page lookup table.
CORE-11048 #resolve
2018-08-18 12:16:33 +02:00
Serge Gautherie 7d6bda16c6
[REACTOS] Improve how some ASSERTMSG() message values are printed: enforce ending "\n".
NB: Not touching calls in "third-party" code: class and classpnp.
2018-08-08 22:03:45 +02:00
Serge Gautherie 97d3b3ce33
[REACTOS] RtlAssert(): use "%lu" as LineNumber format. 2018-08-08 21:24:07 +02:00
Timo Kreuzer 6dcf3c29e0 [FREELDR] Fix 64 bit issues 2018-08-04 19:19:34 +02:00
Victor Perevertkin 2ae1675208 [ASM] Fixed ".double" macro in asm.inc.
GAS uses ".double" symbol for declaring floating-point constants and
".quad" symbol for declaring 64-bit numbers.
This is not compatible with our macro for MASM and introduces bugs.
Now 64-bit constants are supposed to be declared using ".quad" macro.
2018-07-15 23:25:23 +02:00
Serge Gautherie c1d0d409e7 [FREELDR] PcMemGetBiosMemoryMap(): Add a default handling of entry with "EA.ErrorLog = 1". CORE-14150
This FIXME is meant as a reminder/help to actually use this data.
2018-07-01 12:03:50 +02:00
Serge Gautherie a0313c750f [FREELDR] pcmem.c: Improve output strings. No functional changes. CORE-13332
- Plus: Add missing email address in 74f92c3d86.
- Remove superfluous blank lines.
- Add 2 TRACE("FunctionName()\n").
- Use "0x%llx", not "%lu", for BaseAddress and Length. (Copypasta in my recent commits.)
- Add "0x" to 1 "%p" and 1 "%lx".
2018-07-01 12:03:50 +02:00
Thomas Faber f6dea8b734
[CMAKE] Avoid some uses of the LOCATION target property. CORE-14509 2018-03-30 20:28:20 +02:00
Thomas Faber 76c2045434
[FREELDR] Reduce the timeout during serial mouse detection. CORE-14280 2018-02-05 11:49:12 +01:00
Thomas Faber 4d811a2f97
[FREELDR] Remove unnecessary checks. CORE-14280 2018-02-05 11:49:10 +01:00
Thomas Faber 79ea0ae09e
[FREELDR] Display an additional status message for hardware detection. CORE-14280 2018-02-05 11:49:07 +01:00
Serge Gautherie 50afbd48d4 [FREELDR] FreeLdr debug.h does not care about NDEBUG. (#201)
- Remove all "#define NDEBUG".
2018-01-26 23:34:21 +00:00
Serge Gautherie b5a7765068 [FREELDR] i386vid.c: Downgrade/Improve 3 false ERR() to WARN(). CORE-13496
Silence harmless errors, which can be reported at every boot.
2018-01-26 23:11:52 +02:00
Erdem Ersoy ba3f074320 [TRANSLATIONS] Update the email address and add a note in the Turkish translation document (#271) 2018-01-07 22:09:42 +01:00
Katayama Hirofumi MZ e9d8fa57c3
[TRANSLATION][BASE][FDEBUG][MODULES][WIN32SS] Use correct font name in Chinese resources, CORE-9566 (#227).
Localized resources should use the correct Traditional/Simplified Chinese fonts
that are most suitable for UI and compatible with Windows.
2017-12-29 01:51:06 +01:00
Serge Gautherie 74f92c3d86 CORE-13332. PcMemGetBiosMemoryMap(): Update ACPI (Extended Attributes) support. (#143)
[FREELDR] Update ACPI (Extended Attributes) support in PcMemGetBiosMemoryMap()
CORE-13332

* PcMemGetBiosMemoryMap(): Add Extended Attributes set and check for entry validity and default handling of unexpected case. 

* pcbios.h: Rename superceded BIOS_MEMORY_MAP.Reserved. Adapt existing code to new ACPI 6.2-A definitions.

* pcbios.h: Update BIOS_MEMORY_TYPE and BIOS_MEMORY_MAP to ACPI 6.2-A from 1.0+.

* PcMemGetBiosMemoryMap(): Misc fixes, no functional changes.
*Create PcMemCheckUsableMemorySize(), to split unrelated code out.
*Fix a copypasta in 2 output strings from ba9a1c3abb.
*Improve output readability of TRACE("ECX ...", ...).
*Move a TRACE("\n").
*Improve code style a bit.
2017-12-27 11:09:20 +01: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
Serge Gautherie 1456310503
[FREELDR] PcMemGetBiosMemoryMap(): Add checks for entry sizes and bare handling of error case. CORE-13332 2017-11-18 21:54:14 +01:00
Serge Gautherie ba9a1c3abb
[FREELDR] Additional safety checks for PcMemGetBiosMemoryMap. CORE-13332
Cast MAX_BIOS_DESCRIPTORS to explicit ULONG from implicit int.
Comment/Add checks for PcMemoryMap/PcBiosMemoryMap arrays being full and bare handling of error cases.
2017-11-03 14:38:57 +01:00
Thomas Faber fe3eb29287
[REACTOS][FDEBUG] Remove unnecessary DLGPROC casts. 2017-11-03 13:57:46 +01:00
Serge Gautherie 9b1e056e8f [FREELDR] Discard empty entries in PcMemGetBiosMemoryMap. CORE-13332
Improve a TRACE() from f588de2e79.
2017-10-11 13:20:15 +02:00
Colin Finck 950c86fb4c Fix remaining text file line endings in the tree. (#18)
Based on https://stackoverflow.com/a/1511273

Also enforce CRLF for all *.xml files in our tree, because they are distributed with ReactOS.
2017-10-06 15:00:36 +02:00
Serge Gautherie 55ae20931f [FREELDR] Properly check for end-of-memory-map entries when skipping ranges smaller than page size.
CORE-12881

Signed-off-by: Timo Kreuzer <timo.kreuzer@reactos.org>
2017-10-05 19:19:42 +02:00