aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code
diff options
context:
space:
mode:
authorDavid Jones2007-03-01 19:30:53 +0000
committerDavid Jones2007-03-01 19:30:53 +0000
commit802a7124a6ea704da5fccdf9b7d09772d46995c1 (patch)
tree192067279db76167beac03cdcd594c747b8f5bdb /mps/code
parent671f9ae3ee9ba911c921ca8c72afb7b13c89f94e (diff)
downloademacs-802a7124a6ea704da5fccdf9b7d09772d46995c1.tar.gz
emacs-802a7124a6ea704da5fccdf9b7d09772d46995c1.zip
Mps: using common stackscan code for freebsd/darwin.
Copied from Perforce Change: 161874 ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
-rw-r--r--mps/code/fri4gc.gmk2
-rw-r--r--mps/code/ssfri3.c100
2 files changed, 1 insertions, 101 deletions
diff --git a/mps/code/fri4gc.gmk b/mps/code/fri4gc.gmk
index 60f312f65eb..adeb3f222a4 100644
--- a/mps/code/fri4gc.gmk
+++ b/mps/code/fri4gc.gmk
@@ -8,7 +8,7 @@ PFM = fri4gc
8PFMDEFS = -D_REENTRANT 8PFMDEFS = -D_REENTRANT
9 9
10MPMPF = lockfr.c thfri4.c pthrdext.c vmfr.c \ 10MPMPF = lockfr.c thfri4.c pthrdext.c vmfr.c \
11 protfr.c protfri3.c prmcan.c ssfri3.c span.c 11 protfr.c protfri3.c prmcan.c ssixi3.c span.c
12SWPF = than.c vmfr.c protsw.c prmcan.c ssan.c 12SWPF = than.c vmfr.c protsw.c prmcan.c ssan.c
13 13
14LIBS = -lm -pthread 14LIBS = -lm -pthread
diff --git a/mps/code/ssfri3.c b/mps/code/ssfri3.c
deleted file mode 100644
index 1a40225911b..00000000000
--- a/mps/code/ssfri3.c
+++ /dev/null
@@ -1,100 +0,0 @@
1/* ssfri3.c: FREEBSD/INTEL STACK SCANNING
2 *
3 * $Id$
4 * Copyright (c) 2001 Ravenbrook Limited. See end of file for license.
5 *
6 * This scans the stack and fixes the registers which may contain
7 * roots. See <design/thread-manager/>.
8 *
9 * The registers edi, esi, ebx are the registers defined to be preserved
10 * across function calls and therefore may contain roots.
11 * These are pushed on the stack for scanning.
12 *
13 * SOURCES
14 *
15 * .source.callees.saves: Set of callee-saved registers taken from
16 * CALL_USED_REGISTERS in <gcc-sources>/config/i386/i386.h.
17 *
18 * ASSUMPTIONS
19 *
20 * .assume.align: The stack pointer is assumed to be aligned on a word
21 * boundary.
22 *
23 * .assume.asm.stack: The compiler must not do wacky things with the
24 * stack pointer around a call since we need to ensure that the
25 * callee-save regs are visible during TraceScanArea.
26 *
27 * .assume.asm.order: The volatile modifier should prevent movement
28 * of code, which might break .assume.asm.stack.
29 *
30 */
31
32
33#include "mpm.h"
34
35SRCID(ssfri3, "$Id$");
36
37/* .assume.asm.order */
38#define ASMV(x) __asm__ volatile (x)
39
40
41Res StackScan(ScanState ss, Addr *stackBot)
42{
43 Addr *stackTop;
44 Res res;
45
46 /* .assume.asm.stack */
47 ASMV("push %ebx"); /* These registers are callee-saved */
48 ASMV("push %esi"); /* and so may contain roots. They are pushed */
49 ASMV("push %edi"); /* for scanning. See .source.callees.saves. */
50 ASMV("mov %%esp, %0" : "=r" (stackTop) :); /* stackTop = esp */
51
52 AVER(AddrIsAligned((Addr)stackTop, sizeof(Addr))); /* .assume.align */
53 res = TraceScanArea(ss, stackTop, stackBot);
54
55 ASMV("add $12, %esp"); /* pop 3 regs to restore the stack pointer */
56
57 return res;
58}
59
60
61/* C. COPYRIGHT AND LICENSE
62 *
63 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
64 * All rights reserved. This is an open source license. Contact
65 * Ravenbrook for commercial licensing options.
66 *
67 * Redistribution and use in source and binary forms, with or without
68 * modification, are permitted provided that the following conditions are
69 * met:
70 *
71 * 1. Redistributions of source code must retain the above copyright
72 * notice, this list of conditions and the following disclaimer.
73 *
74 * 2. Redistributions in binary form must reproduce the above copyright
75 * notice, this list of conditions and the following disclaimer in the
76 * documentation and/or other materials provided with the distribution.
77 *
78 * 3. Redistributions in any form must be accompanied by information on how
79 * to obtain complete source code for this software and any accompanying
80 * software that uses this software. The source code must either be
81 * included in the distribution or be available for no more than the cost
82 * of distribution plus a nominal fee, and must be freely redistributable
83 * under reasonable conditions. For an executable file, complete source
84 * code means the source code for all modules it contains. It does not
85 * include source code for modules or files that typically accompany the
86 * major components of the operating system on which the executable file
87 * runs.
88 *
89 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
90 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
91 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
92 * PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
93 * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
94 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
95 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
96 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
97 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
98 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
99 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
100 */