Ken Thomases <ken(a)codeweavers.com> writes:
@@ -108,21 +108,63 @@
static struct wine_preload_info preload_info[] = { +/* On macOS, we allocate the low 64k area in two steps because PAGEZERO + * might not always be available. Also, the top-down allocations area + * on x86_64 is moved because the address on Linux exceeds the maximum + * allowed user space limit. Please note that on Linux, it is better to + * allocate the low 64k as a single chunk to avoid SELinux warnings on + * systems with CONFIG_DEFAULT_MMAP_MIN_ADDR < CONFIG_LSM_MMAP_MIN_ADDR. */ +#ifdef __APPLE__ +#ifdef __i386__ + { (void *)0x00000000, 0x00001000 }, /* first page */ + { (void *)0x00001000, 0x0000f000 }, /* low 64k */ + { (void *)0x00010000, 0x00100000 }, /* DOS area */ + { (void *)0x00110000, 0x67ef0000 }, /* low memory area */ + { (void *)0x7f000000, 0x03000000 }, /* top-down allocations + shared heap + virtual heap */ +#else /* __i386__ */ + { (void *)0x000000010000, 0x00100000 }, /* DOS area */ + { (void *)0x000000110000, 0x67ef0000 }, /* low memory area */ + { (void *)0x00007ff00000, 0x000f0000 }, /* shared user data */ + { (void *)0x7fff40000000, 0x01ff0000 }, /* top-down allocations + virtual heap */ +#endif /* __i386__ */ +#else /* __APPLE__ */ #ifdef __i386__ { (void *)0x00000000, 0x00010000 }, /* low 64k */ { (void *)0x00010000, 0x00100000 }, /* DOS area */ { (void *)0x00110000, 0x67ef0000 }, /* low memory area */ { (void *)0x7f000000, 0x03000000 }, /* top-down allocations + shared heap + virtual heap */ -#else +#else /* __i386__ */ { (void *)0x000000010000, 0x00100000 }, /* DOS area */ { (void *)0x000000110000, 0x67ef0000 }, /* low memory area */ { (void *)0x00007ff00000, 0x000f0000 }, /* shared user data */ { (void *)0x7ffffe000000, 0x01ff0000 }, /* top-down allocations + virtual heap */ -#endif +#endif /* __i386__ */ +#endif /* __APPLE__ */ { 0, 0 }, /* PE exe range set with WINEPRELOADRESERVE */ { 0, 0 } /* end of list */ };
+#ifdef __APPLE__ + +#ifndef LC_MAIN +#define LC_MAIN 0x80000028 +struct entry_point_command +{ + uint32_t cmd; + uint32_t cmdsize; + uint64_t entryoff; + uint64_t stacksize; +}; +#endif + +#else /* __APPLE__ */
With all these #ifdef __APPLE__ there is very little common code left. It would be better to put the Mac implementation in a separate file. -- Alexandre Julliard julliard(a)winehq.org