Commit 587fd086 authored by Fabrice Popineau's avatar Fabrice Popineau Committed by Eli Zaretskii

Use mmap(2) emulation for buffer text on MS-Windows.

 src/Makefile.in (C_HEAP_SWITCH): Get the predefined heap size from
 configure.
 (ADDSECTION, MINGW_TEMACS_POST_LINK): Remove, no longer used.
 src/lisp.h (NONPOINTER_BITS): Modify the condition to define to zero
 for MinGW, since it no longer uses gmalloc.
 src/buffer.c: Do not define mmap allocations functions for Windows.
 Remove mmap_find which is unused. Remove mmap_set_vars which does
 nothing useful.
 [WINDOWSNT]: Include w32heap.h.
 (init_buffer): Always allocate new memory for buffers.
 src/emacs.c: Remove mmap_set_vars calls.
 src/image.c (free_image): Undef free for Windows because it is
 redirected to our private version.
 src/unexw32.c (COPY_PROC_CHUNK): Use %p format for 64bits
 compatibility.
 (copy_executable_and_dump_data): Remove dumping the heap section.
 (unexec): Restore using_dynamic_heap after dumping.
 src/w32heap.c (dumped_data_commit, malloc_after_dump)
 (malloc_before_dump, realloc_after_dump, realloc_before_dump)
 (free_after_dump, free_before_dump, mmap_alloc, mmap_realloc)
 (mmap_free): New functions.
 src/w32heap.h: Declare dumped_data and mmap_* function prototypes.

 nt/inc/ms-w32.h: Switch to the system heap allocation scheme
 instead of GNU malloc and ralloc.
 nt/inc/sys/mman.h: New file.
 nt/INSTALL: Update for the new build requirements.

 etc/NEWS: Mention build changes on MS-Windows.

 configure.ac (C_HEAP_SWITCH) define for different values of
 dumped heap size depending on 32/64bits arch on Windows.
 Don't check for pthreads.h on MinGW32/64, it gets in the way.
 Use mmap(2) for buffers and system malloc for MinGW32/64.
