What exactly is the hal timer problem?

Are you sure that the failure of GS CAB’er can only be caused by the version of the hal.dll file in system32 folder? If so, the program that does not work with the patched hal.dll (SHA-1: 98026788984C5BA10644C0E451DD0D69A5F67A90) from the halplusintelppmXPSP3.rar package should not work even under sandboxie and instead it works:
https://ibb.co/DbY4vj8



Now are really patched 2 bytes only, but this is enough for GS_CABer to stop starting. However, many other programs work fine. GS_CABer probably uses the timer in a non-standard way. This causes GS_CABer to fail with any patched hal.dll.



Yes! I change hal.dll only.



Examination of this problem showed that GS_CABer stops starting when only 1 byte changes:
07B3C: 0xC3 - GS_CABer error on starting
07B3C: 0xC7 - GS_CABer is working fine



Pak_1.zip - https://www.upload.ee/files/11515068/Pak_1.zip.html
hal.dll and hal__Original.dll

How to solve this problem?
Are there any other values for cell "07B3C" where there will be no problem?


Have you seen the screenshot? GS_CABer also works with patched hal.dll but you need to start it under Sandboxie (do you know this software?).
So, I wonder if it is just a matter related to the patched hal.dll.


Have you seen the screenshot? GS_CABer also works with patched hal.dll but you need to start it under Sandboxie (do you know this software?).
So, I wonder if it is just a matter related to the patched hal.dll.




I know.
GS_CABer will start with patched hal.dll if you enable launch in "Windows 98" compatibility mode:



Probably, in this mode, the timer is "programmatically" emulated.
I want to deal with this problem and solve it, and not look for crutches.
Moreover, it can occur in other applications that also use this timer.

This is very easy solution to fix this error clock watchdog timout in blue screen you can read article about it this website blog WindowsStation.com

@YuriyCN ,

Problem is bad written gs_caber, it have not tolerance with high values of PerformanceCounter/PerformanceFrequency(hal timer patch set it to cpu freq, so values > 2500 ). If we divide it to 1024 like win7 did, gs_caber start work, it show main window, but all text is "???", i think this crap dont set right locale on non-russian windows, homework software :slight_smile:
patch for hal is simple, need add two commands in two places in _HalpAcpiTimerQueryPerfCount@4 function:

1
2
3
4
5
6
7
8
 
shrd    eax, edx, 0Ah             ; dword shift to 10 bit = /1024
shr edx, 0Ah ; edx too
mov [ecx], eax
mov [ecx+4], edx
....
shrd eax, edx, 0Ah
shr edx, 0Ah
retn 4
 



Спасибо за изучение проблемы. Я отвечу по русски, чтобы полностью передать суть. Я хочу использовать патченый hal.dll - поскольку с ним заметил +30% прирост скорости работы SSD диска при использовании драйвера "Intel RSTe AHCI/RAID driver v4.7.0.1117". С оригинальным файлом hal.dll скорость чтения 180 МБ/с, с патченым скорость чтения возрастает до 265 МБ/с. Также наблюдаю прирост до 1-2% для CPU - но это мизер на уровне погрешности. При этом другие файлы и настройки не изменяются.

После нескольких проверок установил, что достаточно исправить всего-лишь 1 байт по смещению 07B3C. Зачем патчатся другие байты я не понимаю, от них ничего не меняется.

В итоге:
С оригинальном hal.dll (07B3C: 0xC7) - GS_CABer работает отлично, но скорость чтения SSD = 180 МБ/с. С патченым (07B3C: 0xC3) - GS_CABer выдает ошибку при запуске, но скорость SSD = 265 МБ/с. При этом другие программы работают стабильно.

Возможно, проблема в криво написанном GS_CABer, но не факт что найдутся и другие подобные "кривые" программы. Здесь выкладывалось несколько вариантов патченого файла, но красиво работающего решения нет. Пожалуйста, сделайте корректный патч для hal.dll последней версии 5.1.2600.5687 - https://www.upload.ee/files/11521284/hal.zip.html

Очень хочется иметь красивое решение, чтобы и скорость SSD была высокой и GS_CABer запускался.

English translation (via DeepL; fairly accurate IMO):


подробнее про эту проблему, но на инглише чтобы все могли прочитать:

