Commit Graph

4906 Commits (be0eb9c92eb7a4fcd9d0d48568c8ed5e8326ef0b)

Author SHA1 Message Date
Alexandre Julliard be0eb9c92e ntdll: Move the thread startup code to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-03 20:01:16 +02:00
Alexandre Julliard 9fe61171e5 ntdll: Use the local server_send_fd() function in the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-02 17:39:28 +02:00
Alexandre Julliard c96ef78b6d ntdll: Move the virtual memory functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-02 17:19:12 +02:00
Alexandre Julliard 7c32b2dd93 ntdll: Move NtGetContextThread() implementation to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-02 14:23:21 +02:00
Alexandre Julliard ac90898f72 ntdll: Move NtSetContextThread() implementation to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-02 14:01:10 +02:00
Gerald Pfeifer b4a868b8ad ntdll: Include <stdarg.h> in unix/debug.c.
Signed-off-by: Gerald Pfeifer <gerald@pfeifer.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-02 11:13:59 +02:00
Alexandre Julliard 87fa906a84 ntdll: Properly reset the stack environment at thread exit on ARM64.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49301
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-01 22:10:28 +02:00
Alexandre Julliard c0319e0eab ntdll: Move server wait functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-01 22:10:28 +02:00
Alexandre Julliard b925dd78b8 ntdll: Use the actual zero_bits parameter in the server requests.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-01 22:10:28 +02:00
Alexandre Julliard 3e9f8c87e5 ntdll: Move the threading initialization functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-01 22:10:28 +02:00
Alexandre Julliard 704975f58d ntdll: Add missing server_init_process_done() call.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49295
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-01 22:10:28 +02:00
Alexandre Julliard 04f41e87a3 ntdll: Move NtClose() and NtDuplicateObject() to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-01 22:10:28 +02:00
Rémi Bernon 1f25c6edf7 ntdll: Use the free ranges in find_reserved_free_area.
Instead of the view rbtree.

Testing shows a 20% FPS increase in We Happy Few, from 80-100fps to
100-120fps right after starting a new game.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-30 13:46:04 +02:00
Rémi Bernon eb716839e1 ntdll: Introduce free_ranges indexing sequence.
This is an ordered range sequence used to keep track of free address
ranges.

The sequence contains an entry for every free address range, with base
pointing to the first free address and end pointing to the next first
used address. It is initialized to [0, ~0] for convenience, so that
there's always a range before or after a view.

In the worst case scenario, where memory is entirely fragmented, there's
going to be one more range than allocated views, but in general there's
much less. In any case, because of cache locality, iterating in the
contiguous sequence is much faster than traversing the view rbtree.

In theory there can be a performance hit when allocating or deleting a
view, as we may have to move the end of the sequence when a range is
split or merged. But in practice and given the usually low number of
ranges, this is not an issue.

The default and maximum sequence size can hold up to 65536 ranges, which
is much more than enough in general, and performance is probably going
to be bad before reaching the limit anyway. The code currently asserts
when reaching the limit, although we could possibly grow the sequence.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-30 13:45:55 +02:00
Alexandre Julliard 01150d7f8d ntdll: Move server call functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-29 20:05:30 +02:00
Alexandre Julliard 1a743c9af3 ntdll: Move fd cache functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-29 20:05:30 +02:00
Alexandre Julliard 8a63b688ac ntdll: Move server initialization functions to the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-29 20:05:30 +02:00
Alexandre Julliard e6e2f2325a ntdll: Don't include ntdll_misc.h from the Unix library.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-29 16:17:32 +02:00
Alexandre Julliard e854ea34cc ntdll: Create user shared data section in the server, and initialize it in wineboot.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-29 16:17:32 +02:00
Alexandre Julliard 42bd67b576 ntdll: Don't call terminate_thread request if not necessary.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-29 16:17:32 +02:00
Martin Storsjo e0c8c4c3cd ntdll: Implement RtlRaiseException in assembly to fix continuing from exceptions.
If the handlers returned ExceptionContinueExecution and we restore
the stored context, make sure it's a context that ends up returning
from the RtlRaiseException function.

This matches how it's done on x86_64.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo 763f15ccde ntdll: Fix unwinding through raise_generic_exception.
Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo a8a944c220 ntdll: Keep the previous iteration of NonVolatileRegisters in call_function_handlers.
Some language specific handlers, called by call_handler, can use
the NonVolatileRegisters to restore the context before running
code, and that assumes that NonVolatileRegisters contains the frame
pointer as it was within the function (before unwinding).

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo 6c11d1d745 ntdll: Implement RtlRestoreContext.
Call the consolidate frame callback before resuming. Before
calling the callback, fill in ExceptionInformation[10] with the
equivalent of dispatch.NonVolatileRegisters.