parent 0da7d35c
2014-05-27 Fabrice Popineau <fabrice.popineau@gmail.com>
* configure.ac (C_HEAP_SWITCH) define for different values of
dumped heap size depending on 32/64bits arch on Windows.
Don't check for pthreads.h on MinGW32/64, it gets in the way.
Use mmap(2) for buffers and system malloc for MinGW32/64.
2014-05-27 Paul Eggert <eggert@cs.ucla.edu>
Merge from gnulib, incorporating:
......
......@@ -1973,7 +1973,7 @@ doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
system_malloc=$emacs_cv_sanitize_address
case "$opsys" in
## darwin ld insists on the use of malloc routines in the System framework.
darwin|sol2-10) system_malloc=yes ;;
darwin|mingw32|sol2-10) system_malloc=yes ;;
esac
GMALLOC_OBJ=
......@@ -2020,7 +2020,7 @@ if test "$doug_lea_malloc" = "yes" ; then
## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif
## Does the AC_FUNC_MMAP test below make this check unnecessary?
case "$opsys" in
gnu*) REL_ALLOC=no ;;
mingw32|gnu*) REL_ALLOC=no ;;
esac
fi
......@@ -2030,7 +2030,7 @@ fi
use_mmap_for_buffers=no
case "$opsys" in
cygwin|freebsd|irix6-5) use_mmap_for_buffers=yes ;;
cygwin|mingw32|freebsd|irix6-5) use_mmap_for_buffers=yes ;;
esac
AC_FUNC_MMAP
......@@ -2046,6 +2046,7 @@ AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
dnl Check for the POSIX thread library.
LIB_PTHREAD=
if test "$opsys" != "mingw32"; then
AC_CHECK_HEADERS_ONCE(pthread.h)
if test "$ac_cv_header_pthread_h"; then
dnl gmalloc.c uses pthread_atfork, which is not available on older-style
......@@ -2066,6 +2067,7 @@ if test "$ac_cv_header_pthread_h"; then
LIBS=$OLD_LIBS
fi
AC_SUBST([LIB_PTHREAD])
fi
dnl Check for need for bigtoc support on IBM AIX
......@@ -4817,11 +4819,9 @@ case "$opsys" in
gnu*) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_RPATH)" ;;
mingw32)
## MinGW64 does not prepend an underscore to symbols, so we must
## pass a different -entry switch to linker. FIXME: It is better
## to make the entry points the same by changing unexw32.c.
## Is it any better under MinGW64 to relocate emacs into higher addresses?
case "$canonical" in
x86_64-*-*) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 -Wl,-entry,__start -Wl,-Map,./temacs.map" ;;
x86_64-*-*) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x400000000 -Wl,-entry,__start -Wl,-Map,./temacs.map" ;;
*) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 -Wl,-entry,__start -Wl,-Map,./temacs.map" ;;
esac
;;
......@@ -4845,20 +4845,20 @@ AC_SUBST(LD_SWITCH_SYSTEM_TEMACS)
## MinGW-specific post-link processing of temacs.
TEMACS_POST_LINK=":"
ADDSECTION=
EMACS_HEAPSIZE=
C_HEAP_SWITCH=
if test "${opsys}" = "mingw32"; then
TEMACS_POST_LINK="\$(MINGW_TEMACS_POST_LINK)"
ADDSECTION="../nt/addsection\$(EXEEXT)"
## Preload heap size of temacs.exe in MB.
case "$canonical" in
x86_64-*-*) EMACS_HEAPSIZE=42 ;;
*) EMACS_HEAPSIZE=27 ;;
x86_64-*-*) C_HEAP_SWITCH="-DHEAPSIZE=18" ;;
*) C_HEAP_SWITCH="-DHEAPSIZE=10" ;;
esac
fi
AC_SUBST(ADDSECTION)
AC_SUBST(TEMACS_POST_LINK)
AC_SUBST(EMACS_HEAPSIZE)
AC_SUBST(C_HEAP_SWITCH)
## Common for all window systems
if test "$window_system" != "none"; then
......
2014-05-27 Fabrice Popineau <fabrice.popineau@gmail.com>
* NEWS: Mention build changes on MS-Windows.
2014-05-26 Paul Eggert <eggert@cs.ucla.edu>
Specify coding if Latin-1 Emacs would misinterpret (Bug#17575).
......
......@@ -40,6 +40,11 @@ or by sticking with Emacs 24.4.
** The configure option `--with-pkg-config-prog' has been removed.
Use './configure PKG_CONFIG=/full/name/of/pkg-config' if you need to.
---
** Building Emacs for MS-Windows requires at least Windows XP
or Windows Server 2003. The built binaries still run on all versions
of Windows starting with Windows 9X.
* Startup Changes in Emacs 24.5
......
2014-05-27 Fabrice Popineau <fabrice.popineau@gmail.com>
* inc/ms-w32.h: Switch to the system heap allocation scheme
instead of GNU malloc and ralloc.
* inc/sys/mman.h: New file.
* INSTALL: Update for the new build requirements.
2014-05-17 Paul Eggert <eggert@cs.ucla.edu>
Assume C99 or later (Bug#17487).
......
......@@ -5,9 +5,9 @@
See the end of the file for license conditions.
The MSYS/MinGW build described here is supported on versions of
Windows starting with Windows 2000 and newer. Windows 9X are not
supported (but the Emacs binary produced by this build will run on
Windows 9X as well).
Windows starting with Windows XP and newer. Building on Windows 2000
and Windows 9X is not supported (but the Emacs binary produced by this
build will run on Windows 9X and newer systems).
Do not use this recipe with Cygwin. For building on Cygwin, use the
normal installation instructions, ../INSTALL.
......@@ -389,9 +389,10 @@ Windows 9X as well).
Where should the build process find the source code? /path/to/emacs/sources
What compiler should emacs be built with? gcc -std=gnu99 -O0 -g3
Should Emacs use the GNU version of malloc? yes
Should Emacs use a relocating allocator for buffers? yes
Should Emacs use mmap(2) for buffer allocation? no
Should Emacs use the GNU version of malloc? no
(The GNU allocators don't work with this system configuration.)
Should Emacs use a relocating allocator for buffers? no
Should Emacs use mmap(2) for buffer allocation? yes
What window system should Emacs use? w32
What toolkit should Emacs use? none
Where do we find X Windows header files? NONE
......@@ -401,13 +402,16 @@ Windows 9X as well).
Does Emacs use -ljpeg? yes
Does Emacs use -ltiff? yes
Does Emacs use a gif library? yes
Does Emacs use -lpng? yes
Does Emacs use -lrsvg-2? no
Does Emacs use a png library? yes
Does Emacs use -lrsvg-2? yes
Does Emacs use imagemagick? no
Does Emacs support sound? no
Does Emacs use -lgpm? no
Does Emacs use -ldbus? no
Does Emacs use -lgconf? no
Does Emacs use GSettings? no
Does Emacs use a file notification library? yes (w32)
Does Emacs use access control lists? yes
Does Emacs use -lselinux? no
Does Emacs use -lgnutls? yes
Does Emacs use -lxml2? yes
......@@ -415,6 +419,7 @@ Windows 9X as well).
Does Emacs use -lm17n-flt? no
Does Emacs use -lotf? no
Does Emacs use -lxft? no
Does Emacs directly use zlib? yes
Does Emacs use toolkit scroll bars? yes
You are almost there, hang on.
......
......@@ -140,6 +140,7 @@ extern char *getenv ();
in its system headers, and is not really compatible with values
lower than 0x0500, so leave it alone. */
#ifndef _W64
# undef _WIN32_WINNT
# define _WIN32_WINNT 0x0400
#endif
......@@ -427,20 +428,36 @@ extern char *get_emacs_configuration_options (void);
#define _WINSOCK_H
/* Defines size_t and alloca (). */
#ifdef emacs
#define malloc e_malloc
#define free e_free
#define realloc e_realloc
#define calloc e_calloc
#endif
#include <stdlib.h>
#include <sys/stat.h>
#ifdef _MSC_VER
#define alloca _alloca
#else
#include <malloc.h>
#endif
#include <stdlib.h>
#include <sys/stat.h>
#ifdef emacs
typedef void * (* malloc_fn)(size_t);
typedef void * (* realloc_fn)(void *, size_t);
typedef void (* free_fn)(void *);
extern void *malloc_before_dump(size_t);
extern void *realloc_before_dump(void *, size_t);
extern void free_before_dump(void *);
extern void *malloc_after_dump(size_t);
extern void *realloc_after_dump(void *, size_t);
extern void free_after_dump(void *);
extern malloc_fn the_malloc_fn;
extern realloc_fn the_realloc_fn;
extern free_fn the_free_fn;
#define malloc(size) (*the_malloc_fn)(size)
#define free(ptr) (*the_free_fn)(ptr)
#define realloc(ptr, size) (*the_realloc_fn)(ptr, size)
#endif
/* Define for those source files that do not include enough NT system files. */
#ifndef NULL
......
/*
* sys/mman.h
* mman-win32
*/
#ifndef _SYS_MMAN_H_
#define _SYS_MMAN_H_
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/* We need MAP_ANON in src/buffer.c */
#define MAP_FILE 0
#define MAP_SHARED 1
#define MAP_PRIVATE 2
#define MAP_TYPE 0xf
#define MAP_FIXED 0x10
#define MAP_ANONYMOUS 0x20
#define MAP_ANON MAP_ANONYMOUS
#define MAP_FAILED ((void *)-1)
#ifdef __cplusplus
};
#endif
#endif /* _SYS_MMAN_H_ */
2014-05-27 Fabrice Popineau <fabrice.popineau@gmail.com>
* Makefile.in (C_HEAP_SWITCH): Get the predefined heap size from
configure.
(ADDSECTION, MINGW_TEMACS_POST_LINK): Remove, no longer used.
* lisp.h (NONPOINTER_BITS): Modify the condition to define to zero
for MinGW, since it no longer uses gmalloc.
* buffer.c: Do not define mmap allocations functions for Windows.
Remove mmap_find which is unused. Remove mmap_set_vars which does
nothing useful.
[WINDOWSNT]: Include w32heap.h.
(init_buffer): Always allocate new memory for buffers.
* emacs.c: Remove mmap_set_vars calls.
* image.c (free_image): Undef free for Windows because it is
redirected to our private version.
* unexw32.c (COPY_PROC_CHUNK): Use %p format for 64bits
compatibility.
(copy_executable_and_dump_data): Remove dumping the heap section.
(unexec): Restore using_dynamic_heap after dumping.
* w32heap.c (dumped_data_commit, malloc_after_dump)
(malloc_before_dump, realloc_after_dump, realloc_before_dump)
(free_after_dump, free_before_dump, mmap_alloc, mmap_realloc)
(mmap_free): New functions.
* w32heap.h: Declare dumped_data and mmap_* function prototypes.
2014-05-27 Paul Eggert <eggert@cs.ucla.edu>
* image.c (imagemagick_load_image): Use MagickRealType for local
......
......@@ -86,6 +86,9 @@ PNG_CFLAGS=@PNG_CFLAGS@
## something similar. This is normally set by configure.
C_SWITCH_X_SITE=@C_SWITCH_X_SITE@
## Set Emacs dumped heap size for Windows NT
C_HEAP_SWITCH=@C_HEAP_SWITCH@
## Define LD_SWITCH_X_SITE to contain any special flags your loader
## may need to deal with X Windows. For instance, if your X libraries
## aren't in a place that your loader can find on its own, you might
......@@ -300,11 +303,7 @@ RUN_TEMACS = ./temacs
## Invoke ../nt/addsection for MinGW, ":" elsewhere.
TEMACS_POST_LINK = @TEMACS_POST_LINK@
ADDSECTION = @ADDSECTION@
EMACS_HEAPSIZE = @EMACS_HEAPSIZE@
MINGW_TEMACS_POST_LINK = \
mv temacs$(EXEEXT) temacs.tmp; \
../nt/addsection temacs.tmp temacs$(EXEEXT) EMHEAP $(EMACS_HEAPSIZE)
UNEXEC_OBJ = @UNEXEC_OBJ@
......@@ -326,7 +325,7 @@ MKDEPDIR=@MKDEPDIR@
##
## FIXME? MYCPPFLAGS only referenced in etc/DEBUG.
ALL_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \
-I$(lib) -I$(srcdir)/../lib \
-I$(lib) -I$(srcdir)/../lib $(C_HEAP_SWITCH) \
$(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
$(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \
$(PNG_CFLAGS) $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \
......
......@@ -41,6 +41,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "keymap.h"
#include "frame.h"
#ifdef WINDOWSNT
#include "w32heap.h" /* for mmap_* */
#endif
struct buffer *current_buffer; /* The current buffer. */
/* First buffer in chain of all buffers (in reverse order of creation).
......@@ -4632,7 +4636,8 @@ evaporate_overlays (ptrdiff_t pos)
Allocation with mmap
***********************************************************************/
#ifdef USE_MMAP_FOR_BUFFERS
/* Note: WINDOWSNT implements this stuff on w32heap.c. */
#if defined USE_MMAP_FOR_BUFFERS && !defined WINDOWSNT
#include <sys/mman.h>
......@@ -4774,36 +4779,6 @@ mmap_init (void)
mmap_page_size = getpagesize ();
}
/* Return a region overlapping address range START...END, or null if
none. END is not including, i.e. the last byte in the range
is at END - 1. */
static struct mmap_region *
mmap_find (void *start, void *end)
{
struct mmap_region *r;
char *s = start, *e = end;
for (r = mmap_regions; r; r = r->next)
{
char *rstart = (char *) r;
char *rend = rstart + r->nbytes_mapped;
if (/* First byte of range, i.e. START, in this region? */
(s >= rstart && s < rend)
/* Last byte of range, i.e. END - 1, in this region? */
|| (e > rstart && e <= rend)
/* First byte of this region in the range? */
|| (rstart >= s && rstart < e)
/* Last byte of this region in the range? */
|| (rend > s && rend <= e))
break;
}
return r;
}
/* Unmap a region. P is a pointer to the start of the user-araa of
the region. */
......@@ -4880,38 +4855,6 @@ mmap_enlarge (struct mmap_region *r, int npages)
}
/* Set or reset variables holding references to mapped regions.
If not RESTORE_P, set all variables to null. If RESTORE_P, set all
variables to the start of the user-areas of mapped regions.
This function is called from Fdump_emacs to ensure that the dumped
Emacs doesn't contain references to memory that won't be mapped
when Emacs starts. */
void
mmap_set_vars (bool restore_p)
{
struct mmap_region *r;
if (restore_p)
{
mmap_regions = mmap_regions_1;
mmap_fd = mmap_fd_1;
for (r = mmap_regions; r; r = r->next)
*r->var = MMAP_USER_AREA (r);
}
else
{
for (r = mmap_regions; r; r = r->next)
*r->var = NULL;
mmap_regions_1 = mmap_regions;
mmap_regions = NULL;
mmap_fd_1 = mmap_fd;
mmap_fd = -1;
}
}
/* Allocate a block of storage large enough to hold NBYTES bytes of
data. A pointer to the data is returned in *VAR. VAR is thus the
address of some variable which will use the data area.
......
......@@ -2155,13 +2155,8 @@ You must run Emacs in batch mode in order to dump it. */)
malloc_state_ptr = malloc_get_state ();
#endif
#ifdef USE_MMAP_FOR_BUFFERS
mmap_set_vars (0);
#endif
unexec (SSDATA (filename), !NILP (symfile) ? SSDATA (symfile) : 0);
#ifdef USE_MMAP_FOR_BUFFERS
mmap_set_vars (1);
#endif
#ifdef DOUG_LEA_MALLOC
free (malloc_state_ptr);
#endif
......
......@@ -998,6 +998,11 @@ free_image (struct frame *f, struct image *img)
c->images[img->id] = NULL;
/* Windows NT redefines 'free', but in this file, we need to
avoid the redefinition. */
#ifdef WINDOWSNT
#undef free
#endif
/* Free resources, then free IMG. */
img->type->free (f, img);
xfree (img);
......@@ -6453,7 +6458,6 @@ jpeg_file_src (j_decompress_ptr cinfo, FILE *fp)
src->mgr.next_input_byte = NULL;
}
/* Load image IMG for use on frame F. Patterned after example.c
from the JPEG lib. */
......
......@@ -72,7 +72,7 @@ DEFINE_GDB_SYMBOL_END (GCTYPEBITS)
2. We know malloc returns a multiple of 8. */
#if (defined alignas \
&& (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \
|| defined DARWIN_OS || defined __sun))
|| defined DARWIN_OS || defined __sun || defined __MINGW32__))
# define NONPOINTER_BITS 0
#else
# define NONPOINTER_BITS GCTYPEBITS
......
......@@ -83,8 +83,6 @@ PCHAR bss_start_static = 0;
DWORD_PTR bss_size_static = 0;
DWORD_PTR extra_bss_size_static = 0;
PIMAGE_SECTION_HEADER heap_section;
/* MinGW64 doesn't add a leading underscore to external symbols,
whereas configure.ac sets up LD_SWITCH_SYSTEM_TEMACS to force the
entry point at __start, with two underscores. */
......@@ -475,8 +473,6 @@ get_section_info (file_data *p_infile)
bss_section_static = 0;
extra_bss_size_static = 0;
}
heap_section = rva_to_section (PTR_TO_RVA (get_heap_start ()), nt_header);
}
......@@ -518,9 +514,11 @@ copy_executable_and_dump_data (file_data *p_infile,
if (verbose) \
{ \
printf ("%s\n", (message)); \
printf ("\t0x%08x Address in process.\n", s); \
printf ("\t0x%08x Offset in output file.\n", dst - p_outfile->file_base); \
printf ("\t0x%08x Size in bytes.\n", count); \
printf ("\t0x%p Address in process.\n", s); \
printf ("\t0x%p Base output file.\n", p_outfile->file_base); \
printf ("\t0x%p Offset in output file.\n", dst - p_outfile->file_base); \
printf ("\t0x%p Address in output file.\n", dst); \
printf ("\t0x%p Size in bytes.\n", count); \
} \
memcpy (dst, s, count); \
dst += count; \
......@@ -629,34 +627,6 @@ copy_executable_and_dump_data (file_data *p_infile,
dst_section->Characteristics &= ~IMAGE_SCN_CNT_UNINITIALIZED_DATA;
dst_section->Characteristics |= IMAGE_SCN_CNT_INITIALIZED_DATA;
}
if (section == heap_section)
{
DWORD_PTR heap_start = (DWORD_PTR) get_heap_start ();
DWORD_PTR heap_size = get_committed_heap_size ();
/* Dump the used portion of the predump heap, adjusting the
section's size to the appropriate size. */
dst = dst_save
+ RVA_TO_SECTION_OFFSET (PTR_TO_RVA (heap_start), dst_section);
COPY_PROC_CHUNK ("Dumping heap...", heap_start, heap_size,
be_verbose);
ROUND_UP_DST (dst_nt_header->OptionalHeader.FileAlignment);
dst_section->PointerToRawData = PTR_TO_OFFSET (dst_save, p_outfile);
/* Determine new size of raw data area. */
dst = max (dst, dst_save + dst_section->SizeOfRawData);
dst_section->SizeOfRawData = dst - dst_save;
/* Reduce the size of the heap section to fit (must be last
section). */
dst_nt_header->OptionalHeader.SizeOfImage -=
dst_section->Misc.VirtualSize
- ROUND_UP (dst_section->SizeOfRawData,
dst_nt_header->OptionalHeader.SectionAlignment);
dst_section->Misc.VirtualSize =
ROUND_UP (dst_section->SizeOfRawData,
dst_nt_header->OptionalHeader.SectionAlignment);
dst_section->Characteristics &= ~IMAGE_SCN_CNT_UNINITIALIZED_DATA;
dst_section->Characteristics |= IMAGE_SCN_CNT_INITIALIZED_DATA;
}
/* Align the section's raw data area. */
ROUND_UP_DST (dst_nt_header->OptionalHeader.FileAlignment);
......@@ -767,9 +737,6 @@ unexec (const char *new_name, const char *old_name)
printf ("Dumping from %s\n", in_filename);
printf (" to %s\n", out_filename);
/* We need to round off our heap to NT's page size. */
round_heap (get_page_size ());
/* Open the undumped executable file. */
if (!open_input_file (&in_file, in_filename))
{
......@@ -784,7 +751,6 @@ unexec (const char *new_name, const char *old_name)
/* The size of the dumped executable is the size of the original
executable plus the size of the heap and the size of the .bss section. */
size = in_file.size +
get_committed_heap_size () +
extra_bss_size +
extra_bss_size_static;
if (!open_output_file (&out_file, out_filename, size))
......@@ -799,6 +765,10 @@ unexec (const char *new_name, const char *old_name)
copy_executable_and_dump_data (&in_file, &out_file);
/* Unset it because it is plain wrong to keep it after dumping.
Malloc can still occur! */
using_dynamic_heap = FALSE;
/* Patch up header fields; profiler is picky about this. */
{
PIMAGE_DOS_HEADER dos_header;
......
This diff is collapsed.
......@@ -27,15 +27,20 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
/*
* Heap related stuff.
*/
#define get_reserved_heap_size() reserved_heap_size
#define get_committed_heap_size() (get_data_end () - get_data_start ())
#define get_heap_start() get_data_start ()
#define get_heap_end() get_data_end ()
#define DUMPED_HEAP_SIZE (HEAPSIZE*1024*1024)
extern unsigned char dumped_data[];
extern unsigned char *get_data_start (void);
extern unsigned char *get_data_end (void);
extern size_t reserved_heap_size;
extern BOOL using_dynamic_heap;
extern BOOL using_dynamic_heap;
extern void *mmap_realloc (void **, size_t);
extern void mmap_free (void **);
extern void *mmap_alloc (void **, size_t);
/* Emulation of Unix sbrk(). */
extern void *sbrk (ptrdiff_t size);
......@@ -43,11 +48,8 @@ extern void *sbrk (ptrdiff_t size);
/* Initialize heap structures for sbrk on startup. */
extern void init_heap (void);
/* Round the heap to this size. */
extern void round_heap (size_t size);
/* ----------------------------------------------------------------- */
/* Useful routines for manipulating memory-mapped files. */
/* Useful routines for manipulating memory-mapped files. */
typedef struct file_data {
char *name;
......@@ -61,11 +63,11 @@ int open_input_file (file_data *p_file, char *name);
int open_output_file (file_data *p_file, char *name, unsigned long size);
void close_file_data (file_data *p_file);
/* Return pointer to section header for named section. */
/* Return pointer to section header for named section. */
IMAGE_SECTION_HEADER * find_section (char * name, IMAGE_NT_HEADERS * nt_header);
/* Return pointer to section header for section containing the given
relative virtual address. */
relative virtual address. */
IMAGE_SECTION_HEADER * rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header);
#endif /* NTHEAP_H_ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment