Commit graph

162 commits

Author SHA1 Message Date
Timo Kreuzer
e452980e0e [HALX86/APIC] Change IRQL for x86 profile interrupt to HIGH_LEVEL
While PROFILE_LEVEL is defined as 27 on x86, this does not match the vector for the profiling interrupt, which is 0xFD (see https://community.osr.com/t/odd-ioapic-output/45216), implying IRQL 31.
Fixes boot with x86 APIC hal (CORE-20093)
2025-04-24 11:36:12 +00:00
Timo Kreuzer
35fd771c84 [HALX86/APIC] Read APIC Id from APIC instead of using initial Id
This is needed on some hardware systems, where the BIOS has modified the actual APIC IDs.
The timer interrupt already did this, but in a broken way.
2025-04-24 11:36:12 +00:00
Timo Kreuzer
faaac75546 [HALX86/APIC] Use physical addressing in HalEnableSystemInterrupt 2025-04-24 11:36:12 +00:00
Timo Kreuzer
f1f01771b6 [HALX86/APIC] Set timer interrupt to level triggered 2025-04-24 11:36:12 +00:00
Timo Kreuzer
884f73fb04 [HALX86/APIC] Fix interrupt delivery on bare metal
Write both high and low 32 bits of ICR in ApicRequestSelfInterrupt. In VMs we get away with only writing the low 32 bits, but actual hardware doesn't always accept that.
2025-04-24 11:36:12 +00:00
Timo Kreuzer
0f6e982ad7 [HALX86/APIC] Mask profiling interrupt on init 2025-04-24 11:36:12 +00:00
Timo Kreuzer
2c057d9bc1 [HALX86] Set the NMI disable flag when accessing CMOS registers
An NMI while accessing the CMOS can leave it in an undefined state. NMIs are used on x64 SMP for CPU freeze in the debugger.
2025-04-24 11:36:12 +00:00
Hermès Bélusca-Maïto
3022d74beb
[NTOS:EX/KE][HALX86] Add support for NUMPROC, BOOTPROC, MAXPROC, ONECPU boot switches (#6024)
These SMP-specific switches allow to test and control configurations
with various number of CPUs on multiprocessor systems.

- NUMPROC: maximum number of logical processors that can be started
  (including dynamically, not currently supported by ReactOS) at run-time.

- BOOTPROC: maximum number of logical processors that can be started at
  boot-time.

- MAXPROC: forces the OS to report the maximum possible number of CPUs
  as existing on the system.

- ONECPU (MP HAL-only boot switch): causes the HAL to only use one
  (the boot) CPU on a multiprocessor system. Attempting to start other
  processors will fail.

For more information, see:
https://www.geoffchappell.com/notes/windows/boot/bcd/osloader/numproc.htm
https://www.geoffchappell.com/notes/windows/license/processors.htm
https://rmscrypt.wordpress.com/2011/02/
https://codeinsecurity.wordpress.com/2022/04/07/cpu-socket-and-core-count-limits-in-windows-10-and-how-to-remove-them/

Generic references about BOOT.INI switches:
https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/boot-options-in-a-boot-ini-file
https://www.itprotoday.com/cloud-computing/what-switches-can-be-used-bootini
http://franck.kiechel.free.fr/dbr_eng/BootIni.htm

References about BCD options:
https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/bcdedit--set
http://www.mistyprojects.co.uk/documents/BCDEdit/files/commands.6.1.7601.htm#TYPES%20OSLOADER
2025-04-04 12:51:49 +02:00
Hermès Bélusca-Maïto
b0dd4ba09c
[HALX86][HALARM] Minor formatting to HalInitSystem
Add CODE_SEG("INIT"), SAL2 annotations, remove extra-parenthesis...
2025-04-04 12:51:28 +02:00
Timo Kreuzer
0679260073 [HAL/APIC] Set the profiling interrupt handler
Fixes hang when running mtdll_apitest NtStartProfile.
2025-04-03 16:22:42 +00:00
Dmitry Borisov
029e53ddb5
[MINIHAL] Minor improvements (#7398)
* [FREELDR] Mark noreturn functions

* [FREELDR] Compile hw debugging support code only in debug builds

- Make BREAKPOINT() portable

* [FREELDR] Consolidate identical names into a single string

* [FREELDR] Use intrinsics for string I/O operations on x86 and x64

Stop them being pulled in from a static minihal library

* [MINIHAL] Exclude unnecessary portio dependency
2025-03-11 10:30:14 +03:00
Timo Kreuzer
78ded05547 [MINIHAL] Move the definition of _MINIHAL_ to directory scope
This is required, so that the definition is available when preprocessing asm files on MSVC builds. Otherwise systimer.s will contain KeStallExecutionProcessor, which must not be used in freeldr.
2025-02-04 16:45:48 +02:00
Katayama Hirofumi MZ
fe11f7a2e5
[REACTOS] Refresh old URLs (#7632)
URLs are getting old. We have to
update URLs for documentation
purpose.
JIRA issue: CORE-19963
- Refresh old URLs.
- Add " (DEAD_LINK)" labels
  to dead links.
- Use MS Learn links rather
  than MSDN ones.
- Some dead links revived by
  Web Archive.
- Don't change Wine Tests
  and Wine Sync.
- Don't change 3rd party libraries.
- Don't append "redirected" labels.
2025-01-28 13:36:45 +09:00
Timo Kreuzer
5ebd478325 [NTOS][HAL:APIC] Call HalBegin/EndSystemInterrupt from clock handler 2024-12-16 16:21:44 +02:00
Timo Kreuzer
1f647e4479 [HAL] Remove KiEoiHelper hack 2024-12-16 16:21:44 +02:00
Serge Gautherie
2c8d083fc0
[HALX86] acpi/madt.c: Rewrite it (#6032)
Especially HalpParseApicTables() which looked early-WIP and was buggy.
And keep smp/mps/mps.c in sync'.
2024-08-31 14:35:50 -07:00
Timo Kreuzer
365c2c1ce3 [HAL:APIC] Fix HalSetTimeIncrement
Fix calculation of clock rate. Previously it would go above the maximum, causing issues with KeUpdateSystemTime.
2024-06-15 14:22:20 +02:00
Timo Kreuzer
8d459f2820 [NTOS:KE/x64] Clean up EnterTrap/ExitTrap
- Always save and restore all non-volatile registers, including xmm
- Remove the obsolete flags
2024-04-14 16:09:20 +02:00
Timo Kreuzer
def2fe5dc3 [HALAPIC] Rename a field for consistency 2024-03-06 19:04:41 +01:00
Timo Kreuzer
79aaee6aac [HALX86] Implement the clock IPI handler 2024-03-02 07:56:27 +01:00
Timo Kreuzer
d1c118b371 [HALX86] Move apicsmp.c to lib_hal_smp 2024-03-02 07:56:27 +01:00
Hermès Bélusca-Maïto
46831c537f
[HAL] HalInitializeBios() should not explicitly call HalpBiosDisplayReset().
While the BIOS support for INT10h emulation has been set up, any
modification of the display should wait until the kernel requests
video initialization with INBV/bootvid.
The latter will call HalResetDisplay() (that calls HalpBiosDisplayReset())
at the correct time.
This avoids an useless video mode change and reset when booting ReactOS.
2024-02-11 18:51:40 +01:00
Justin Miller
3306a16e84
[HALX86] Fix SYNCH_LEVEL differences between UP and SMP in HAL (#5874)
First step to fixing the multiprocessor kernel when booting on a single core.
2024-01-20 06:26:59 -08:00
Timo Kreuzer
10bb50b456 [HAL] Fix SMP initialization
- Don't use CONFIG_SMP, this isn't handled in (most of) hal
- Add a dummy HalpSetupProcessorsTable for UP
- Call HalpRegisterKdSupportFunctions only for processor 0
2023-12-30 12:53:18 +02:00
Ratin Gao
ffb20d3330
[REACTOS] Fix typos (#6198)
- Adress -> Address
- Currupted -> Corrupted

3rd-party files are not modified.
2023-12-23 21:37:08 +01:00
Timo Kreuzer
230f7c7f3c [HALX86] Some improvements / bugfixes for IPI support functions 2023-12-08 19:28:57 +02:00
Timo Kreuzer
d8d46a00c3 [HALX86] Use InterlockedBitTestAndSetAffinity instead of InterlockedBitTestAndSet 2023-12-08 19:28:57 +02:00
Timo Kreuzer
d87b45bee7 [NDK] Add Affinity helper inline functions 2023-12-08 19:28:57 +02:00
Timo Kreuzer
40b6b1dab3 [HAL] Implement IPI support functions 2023-12-03 00:07:53 +02:00
Hermès Bélusca-Maïto
8c3f7b1027
[HALARM] HalpActiveProcessors is a KAFFINITY (see headers) 2023-11-28 12:17:48 +01:00
Justin Miller
516ccad340
[NTOS:KE][HALX86] Implement AP startup code (#5879)
Co-authored-by: Victor Perevertkin <victor.perevertkin@reactos.org>

Introduce the initial changes needed to get other processors up and into kernel mode. 
This only supports x86 as of now but is the first real step towards using other system processors.
2023-11-19 15:51:33 -08:00
Serge Gautherie
2cc7eeb939
[HALX86] Add missing \n to DPRINT() calls (#5993)
And promote some DPRINT() to DPRINT1().
2023-11-19 19:44:46 +01:00
Justin Miller
0a951f1112
[BOOTDATA] Add SMP Entry (#5859)
[HALX86] Enable SMP Hal for x86
[BOOTDATA] add livecd and set entrys
2023-11-01 06:43:44 -07:00
Hermès Bélusca-Maïto
bd0eaa924d
[HALX86] HalHandleNMI: Re-enable debugger-entering code. 2023-08-03 13:26:24 +02:00
Adam Słaboń
ce2d4740a6
[SDK][HAL] Enable x86Bios on x86 (#5454)
This will be needed for compatibility with x86 Windows Vista/7 videoprt.sys builds.
Might be also useful in future for platforms (x86 , ...) where V86 mode is not available or buggy.

CORE-11954, CORE-18185
2023-07-20 21:44:44 +02:00
Hermès Bélusca-Maïto
18815558d1
[HALX86] Update the PCI hardware IDs database.
Extracted from the pci.ids database at https://pci-ids.ucw.cz/ from 2023-06-19 03:15:02.
Maintained by Albert Pool, Martin Mares, and other volunteers from the PCI ID Project.
2023-07-16 20:52:07 +02:00
Hermès Bélusca-Maïto
eba1244b00
[HALX86] Convert the PCI Ids files to LF ('\n') endlines, and adjust the parsing code. (#4905)
This allows to somewhat reduce their size, and the resulting size
of the generated hal.dll file.

pci_classes.ids
Before: 6,207 bytes
After : 5,968 bytes
Reduction: 239 bytes --> 4%

pci_vendors.ids
Before: 1,370,248 bytes
After : 1,334,622 bytes
Reduction: 35,626 bytes --> 2.6%

Co-authored-by: Stanislav Motylkov <x86corez@gmail.com>
2023-07-16 20:51:56 +02:00
Hermès Bélusca-Maïto
3854a5d8e9
[CODEBASE] Fix "uknown" / "unkown" etc. typos.
Only done in our own code, not in 3rd-party or in PSDK headers
(official ones also have such typos in defines...)

(NOTE: apparent "Uknown" typo in dll/cpl/sysdm/smbios.c is on-purpose:
typo by the manufacturer.)
2023-07-15 14:19:04 +02:00
Victor Perevertkin
16882dcfa4
[HALX86] Bugcheck in case the ACPI initialization failed (for ACPI HAL) (#5376)
CORE-16302
2023-07-02 02:01:11 +03:00
Hermès Bélusca-Maïto
bd5209d9f4
[HALX86] These HalpNo* functions are actually _implemented_. Document their purpose.
Remove the misleading comment in HalpNoBusData().
Update the SAL annotations.
2023-06-25 21:25:06 +02:00
Hermès Bélusca-Maïto
9ba1849a97
[HAL][MINIHAL] Minor cleanup in reboot.c files (#5359)
And remove pic/processor.c from minihal compilation.
2023-06-25 19:39:44 +02:00
Hermès Bélusca-Maïto
3fa613b9da
[MINIHAL] Remove sysinfo.c from compilation. 2023-06-20 22:40:58 +02:00
Hermès Bélusca-Maïto
d6a78d580b
[HALX86] Tabs to 4-space indentation in generic/sysinfo.c + Fix typo "ALMI" -> "AMLI" 2023-06-20 22:40:57 +02:00
Hermès Bélusca-Maïto
d03fc32e7d
[MINIHAL] Remove unneeded files from compilation. 2023-06-20 18:39:01 +02:00
Hermès Bélusca-Maïto
7e1510eb9c
[HALX86] Implement HalpcGetCmosData and HalpcSetCmosData. 2023-06-19 21:09:03 +02:00
Hermès Bélusca-Maïto
113656563a
[HALX86] Minor fixes in HaliFindBusAddressTranslation()
- Remove ContextValue variable. This variable erroneously truncated
  *Context value (that can contain a pointer value) to 32 bits.

- Gracefully fail instead of asserting.
2023-06-14 11:27:24 +02:00
Hermès Bélusca-Maïto
5871716c64
[HALX86] Update the PCI hardware IDs database.
Extracted from the pci.ids database at https://pci-ids.ucw.cz/ from 2022-11-25 03:15:01 .
Maintained by Albert Pool, Martin Mares, and other volunteers from the PCI ID Project.
2022-11-25 16:17:10 +01:00
Timo Kreuzer
3381bf39db [HAL/x64] Fix x86BiosCall
Use an INT call stub and exit on the address after the stub instead or using iret (some BIOS code uses int / iret internally). This fixes the messed up display when trying to switch modes.
2022-11-24 21:17:58 +02:00
Serge Gautherie
ba1ed89f91
[HALX86] HalpQueryInterface(): Debug log InterfaceType param (#4772)
This should help to find out which GUIDs are actually wanted.
Based on CircularTriangle06's patch.

CORE-11632
2022-11-15 02:04:04 +03:00
Timo Kreuzer
f8b6cc249e [HAL] Add missing I/O port to int 10 BIOS emulator 2022-08-04 16:15:24 +02:00