On Tue Feb 4 22:24:37 2025 +0000, Marc-Aurel Zent wrote:
> Indeed, but this commit essentially inlines the call to
> `__commpage_gettimeofday()` inside `gettimeofday()`, wheres the latter
> still incurs of overhead of 23 CPU cycles before calling into
> `__commpage_gettimeofday()`, if I counted correctly.
> It actually does more than inlining though, `gettimeofday()`, will do a
> syscall if `__commpage_gettimeofday()` fails, and use that value instead.
> This can happen rarely (about 1 in a million in my testing), probably
> when page time values that are updated asynchronously from the kernel
> are read simultaneously.
> As the commit is right now, it effectively tries to read from the
> commpage *twice*, making that chance of doing a syscall astronomically low.
> Also it is still measurably faster to use `__commpage_gettimeofday()`
> directly (benchmarked at 10000000 iterations through Rosetta):
> ```
> clock_gettime() Duration: 0.290506 seconds
> gettimeofday() Duration: 0.233024 seconds
> __commpage_gettimeofday() Duration: 0.217468 seconds
> ```
IMO, this feels like a micro-optimization that isn't worth the complexity and risk to save 23 cycles per call. If it makes a meaningful difference in a game benchmark it could be worth it, but otherwise it feels better to chase bigger gains.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7256#note_93758
"DIR /o" (no order specifier after /o) hasn't functioned the same as it does on Windows. This change makes the functionality of /o by itself equivalent to behavior on Windows.
--
v23: programs/cmd: Cleanup DIR /O logic and remove @todo_wine@ from working tests.
programs/cmd/tests: Add tests for command DIR /O.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7131
The software Helicon Filter 5 crashes at startup when it tries to query
the registry entry `SystemBiosDate` under `HKEY_LOCAL_MACHINE\Hardware\Description\System`, which doesn't exist in the wine registry.
That part of the registry is volatile, so the workaround of just adding that key is short lived.
In this commit I just added a dummy date (01/01/70) for simplicity, not sure if that's ok?
There's code in wineboot.c which sets the actual BIOS date into the `BIOSReleaseDate` key. That could potentially be used, but it has a different format: 01/01/1970 (four digits for the year instead of two)
I've found no official documentation of the `SystemBiosDate` key. The only place I've found is in an example on this page: https://learn.microsoft.com/en-us/windows-hardware/drivers/debuggercmds/-reg
<details><summary>Wine log from startup crash when querying SystemBiosDate</summary>
<pre>
0024:Call advapi32.RegOpenKeyExA(80000002,00810cdc "HARDWARE\\DESCRIPTION\\System",00000000,00020019,00e6fb68) ret=00440607
0024:Call ntdll.RtlRunOnceExecuteOnce(7b69ec60,7b65bad0,00000000,00000000) ret=7b6106d9
0024:Ret ntdll.RtlRunOnceExecuteOnce() retval=00000000 ret=7b6106d9
0024:Call ntdll.wcscpy(00e6f9ac,7b69ec94 L"") ret=7b60ce6b
0024:Ret ntdll.wcscpy() retval=00e6f9ac ret=7b60ce6b
0024:Call ntdll.RtlInitAnsiString(00e6fadc,00810cdc "HARDWARE\\DESCRIPTION\\System") ret=7b62f0bc
0024:Ret ntdll.RtlInitAnsiString() retval=0000001c ret=7b62f0bc
0024:Call ntdll.RtlAnsiStringToUnicodeString(7ffc2bf8,00e6fadc,00000000) ret=7b62f0e1
0024:Ret ntdll.RtlAnsiStringToUnicodeString() retval=00000000 ret=7b62f0e1
0024:Call ntdll.NtOpenKeyEx(00e6fb68,00020019,00e6f9a8,00000000) ret=7b65e875
0024:Ret ntdll.NtOpenKeyEx() retval=00000000 ret=7b65e875
0024:Call ntdll.RtlNtStatusToDosError(00000000) ret=7b62f0f1
0024:Ret ntdll.RtlNtStatusToDosError() retval=00000000 ret=7b62f0f1
0024:Ret advapi32.RegOpenKeyExA() retval=00000000 ret=00440607
0024:Call advapi32.RegQueryValueExA(000000f8,00810cc4 "SystemBiosDate",00000000,00e6fb58,00000000,00e6fb74) ret=00440c43
0024:Call ntdll.RtlInitAnsiString(00e6f9b0,00810cc4 "SystemBiosDate") ret=7b6305f6
0024:Ret ntdll.RtlInitAnsiString() retval=0000000f ret=7b6305f6
0024:Call ntdll.RtlAnsiStringToUnicodeString(00e6f9b8,00e6f9b0,00000001) ret=7b630614
0024:Ret ntdll.RtlAnsiStringToUnicodeString() retval=00000000 ret=7b630614
0024:Call ntdll.NtQueryValueKey(000000f8,00e6f9b8,00000002,00e6f9c0,00000100,00e6f9a8) ret=7b630695
0024:Ret ntdll.NtQueryValueKey() retval=c0000034 ret=7b630695
0024:Call ntdll.RtlFreeUnicodeString(00e6f9b8) ret=7b6306c0
0024:Ret ntdll.RtlFreeUnicodeString() retval=00000001 ret=7b6306c0
0024:Call ntdll.RtlNtStatusToDosError(c0000034) ret=7b6306d2
0024:Ret ntdll.RtlNtStatusToDosError() retval=00000002 ret=7b6306d2
0024:Ret advapi32.RegQueryValueExA() retval=00000002 ret=00440c43
0024:Call advapi32.RegCloseKey(000000f8) ret=00440433
0024:Call ntdll.NtClose(000000f8) ret=7b628979
0024:Ret ntdll.NtClose() retval=00000000 ret=7b628979
0024:Call ntdll.RtlNtStatusToDosError(00000000) ret=7bcebd50
0024:Ret ntdll.RtlNtStatusToDosError() retval=00000000 ret=7bcebd50
0024:Ret advapi32.RegCloseKey() retval=00000000 ret=00440433
0024:Call user32.LoadStringA(00400000,0000fff0,00e6eb54,00001000) ret=0040879f
0024:Call ntdll.LdrFindResource_U(00400000,00e6ea4c,00000003,00e6ea38) ret=7b5fbb3b
0024:Ret ntdll.LdrFindResource_U() retval=00000000 ret=7b5fbb3b
0024:Call ntdll.LdrAccessResource(00400000,00b033e0,00e6eac0,00000000) ret=7b6148f6
0024:Ret ntdll.LdrAccessResource() retval=00000000 ret=7b6148f6
0024:Ret user32.LoadStringA() retval=00000021 ret=0040879f
0024:Call KERNEL32.RaiseException(0eedfade,00000001,00000007,00e6fb88) ret=00417362
0024:trace:seh:dispatch_exception code=eedfade (unknown) flags=1 addr=7B627448
0024:trace:seh:dispatch_exception info[0]=00417362
0024:trace:seh:dispatch_exception info[1]=02B80430
0024:trace:seh:dispatch_exception info[2]=0041625C
0024:trace:seh:dispatch_exception info[3]=00E6FBB8
0024:trace:seh:dispatch_exception info[4]=00000000
0024:trace:seh:dispatch_exception info[5]=00E6FDF8
0024:trace:seh:dispatch_exception info[6]=00E6FBA4
0024:trace:seh:dispatch_exception eip=7b627448 esp=00e6fae0 ebp=00e6fb38 eflags=00000246
0024:trace:seh:dispatch_exception eax=00e6fae0 ebx=00000018 ecx=00e6faf4 edx=00e6fb88
0024:trace:seh:dispatch_exception esi=00e6fdf8 edi=00e6fb50 cs=0023 ds=002b es=002b fs=0063 gs=006b ss=002b
0024:trace:seh:call_seh_handlers calling handler at 00810CAC code=eedfade flags=1
0024:trace:seh:call_seh_handlers handler at 00810CAC returned 1
0024:trace:seh:call_seh_handlers calling handler at 00874F3A code=eedfade flags=1
0024:trace:seh:call_seh_handlers handler at 00874F3A returned 1
0024:trace:seh:call_seh_handlers calling handler at 0096B5C7 code=eedfade flags=1
0024:trace:seh:call_seh_handlers handler at 0096B5C7 returned 1
0024:trace:seh:call_seh_handlers calling handler at 004059FC code=eedfade flags=1
0024:Call KERNEL32.UnhandledExceptionFilter(00e6ef18) ret=00405a20
0024:Call ntdll.NtQueryInformationProcess(ffffffff,0000000c,00e6ee84,00000004,00000000) ret=7b602304
0024:Ret ntdll.NtQueryInformationProcess() retval=00000000 ret=7b602304
0024:Call ntdll.NtCreateEvent(00e6eeac,001f0003,00e6eeb0,00000000,00000000) ret=7b642f85
0024:Ret ntdll.NtCreateEvent() retval=00000000 ret=7b642f85
wine: Unhandled exception 0x0eedfade in thread 24 at address 7B627448 (thread 0024), starting debugger...
</pre>
</details>
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7271
This MR enforces alignment of TLS slots as described in PE file.
--
v3: ntdll: Let layout of TLS vector be closer to native.
ntdll: Enforce the alignment of TLS directory entries.
kernel32: Add test for TLS memory layout.
kernel32/tests: Add a test about TLS slot alignment.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7251
Otherwise sending ^C to a running ARM64 process crashes it randomly.
Note that 0x110 is prev_frame, the field that immediately precedes
syscall_cfa.
Fixes: ca79629b3e436c8799281319dd313249bf05b9b5
--
v2: ntdll: Fix syscall_cfa offset in user_mode_abort_thread for ARM64.
https://gitlab.winehq.org/wine/wine/-/merge_requests/7268
Otherwise sending ^C to a running ARM64 process crashes it randomly.
Note that 0x110 is prev_frame, the field that immediately precedes
syscall_cfa.
Fixes: ca79629b3e436c8799281319dd313249bf05b9b5
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/7268