Commit graph

302 commits

Author SHA1 Message Date
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
Katayama Hirofumi MZ 257a701e9b
[BOOTDATA][USERENV] Improve and fix user profile info (#2265)
The international user profile info was inconsistent; thus TEMP and TMP environment variables were wrong. CORE-16635
2020-01-22 08:19:39 +09: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
Oleg Dubinskiy c8464e5717 [BOOTDATA] Add AppliedDPI registry value (#1966)
Add AppliedDPI DWORD registry value 0x00000060 (96 DPI) into HKCU\Control Panel\Desktop\WindowMetrics registry key. For now it does nothing, since saving DPI registry settings is not implemented yet. It's required only for ViStart 8 to be started successfully (with MS VB6 Runtime installed and wshom.ocx replaced). CORE-13877
2020-01-02 18:06:18 +09: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
Katayama Hirofumi MZ 9ce12f0b4c
[BOOTDATA][NTUSER] Fix some system parameters (#2162)
CORE-16547
- Add IconTitleWrap registry value.
- Modify gspv.dwMenuShowDelay initial value.
- Initialize gspv.bFastTaskSwitch as TRUE.
2019-12-25 18:12:43 +09: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
Amine Khaldi 1a472d9453 [UNICODE] Sync with Wine Staging 4.18. CORE-16441 2019-12-23 00:58:51 +01:00
Katayama Hirofumi MZ eba2d5d30a
[BOOTDATA][NTUSER] Fix GetSystemMetrics values (#2137)
Fix user32!GetSystemMetrics values. CORE-16547
SM_MENUDROPALIGNMENT and SM_CXSMSIZE
2019-12-21 22:38:49 +09:00
Serge Gautherie 7e1338eac2 [BOOTDATA] Restore "CMD here" 'Extended' key, but commented out (#2093)
Addendum to db5a2fff
CORE-16519
2019-11-29 14:13:59 +01:00
Katayama Hirofumi MZ 5734570a15
[BOOT][SHELL32][INCLUDE] Support 'SuperHidden' files (#2102)
PR #2101 shows desktop.ini files on Desktop. I want to hide them.
- Add "ShowSuperHidden" setting to Explorer.
- Add SHCONTF_INCLUDESUPERHIDDEN flag.
- Support SHCONTF_INCLUDESUPERHIDDEN in Explorer.
CORE-10045
2019-11-29 15:14:18 +09:00
Hermès Bélusca-Maïto f986527d49
[BOOTLIB] Remove a useless 'FontDirectory' check as it becomes always valid (!= NULL) through the function.
CORE-11590

Adapted from Victor Martinez patch & Serge Gautherie PR #2062
2019-11-27 01:30:56 +01:00
Katayama Hirofumi MZ db5a2fff5d
[SHELL32] Shift-Right-Click patch: Plan B (#2082)
Enable "CMD here" without Shift key. CORE-16519
2019-11-24 19:22:23 +09:00
Katayama Hirofumi MZ 4212ef9dcb
[BOOTDATA] Add 'App Paths' registry entries (#2075)
CORE-11335
2019-11-22 22:23:23 +09:00
Katayma Hirofumi MZ f038c2339b [BOOTDATA] s/cmd/cmd.exe/ 2019-11-15 10:09:13 +09:00
Katayama Hirofumi MZ 90c63d12a1
[SHELL32][BOOTDATA] Implement Command Prompt here (#2029)
Add "Command Prompt here" menu item to the Right-click menu of normal folders and drives. Currently, this menu item doesn't work correctly because of the bug of pushd. CORE-12150
2019-11-14 23:25:21 +09: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
Eric Kohl 90c5cac72c [BOOTDATA][INF] Run the Dnscache service on the NetworkService account
CORE-12159
2019-10-28 22:30:21 +01: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