- WinXP SP2+ uses acpi timer for getting incremental counter (acpi spec declare this counter as part of specification)
- WinXP detect existing this timer by checking special bit USE_PLATFORM_CLOCK in FACP ACPI table, this bit controlled by BIOS
- Skylake+ bioses by default disable this timer at hardware level (register "ACPI Timer Control (ACPI_TMR_CTL)" in southbridge, see PDF)
- Skylake+ bioses stiil set USE_PLATFORM_CLOCK=1 in acpi, i think purspose is to inform Win7+ about existing HPET timer (not acpi timer!)
- If WinXP uses broken acpi timer, counter value is negative, so many progs become "crazy"
- HAL_timer_fix cheat WinXP to read USE_PLATFORM_CLOCK always =0, so this onebyte patch force to not use disabled acpi timer (exactly it avoid overwrite offsets to 3 functions)
- 74/75->eb and mov xxx,yyyy->ret are equalent patches, first is preffered, don’t need both
- WinAPI declare 8 bytes to store value of counter, so values 2500+MHZ is not problem for properly maked programs (my cpu 3600Mhz fit in 6 bytes i think)
- To solve issue with bad progs like gs_caber, counter need to devide to much lesser value, win7 just divide it to 1024, so timer frequency on 3600Ghz cpu is only 3.5xx Mhz, this is what "hal tsc timer frequency divider" do in my early post on this page

p.s. Hal version can also include DMA32 PAE fix, so theres can be many diff bytes. I do not share files on public, please do not ask, make patches yourself if it possible


подробнее про эту проблему, но на инглише чтобы все могли прочитать:

- WinXP SP2+ uses acpi timer for getting incremental counter (acpi spec declare this counter as part of specification)
- WinXP detect existing this timer by checking special bit USE_PLATFORM_CLOCK in FACP ACPI table, this bit controlled by BIOS
- Skylake+ bioses by default disable this timer at hardware level (register "ACPI Timer Control (ACPI_TMR_CTL)" in southbridge, see PDF)
- Skylake+ bioses stiil set USE_PLATFORM_CLOCK=1 in acpi, i think purspose is to inform Win7+ about existing HPET timer (not acpi timer!)
- If WinXP uses broken acpi timer, counter value is negative, so many progs become "crazy"
- HAL_timer_fix cheat WinXP to read USE_PLATFORM_CLOCK always =0, so this onebyte patch force to not use disabled acpi timer (exactly it avoid overwrite offsets to 3 functions)
- 74/75->eb and mov xxx,yyyy->ret are equalent patches, first is preffered, don’t need both
- WinAPI declare 8 bytes to store value of counter, so values 2500+MHZ is not problem for properly maked programs (my cpu 3600Mhz fit in 6 bytes i think)
- To solve issue with bad progs like gs_caber, counter need to devide to much lesser value, win7 just divide it to 1024, so timer frequency on 3600Ghz cpu is only 3.5xx Mhz, this is what "hal tsc timer frequency divider" do in my early post on this page

p.s. Hal version can also include DMA32 PAE fix, so theres can be many diff bytes. I do not share files on public, please do not ask, make patches yourself if it possible




Thanks for answer. In the file "hal.dll" (version 5.1.2600.5687), replacing the byte at offset 07B3C, to put byte 0xC3 instead of byte 0xC7 – fix PM_Timer. Correction of the timer leads to an increase in the performance of the SATA AHCI driver up to 30%. I measure the speed of the SSD drive by copying a file of few gigabytes in size using Total Commander.

On Windows 7, the speed reaches 450 MB/s, but on Windows XP it is much lower - 180 MB/s. The speed limit is due to the SATA AHCI driver, because the SSD drive itself is much more productive. Replacing hal.dll with the patched one, I got a speed increase up to 260-265 MB/s. The byte at offset 07B3C has an effect. Fixing the remaining bytes does not affect performance, although I have 16 GB of RAM and use the PAE mode, maybe the "DMA32 PAE fix" on my processor and motherboard is not required.

You wrote a lot of technical information, but I’m not a hacker - I don’t understand what to do about it. Can you make a ready-made solution - to patch the file https://www.upload.ee/files/11521284/hal.zip.html and to fix PM_Timer, taking into account the normal operation of the PAE mode and the GS_Caber program, which stops starting when the patched file "hal.dll" is used. Or indicate which bytes at which offset are needed to fix, so that I can do it myself. Thanks in advance.

New SATA AHCI Controller driver StorAhci version 1.0 with SOURCE CODE.

StorAhci is based on Microsoft’s storahci sample driver for Windows 8 and was changed to support Windows Server 2003 SP1 and SP2 with out of the box storport.sys driver. In addition we added a txtsetup.oem file to load it from a driver floppy disk at the F6 text setup stage. StorAhci is a universal SATA AHCI Controller driver for use with AMD, Intel and any other chipsets.

https://sourceforge.net/projects/storahci-for-windows-2003/