mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-09 05:01:02 -08:00
* mps/code/w3i6gc.gmk: * mps/code/w3i3gc.gmk: * mps/code/mingw.gmk: New files, for the MinGW build. * mps/code/ss.c (StackHot) [__MINGW32__ && __GNUC__ >= 12]: Ignore dangling-pointer warnings. * mps/code/global.c (ArenaFinalize): Avoid compiler warnings. * mps/code/thw3.c (ThreadScan): Avoid compilation errors due to prototype mismatch. * mps/code/testlib.h (alloca): Don't redefine for MinGW. (setenv): Don't redefine for mingw.org's MinGW. (ulongest_t, longest_t): Separate definitions for MinGW64. * mps/code/testlib.c (sizelog2) [__MINGW32__]: Fix comparison. (rnd_align): Avoid name clashes with 'min' and 'max'. * mps/code/spw3i3.c (StackProbe) [__GNUC__]: Implementation for MinGW. * mps/code/protw3.c: Avoid compiler warning. * mps/code/mpstd.h: Define MinGW (_X86_) and MinGW64 (__X86_64) configurations. * mps/code/mpsiw3.c (mps_SEH_filter, mps_SEH_handler): Add prototypes. * mps/code/mps.c [MPS_PF_W3I3GC]: Define 32-bit MinGW stuff. [MPS_PF_W3I6GC]: Define 64-bit MinGW64 stuff. * mps/code/lockw3.c (RTL_RUN_ONCE, PRTL_RUN_ONCE_INIT_FN) (RTL_RUN_ONCE_INIT, INIT_ONCE_STATIC_INIT, RTL_RUN_ONCE INIT_ONCE) (PRTL_RUN_ONCE PINIT_ONCE, PINIT_ONCE_FN, InitOnceExecuteOnce): Define for mingw.org's MinGW. * mps/code/comm.gmk (EVENT_TARGETS, EXTRA_TARGETS, TEST_TARGETS) (UNBUILDABLE_TARGETS): Add $(EXEEXT) to program names. (TESTTHR): Define correct test for MS-Windows. Don't fail the build if the *.d dependency files don't exist.
74 lines
2.4 KiB
C
74 lines
2.4 KiB
C
/* spw3i3.c: STACK PROBE FOR 32-BIT WINDOWS
|
|
*
|
|
* $Id$
|
|
* Copyright (c) 2001-2020 Ravenbrook Limited. See end of file for license.
|
|
* Portions copyright (C) 2001 Global Graphics Software.
|
|
*
|
|
* This function reads a location that is depth words beyond the
|
|
* current stack pointer. On Intel platforms, the stack grows
|
|
* downwards, so this means reading from a location with a lesser
|
|
* address.
|
|
*/
|
|
|
|
|
|
#include "mpm.h"
|
|
|
|
#if !defined(MPS_OS_W3) || !defined(MPS_ARCH_I3)
|
|
#error "spw3i3.c is specific to MPS_OS_W3 and MPS_ARCH_I3"
|
|
#endif
|
|
|
|
#ifdef MPS_BUILD_PC
|
|
|
|
/* "[ISO] Inline assembly code is not portable." */
|
|
#pragma warn(disable: 2007)
|
|
|
|
#endif /* MPS_BUILD_PC */
|
|
|
|
|
|
void StackProbe(Size depth)
|
|
{
|
|
#ifdef __GNUC__
|
|
__asm__ volatile ("mov %0, %%eax\n\t"
|
|
"neg %%eax\n\t"
|
|
"mov (%%esp,%%eax,4), %%eax" /* do the actual probe */
|
|
: /* no outputs */
|
|
: "r" (depth)
|
|
: "eax");
|
|
#else /* MSVC */
|
|
__asm {
|
|
mov eax, depth
|
|
neg eax
|
|
mov eax, [esp+eax*4] /* do the actual probe */
|
|
}
|
|
#endif
|
|
}
|
|
|
|
|
|
/* C. COPYRIGHT AND LICENSE
|
|
*
|
|
* Copyright (C) 2001-2020 Ravenbrook Limited <https://www.ravenbrook.com/>.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions are
|
|
* met:
|
|
*
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
*
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the
|
|
* distribution.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|