2 * Copyright (c) 1996-2011 Barton P. Miller
4 * We provide the Paradyn Parallel Performance Tools (below
5 * described as "Paradyn") on an AS IS basis, and do not warrant its
6 * validity or performance. We reserve the right to update, modify,
7 * or discontinue this software at any time. We shall have no
8 * obligation to supply such updates or modifications or any other
9 * form of support to you.
11 * By your use of Paradyn, you understand and agree that we (or any
12 * other person or entity with proprietary rights in Paradyn) are
13 * under no obligation to provide either maintenance services,
14 * update services, notices of latent defects, or correction of
15 * defects for Paradyn.
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License as published by the Free Software Foundation; either
20 * version 2.1 of the License, or (at your option) any later version.
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * Lesser General Public License for more details.
27 * You should have received a copy of the GNU Lesser General Public
28 * License along with this library; if not, write to the Free Software
29 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
32 /* $Id: RTmutatedBinary.c,v 1.10 2008/02/20 08:31:08 jaw Exp $ */
34 /* this file contains the code to restore the necessary
35 data for a mutated binary
42 extern int isMutatedExec;
45 /* checkMutatedFile() is defined in RTmutatedBinary_<fileformat>.c */
47 extern int checkMutatedFile();
50 * This function sets up pre-initialization
51 * data structures for SaveTheWorld. Ensure
52 * it is called _before_ DYNINSTinit
54 #if defined (cap_save_the_world)
55 void RTmutatedBinary_init()
58 /* this buffer is allocated to clear
59 the first page on the heap. This is necessary
60 because loading the heap tramps uses mmap, which
61 is going to eat the heap if the heap begins on
62 the same page the heap tramps end on (almost certain)
64 /* Call-once protection */
68 buffer = (char*) malloc(getpagesize());
69 isMutatedExec =checkMutatedFile();
70 /* Can't free this buffer, because we need the same memory footprint
71 for when we load in shared libraries */