This fixes unwinding of MSVC C++ exceptions in a lot of cases.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo babbf352b6 ntdll: Fix unwinding functions that end with a branch instruction.
This happens with functions that aren't intended to return e.g. like
_Unwind_Resume. In these cases, the return address is outside of the
function (the first instruction in the next function).

Set the flag CONTEXT_UNWOUND_TO_CALL after unwinding to a callsite,
and if this flag is set, look up a RUNTIME_FUNCTION based on
Control.Pc - 4.

This isn't a complete (nor probably entirely correct) implementation
of the flag CONTEXT_UNWOUND_TO_CALL, but it practically seems to
work fine and fixes a large number of unwinding cases.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo 42a5885669 ntdll: Store the real stack pointer in RtlCaptureContext.
In most cases, unwinding will use the frame pointer anyway, so it
doesn't make much of a difference, but for cases where it won't,
capture the actual stack pointer.

(In most cases on arm64, calling the RtlCaptureContext won't cause
anything extra to be pushed on the stack at that point anyway).

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo 8e4f0b2a15 ntdll: Pass a nonnull handler_data in when continuing after a collided unwind.
This matches what was done for RtlUnwindEx in
93ecc54ae5, applying the same change
in call_function_handlers (when called from raise_exception).

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo d6e9795223 ntdll: Fix byte vs register units in unwind_packed_data.
restore_regs and restore_fpregs take offsets in units of registers,
not bytes.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Martin Storsjo 8477f61b9f ntdll: Fix handling of the save_lrpair unwind opcode.
The register offset should be multiplied by 2, and the second
register is always Lr.

Signed-off-by: Martin Storsjo <martin@martin.st>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:18:32 +02:00
Alex Henrie fef9849aae ntdll/tests: Make RtlIpv6AddressToString test data static and constant.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-28 20:10:54 +02:00
Alexandre Julliard f5e703042a ntdll: Fix off-by-one buffer size error.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49262
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-27 16:08:12 +02:00
Huw Davies 51c9db55e6 ntdll: Remove unnecessary page variable.
get_page_vprot() doesn't require the base address.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-27 00:14:14 +02:00
Huw Davies a98dd5a63e ntdll: Use the correct size when the read spans a page boundary.
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-27 00:14:13 +02:00
Alexandre Julliard 54a7e592e4 ntdll: Implement ProcessImageInformation class in NtQueryInformationProcess().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-26 15:58:13 +02:00
Alex Henrie 0af08318b7 ntdll: Implement RtlIpv6AddressToString(Ex)[AW].
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46788
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-26 10:12:12 +02:00
Alex Henrie e5f69e81f3 ntdll/tests: Add more RtlIpv6AddressToString tests.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-26 10:10:28 +02:00
Alex Henrie 917002c88f ntdll/tests: Drop RTL function workarounds for Windows <= 2000.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-26 10:10:22 +02:00
Alex Henrie e3d2d852a4 include: Add more RTL functions.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-26 10:10:15 +02:00
Alex Henrie bab2de00aa ntdll: Increase size of IPv6 address string buffers.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-26 10:07:27 +02:00
Paul Gofman ca56ef6739 ntdll: Fill ActiveGroupCount field in _KUSER_SHARED_DATA.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-25 20:23:31 +02:00
Paul Gofman 1306bd941b ntdll: Fill ActiveProcessorCount field in _KUSER_SHARED_DATA.
Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-25 20:23:29 +02:00
Thomas Faber 2a2607e2a3 ntdll/tests: Fix a test failure on Server 2003.
Signed-off-by: Thomas Faber <thomas.faber@reactos.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-25 20:21:12 +02:00
Damjan Jovanovic 8c3e6c378d ntdll: Reserve the area whenever possible in reserve_area() on FreeBSD.
Signed-off-by: Damjan Jovanovic <damjan.jov@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-25 20:21:00 +02:00
Matteo Bruni 2e5c2c7cdb ntdll: Use memcpy() in set_float_reg().
The source address might not be aligned although the compiler can
expect alignment when using a plain assignment.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-25 20:20:09 +02:00
Gijs Vermeulen 676b6b0fd7 ntdll: Fix number of arguments passed to mmap_remove_reserved_area in apple_create_wine_thread.
This fixes a regression introduced by 625209433f

Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-22 19:50:48 +02:00
Alexandre Julliard 9b8fabf4b0 ntdll: Silence a va_start compiler warning.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-22 14:32:02 +02:00
Alexandre Julliard 6bed2b427b kernel32: Move the *PreferredUILanguages functions to kernelbase and ntdll.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-22 14:31:55 +02:00
Alexandre Julliard 75e2f79b68 ntdll: Implement SystemTimeAdjustmentInformation class.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-22 14:31:55 +02:00
Alexandre Julliard 7cc9ccbd22 kernel32: Move GetProcessTimes() implementation to kernelbase and ntdll.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-22 14:31:55 +02:00
Alexandre Julliard cd215bb49b kernel32: Use the user shared data to implement GetTickCount().
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-21 19:36:52 +02:00