Commit graph

6751 commits

Author SHA1 Message Date
Alexandre Julliard 0538557512 ntdll: Initialize Unix calls early during startup. 2022-12-04 22:01:38 +01:00
Alexandre Julliard bef0969722 ntdll: Move the .so module initialization to winecrt0.
Use new ELF tag ids to avoid breaking backwards compatibility.
2022-12-04 22:00:43 +01:00
Alexandre Julliard 0aae4b0563 ntdll: Use ret instead of jmp to return from syscall dispatchers. 2022-12-03 00:05:16 +01:00
Alexandre Julliard 3242676e2e ntdll: Only build the wow64 function table on 64-bit. 2022-12-02 11:57:16 +01:00
Brendan Shanks 9645beb5c0 configure: Remove check for IOKit (always present on macOS). 2022-12-02 11:04:46 +01:00
Zebediah Figura e2c081a8eb ntdll: Trace the name of critical sections which are released while not acquired. 2022-12-02 11:04:45 +01:00
Rémi Bernon c2bff6b65f ntdll: Keep subheap parent heap pointer and check for mismatches. 2022-12-02 11:04:45 +01:00
Rémi Bernon 4502c1daa9 ntdll: Move the insertion of the first block out of create_subheap. 2022-12-02 11:04:45 +01:00
Rémi Bernon 2e8b19ec27 ntdll: Split create_free_block into block_init_free / insert_free_block. 2022-12-02 11:04:45 +01:00
Rémi Bernon 911e1f378c ntdll: Merge prev and next free heap blocks in heap_free_block.
As create_free_block is only called in other places where it is not
possible to have a free block either before or after.
2022-12-02 11:04:45 +01:00
Rémi Bernon bece622b8e ntdll: Split heap blocks before creating or resizing used block. 2022-12-02 11:04:45 +01:00
Rémi Bernon a540b4b246 ntdll: Clear BLOCK_FLAG_PREV_FREE flag out of shrink_used_block. 2022-12-02 11:04:45 +01:00
Rémi Bernon 99388f74c7 ntdll: Move heap allocation and initialization into RtlCreateHeap.
And rename HEAP_CreateSubHeap to create_subheap.
2022-12-02 11:04:45 +01:00
Rémi Bernon dd037455ca ntdll: Split heap region memory allocation to allocate_region helper. 2022-12-02 11:04:45 +01:00
Alexandre Julliard ee147d9216 ntdll: Replace the __wine_unix_call() syscall by a function calling through the dispatcher. 2022-12-01 20:36:04 +01:00
Alexandre Julliard a6bb3662dc ntdll: Implement a faster Unix call dispatcher on ARM. 2022-12-01 20:36:04 +01:00
Alexandre Julliard 2332fe7935 ntdll: Implement a faster Unix call dispatcher on ARM64. 2022-12-01 20:36:04 +01:00
Alexandre Julliard 5277c75406 ntdll: Implement a faster Unix call dispatcher on x86_64.
Inspired by a patch from Rémi Bernon.
2022-12-01 20:36:02 +01:00
Alexandre Julliard 911789e757 ntdll: Implement a faster Unix call dispatcher on i386.
Inspired by a patch from Rémi Bernon.
2022-12-01 20:35:47 +01:00
Alexandre Julliard 90adeb125f ntdll: Export the Unix call dispatcher function pointer. 2022-12-01 11:38:23 +01:00
Rémi Bernon a51e2a3f94 ntdll: Move delayed free support out of heap_free. 2022-11-30 20:38:27 +01:00
Rémi Bernon cbe3fb89d2 ntdll: Move large block free out of heap_free. 2022-11-30 20:38:27 +01:00
Rémi Bernon 523d4cc416 ntdll: Move large block alloc out of heap_allocate. 2022-11-30 20:38:27 +01:00
Rémi Bernon a7fda2f8cb ntdll: Make realloc implementation more generic.
Either resizing a block in place, or reallocating through RtlHeap calls.
2022-11-30 20:38:27 +01:00
Rémi Bernon ce450253bd ntdll: Return the old data size from heap_reallocate. 2022-11-30 20:38:27 +01:00
Rémi Bernon 4334c5b0c1 ntdll: Move large block resize in heap_reallocate. 2022-11-30 20:38:27 +01:00
Rémi Bernon 0c5f9e8d4e ntdll: Merge next free block before resizing in heap_reallocate. 2022-11-30 20:38:27 +01:00
Alexandre Julliard d406de1828 ntdll: Also fixup the delay import directory when mapping a .so dll. 2022-11-29 19:11:19 +01:00
Huw Davies 905821fc69 ntdll: Fix -Wformat warnings on macOS. 2022-11-29 13:15:34 +01:00
Jacek Caban ac5e7fab1f ntdll: Detect ntdll module also by module path comparison. 2022-11-28 21:06:47 +01:00
Rémi Bernon 871d2b9443 ntdll: Reallocate a new block if we failed to commit. 2022-11-28 21:02:40 +01:00
Rémi Bernon d0b46b2a18 ntdll: Inverse the control flow in heap_reallocate. 2022-11-28 21:02:40 +01:00
Rémi Bernon efc6a8f42c ntdll: Stop locking heap to access block-local data.
This moves unsafe_block_from_ptr calls outside of the heap lock.

