Commit graph

12 commits

Author SHA1 Message Date
Brendan Shanks
9ab93415f7 loader: In macOS preloader, manually set 'environ' to work around a bug in macOS 12 and later.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54009
2022-12-01 10:25:19 +01:00
Brendan Shanks
588e555425 loader: In macOS preloader, fix up argc/argv in C rather than asm. 2022-12-01 10:25:19 +01:00
Brendan Shanks
4ec770a139 loader: Add comments to 'start' in macOS preloader. 2022-12-01 10:25:19 +01:00
Alexandre Julliard
e3001b6a7c configure: Assume that sys/mman.h is available on Unix.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 18:43:51 +01:00
Alexandre Julliard
28d7d5ba93 loader: Avoid including wine/port.h.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 16:16:07 +02:00
Brendan Shanks
307f5d00f1 loader: On Mac, reserve an area starting at 4GB to force Rosetta's allocations higher.
On Apple Silicon, Rosetta allocates memory starting at 0x100000000
(the 4GB line) before the preloader runs.
The .NET 3.5 installer and DirectX Jun2010 redistributable both contain
non-relocatable EXEs with that base address, which fail to run.

The workaround is to create an empty linker section at that address,
which is mapped by the kernel before Rosetta runs and forces Rosetta's
allocations higher in memory.
The linker section runs from 0x100000000-0x114000000.
Rosetta's allocations are ~132MB, and should end below 0x120000000.

This is not an exact science: a non-relocatable EXE with base address
between 0x114000000-0x120000000 will fail to run. If one is discovered,
the section size will need to be changed.

Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-29 10:16:48 +01:00
Brendan Shanks
720611e28e loader: On Mac, move the top-down allocations area down to avoid Rosetta regions.
On Apple Silicon, Rosetta's shared cache starts at 0x7ffe00000000 and
the runtime is mapped below that.
Put the top-down allocation area below the runtime with plenty of room
to spare.

Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-29 10:16:42 +01:00
Alexandre Julliard
d5a372abbb include: Move inline assembly definitions to a new wine/asm.h header.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-14 13:45:07 +02:00
Ken Thomases
07d80641d0 loader: On Mac, move the top-down allocations area down to avoid regions reserved by the system.
On macOS 10.14 (Mojave), there's a system-wide VM mapping for common system
libraries starting at 0x00007fff00000000.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-04 15:39:43 +01:00
Ken Thomases
cc24255da4 loader: Check if the preloader overlaps the reserved range on the Mac.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-06 08:57:52 +01:00
Alexandre Julliard
df8c5a37ec loader: Duplicate some preloader code instead of trying to share it.
This mostly reverts bd2d795240.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-05 22:33:43 +01:00
Sebastian Lackner
a0ab2a7b0c loader: Implement preloader for macOS.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-12-04 11:10:09 +01:00