(init_alloc_once): Call init_weak_hash_tables.
[bpt/emacs.git] / src / w32heap.h
CommitLineData
95ed0025 1/* Heap management routines (including unexec) for GNU Emacs on Windows NT.
429ab54e 2 Copyright (C) 1994, 2001, 2002, 2003, 2004, 2005,
8cabe764 3 2006, 2007, 2008 Free Software Foundation, Inc.
95ed0025 4
3b7ad313
EN
5This file is part of GNU Emacs.
6
7GNU Emacs is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
684d6f5b 9the Free Software Foundation; either version 3, or (at your option)
3b7ad313
EN
10any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs; see the file COPYING. If not, write to
4fc5845f
LK
19the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA.
95ed0025
RS
21
22 Geoff Voelker (voelker@cs.washington.edu) 7-29-94
23*/
24
25#ifndef NTHEAP_H_
26#define NTHEAP_H_
27
28#include <windows.h>
29
a5352d98
AI
30#define ROUND_UP(p, align) (((DWORD)(p) + (align)-1) & ~((align)-1))
31#define ROUND_DOWN(p, align) ((DWORD)(p) & ~((align)-1))
32
95ed0025
RS
33/*
34 * Heap related stuff.
35 */
f803a6b1 36#define get_reserved_heap_size() reserved_heap_size
95ed0025
RS
37#define get_committed_heap_size() (get_data_end () - get_data_start ())
38#define get_heap_start() get_data_start ()
39#define get_heap_end() get_data_end ()
40#define get_page_size() sysinfo_cache.dwPageSize
41#define get_allocation_unit() sysinfo_cache.dwAllocationGranularity
42#define get_processor_type() sysinfo_cache.dwProcessorType
fbd6baed
GV
43#define get_w32_major_version() w32_major_version
44#define get_w32_minor_version() w32_minor_version
95ed0025
RS
45
46extern unsigned char *get_data_start();
47extern unsigned char *get_data_end();
f803a6b1 48extern unsigned long reserved_heap_size;
95ed0025 49extern SYSTEM_INFO sysinfo_cache;
354350d5 50extern OSVERSIONINFO osinfo_cache;
a5352d98 51extern BOOL using_dynamic_heap;
fbd6baed
GV
52extern int w32_major_version;
53extern int w32_minor_version;
0ae88b4d 54extern int w32_build_number;
95ed0025 55
3443b04a
GV
56enum {
57 OS_WIN95 = 1,
58 OS_NT
59};
60
61extern int os_subtype;
62
95ed0025
RS
63/* Emulation of Unix sbrk(). */
64extern void *sbrk (unsigned long size);
65
a5352d98
AI
66/* Initialize heap structures for sbrk on startup. */
67extern void init_heap ();
95ed0025
RS
68
69/* Round the heap to this size. */
70extern void round_heap (unsigned long size);
71
95ed0025
RS
72/* Cache system info, e.g., the NT page size. */
73extern void cache_system_info (void);
74
3443b04a
GV
75/* ----------------------------------------------------------------- */
76/* Useful routines for manipulating memory-mapped files. */
77
78typedef struct file_data {
79 char *name;
80 unsigned long size;
81 HANDLE file;
82 HANDLE file_mapping;
83 unsigned char *file_base;
84} file_data;
85
3443b04a
GV
86int open_input_file (file_data *p_file, char *name);
87int open_output_file (file_data *p_file, char *name, unsigned long size);
88void close_file_data (file_data *p_file);
89
3443b04a
GV
90/* Return pointer to section header for named section. */
91IMAGE_SECTION_HEADER * find_section (char * name, IMAGE_NT_HEADERS * nt_header);
92
93/* Return pointer to section header for section containing the given
94 relative virtual address. */
95IMAGE_SECTION_HEADER * rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header);
96
95ed0025 97#endif /* NTHEAP_H_ */
ab5796a9
MB
98
99/* arch-tag: 3ba4cbe1-8a09-4a41-8f37-fd31f7426b3c
100 (do not change this comment) */