We assume here that concurrent call to another heap function on a block
being freed is undefined, and it should then be safe to do so:

* The block type or base offset never change after a block has been
  allocated and until it is freed.

* Block flags such as BLOCK_FLAG_LARGE, or BLOCK_FLAG_USER_INFO also
  never change after a block has been allocated.

* Other block flags are only read and modified inside the heap lock.
2022-11-28 21:02:37 +01:00
Rémi Bernon 708462f6aa ntdll: Avoid clearing BLOCK_FLAG_USER_INFO in heap_reallocate. 2022-11-28 21:02:37 +01:00
Rémi Bernon 2f6b763fa9 ntdll: Find heap block region from its base offset. 2022-11-28 21:02:37 +01:00
Rémi Bernon fd8e52b4e7 ntdll: Keep the region base offset in the block header. 2022-11-28 21:02:37 +01:00
Jacek Caban 68eee4053c ntdll: Call init_handler in usr1_handler.
It's needed before is_inside_syscall accesses TEB.
2022-11-28 21:01:55 +01:00
Jacek Caban e7accd7c0f ntdll: Get TEB from signal stack pointer in init_handler.
We can't use NtCurrentTeb before setting %fs base.
2022-11-28 21:01:55 +01:00
Rémi Bernon 63b6ec5af3 ntdll: Pass a heap block pointer to initialize_block. 2022-11-24 22:20:20 +01:00
Rémi Bernon 1526ac755f ntdll: Compute block size before calling heap_(re)allocate. 2022-11-24 22:20:20 +01:00
Rémi Bernon e7827fc853 ntdll: Compute effective flags in unsafe_heap_from_handle. 2022-11-24 22:20:20 +01:00
Rémi Bernon 21218ce309 ntdll: Use BLOCK_FLAG_LARGE rather than subheap pointer. 2022-11-24 22:20:20 +01:00
Rémi Bernon ab28138862 ntdll: Rename heap block ALIGNMENT macro to BLOCK_ALIGN.
And COMMIT_MASK to REGION_ALIGN - 1.
2022-11-24 22:20:20 +01:00
Martin Storsjö d6829bdcba ntdll: Avoid accidentally picking up ntdll's __wine_unix_call_funcs for other DLLs.
When f7332ab4a6 switched load_so_dll
over to a proper Unix syscall, ntdll.so started providing the
symbol __wine_unix_call_funcs.

When a DLL calls NtQueryVirtualMemory(MemoryWineUnixFuncs), it can
do so speculatively, not knowing whether the corresponding unix
lib actually does provide anything.

When ntdll.so started providing this symbol, then such speculative
calls to NtQueryVirtualMemory(MemoryWineUnixFuncs) would end up
returning ntdll's __wine_unix_call_funcs if the intended DLL's
unix library lacked one.

This is the case with bcrypt, where the unix library doesn't
provide __wine_unix_call_funcs if gnutls is unavailable.

This fixes crashes after f7332ab4a6,
in builds without gnutls.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-11-23 20:35:06 +01:00
Zebediah Figura fadefecd15 ntdll: Remove an unnecessary cast. 2022-11-23 17:59:47 +01:00
Zebediah Figura 793cc934d9 ntdll: Avoid casting a struct to its first field. 2022-11-23 17:59:47 +01:00
Zebediah Figura 5741f94d1b ntdll: Always trace sizes with %#x. 2022-11-23 17:59:47 +01:00
Zebediah Figura c9cf44a363 ntdll: Add a get_free_list_block_size() helper. 2022-11-23 17:59:47 +01:00
Gerald Pfeifer 1d0383e2a4 ntdll: Make init_builtin_dll return a value on FreeBSD.
With commit 1d1690782b init_builtin_dll
gained a return value, alas the FreeBSD-specific code (under #ifdef)
was not adjusted and still returned void.
2022-11-23 10:59:58 +01:00
Nikolay Sivov cf6705a8ca kernelbase: Forward thread priority boost functions to ntdll.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2022-11-22 18:40:13 +01:00