annotate runtime/internal/memory.d @ 872:aa953cc960b6

Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
author Christian Kamm <kamm incasoftware de>
date Sun, 04 Jan 2009 15:49:28 +0100
parents 661384d6a936
children 77a3d6945f81
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
1 /**
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
2 * This module exposes functionality for inspecting and manipulating memory.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
3 *
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
4 * Copyright: Copyright (C) 2005-2006 Digital Mars, www.digitalmars.com.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
5 * All rights reserved.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
6 * License:
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
7 * This software is provided 'as-is', without any express or implied
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
8 * warranty. In no event will the authors be held liable for any damages
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
9 * arising from the use of this software.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
10 *
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
11 * Permission is granted to anyone to use this software for any purpose,
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
12 * including commercial applications, and to alter it and redistribute it
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
13 * freely, in both source and binary form, subject to the following
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
14 * restrictions:
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
15 *
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
16 * o The origin of this software must not be misrepresented; you must not
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
17 * claim that you wrote the original software. If you use this software
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
18 * in a product, an acknowledgment in the product documentation would be
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
19 * appreciated but is not required.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
20 * o Altered source versions must be plainly marked as such, and must not
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
21 * be misrepresented as being the original software.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
22 * o This notice may not be removed or altered from any source
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
23 * distribution.
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
24 * Authors: Walter Bright, Sean Kelly
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
25 */
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
26 module memory;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
27
577
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
28 version = GC_Use_Dynamic_Ranges;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
29
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
30 // does Posix suffice?
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
31 version(Posix)
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
32 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
33 version = GC_Use_Data_Proc_Maps;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
34 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
35
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
36 version(GC_Use_Data_Proc_Maps)
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
37 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
38 version(Posix) {} else {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
39 static assert(false, "Proc Maps only supported on Posix systems");
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
40 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
41 private import tango.stdc.posix.unistd;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
42 private import tango.stdc.posix.fcntl;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
43 private import tango.stdc.string;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
44
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
45 version = GC_Use_Dynamic_Ranges;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
46 }
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
47
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
48 private
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
49 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
50 version( linux )
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
51 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
52 //version = SimpleLibcStackEnd;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
53
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
54 version( SimpleLibcStackEnd )
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
55 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
56 extern (C) extern void* __libc_stack_end;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
57 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
58 else
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
59 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
60 import tango.stdc.posix.dlfcn;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
61 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
62 }
664
eef8ac26c66c Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents: 578
diff changeset
63 version(LDC)
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
64 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
65 pragma(intrinsic, "llvm.frameaddress")
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
66 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
67 void* llvm_frameaddress(uint level=0);
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
68 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
69 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
70 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
71
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
72
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
73 /**
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
74 *
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
75 */
872
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
76
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
77 version( solaris ) {
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
78 version(X86_64) {
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
79 extern (C) void* _userlimit;
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
80 }
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
81 }
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
82
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
83 extern (C) void* rt_stackBottom()
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
84 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
85 version( Win32 )
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
86 {
578
8caa9adce5ae Fix (?) rt_stackBottom for Windows.
Christian Kamm <kamm incasoftware de>
parents: 577
diff changeset
87 void* bottom;
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
88 asm
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
89 {
578
8caa9adce5ae Fix (?) rt_stackBottom for Windows.
Christian Kamm <kamm incasoftware de>
parents: 577
diff changeset
90 mov EAX, FS:4;
8caa9adce5ae Fix (?) rt_stackBottom for Windows.
Christian Kamm <kamm incasoftware de>
parents: 577
diff changeset
91 mov bottom, EAX;
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
92 }
578
8caa9adce5ae Fix (?) rt_stackBottom for Windows.
Christian Kamm <kamm incasoftware de>
parents: 577
diff changeset
93 return bottom;
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
94 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
95 else version( linux )
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
96 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
97 version( SimpleLibcStackEnd )
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
98 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
99 return __libc_stack_end;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
100 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
101 else
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
102 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
103 // See discussion: http://autopackage.org/forums/viewtopic.php?t=22
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
104 static void** libc_stack_end;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
105
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
106 if( libc_stack_end == libc_stack_end.init )
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
107 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
108 void* handle = dlopen( null, RTLD_NOW );
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
109 libc_stack_end = cast(void**) dlsym( handle, "__libc_stack_end" );
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
110 dlclose( handle );
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
111 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
112 return *libc_stack_end;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
113 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
114 }
558
02fb65cddc3e Merge rest of patch from #72.
Christian Kamm <kamm incasoftware de>
parents: 443
diff changeset
115 else version( darwin )
02fb65cddc3e Merge rest of patch from #72.
Christian Kamm <kamm incasoftware de>
parents: 443
diff changeset
116 {
559
5d6ef6e6805d Make rt_stackBottom return the right fixed value for darwin.
Christian Kamm <kamm incasoftware de>
parents: 558
diff changeset
117 // darwin has a fixed stack bottom
5d6ef6e6805d Make rt_stackBottom return the right fixed value for darwin.
Christian Kamm <kamm incasoftware de>
parents: 558
diff changeset
118 return cast(void*) 0xc0000000;
558
02fb65cddc3e Merge rest of patch from #72.
Christian Kamm <kamm incasoftware de>
parents: 443
diff changeset
119 }
872
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
120 else version( solaris )
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
121 {
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
122 version(X86_64) {
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
123 return _userlimit;
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
124 }
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
125 else {
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
126 // <sys/vmparam.h>
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
127 return cast(void*) 0x8048000;
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
128 }
aa953cc960b6 Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents: 794
diff changeset
129 }
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
130 else
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
131 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
132 static assert( false, "Operating system not supported." );
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
133 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
134 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
135
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
136
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
137 /**
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
138 *
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
139 */
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
140 extern (C) void* rt_stackTop()
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
141 {
664
eef8ac26c66c Some missed LLVMDC -> LDC.
Christian Kamm <kamm incasoftware de>
parents: 578
diff changeset
142 version(LDC)
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
143 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
144 return llvm_frameaddress();
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
145 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
146 else version( D_InlineAsm_X86 )
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
147 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
148 asm
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
149 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
150 naked;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
151 mov EAX, ESP;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
152 ret;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
153 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
154 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
155 else
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
156 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
157 static assert( false, "Architecture not supported." );
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
158 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
159 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
160
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
161
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
162 private
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
163 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
164 version( Win32 )
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
165 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
166 extern (C)
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
167 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
168 extern int _data_start__;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
169 extern int _bss_end__;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
170
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
171 alias _data_start__ Data_Start;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
172 alias _bss_end__ Data_End;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
173 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
174 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
175 else version( linux )
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
176 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
177 extern (C)
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
178 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
179 extern int _data;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
180 extern int __data_start;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
181 extern int _end;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
182 extern int _data_start__;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
183 extern int _data_end__;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
184 extern int _bss_start__;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
185 extern int _bss_end__;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
186 extern int __fini_array_end;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
187 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
188
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
189 alias __data_start Data_Start;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
190 alias _end Data_End;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
191 }
577
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
192
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
193 version( GC_Use_Dynamic_Ranges )
558
02fb65cddc3e Merge rest of patch from #72.
Christian Kamm <kamm incasoftware de>
parents: 443
diff changeset
194 {
577
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
195 private import tango.stdc.stdlib;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
196
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
197 struct DataSeg
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
198 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
199 void* beg;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
200 void* end;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
201 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
202
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
203 DataSeg* allSegs = null;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
204 size_t numSegs = 0;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
205
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
206 extern (C) void _d_gc_add_range( void* beg, void* end )
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
207 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
208 void* ptr = realloc( allSegs, (numSegs + 1) * DataSeg.sizeof );
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
209
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
210 if( ptr ) // if realloc fails, we have problems
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
211 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
212 allSegs = cast(DataSeg*) ptr;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
213 allSegs[numSegs].beg = beg;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
214 allSegs[numSegs].end = end;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
215 numSegs++;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
216 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
217 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
218
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
219 extern (C) void _d_gc_remove_range( void* beg )
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
220 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
221 for( size_t pos = 0; pos < numSegs; ++pos )
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
222 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
223 if( beg == allSegs[pos].beg )
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
224 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
225 while( ++pos < numSegs )
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
226 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
227 allSegs[pos-1] = allSegs[pos];
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
228 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
229 numSegs--;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
230 return;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
231 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
232 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
233 }
558
02fb65cddc3e Merge rest of patch from #72.
Christian Kamm <kamm incasoftware de>
parents: 443
diff changeset
234 }
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
235
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
236 alias void delegate( void*, void* ) scanFn;
577
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
237
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
238 void* dataStart, dataEnd;
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
239 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
240
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
241
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
242 /**
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
243 *
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
244 */
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
245 extern (C) void rt_scanStaticData( scanFn scan )
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
246 {
577
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
247 scan( dataStart, dataEnd );
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
248
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
249 version( GC_Use_Dynamic_Ranges )
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
250 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
251 for( size_t pos = 0; pos < numSegs; ++pos )
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
252 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
253 scan( allSegs[pos].beg, allSegs[pos].end );
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
254 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
255 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
256 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
257
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
258 void initStaticDataPtrs()
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
259 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
260 const int S = (void*).sizeof;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
261
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
262 // Can't assume the input addresses are word-aligned
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
263 static void* adjust_up( void* p )
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
264 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
265 return p + ((S - (cast(size_t)p & (S-1))) & (S-1)); // cast ok even if 64-bit
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
266 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
267
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
268 static void * adjust_down( void* p )
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
269 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
270 return p - (cast(size_t) p & (S-1));
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
271 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
272
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
273 version( Win32 )
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
274 {
577
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
275 dataStart = adjust_up( &Data_Start );
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
276 dataEnd = adjust_down( &Data_End );
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
277 }
577
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
278 else version( GC_Use_Data_Proc_Maps )
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
279 {
577
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
280 // TODO: Exclude zero-mapped regions
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
281
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
282 int fd = open("/proc/self/maps", O_RDONLY);
794
661384d6a936 Fix warnings on x86-64. By fvbommel.
Christian Kamm <kamm incasoftware de>
parents: 664
diff changeset
283 ptrdiff_t count; // %% need to configure ret for read..
577
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
284 char buf[2024];
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
285 char* p;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
286 char* e;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
287 char* s;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
288 void* start;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
289 void* end;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
290
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
291 p = buf.ptr;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
292 if (fd != -1)
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
293 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
294 while ( (count = read(fd, p, buf.sizeof - (p - buf.ptr))) > 0 )
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
295 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
296 e = p + count;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
297 p = buf.ptr;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
298 while (true)
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
299 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
300 s = p;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
301 while (p < e && *p != '\n')
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
302 p++;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
303 if (p < e)
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
304 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
305 // parse the entry in [s, p)
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
306 static if( S == 4 )
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
307 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
308 enum Ofs
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
309 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
310 Write_Prot = 19,
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
311 Start_Addr = 0,
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
312 End_Addr = 9,
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
313 Addr_Len = 8,
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
314 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
315 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
316 else static if( S == 8 )
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
317 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
318 enum Ofs
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
319 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
320 Write_Prot = 35,
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
321 Start_Addr = 0,
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
322 End_Addr = 9,
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
323 Addr_Len = 17,
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
324 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
325 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
326 else
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
327 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
328 static assert( false );
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
329 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
330
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
331 // %% this is wrong for 64-bit:
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
332 // uint strtoul(char *,char **,int);
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
333
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
334 if( s[Ofs.Write_Prot] == 'w' )
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
335 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
336 s[Ofs.Start_Addr + Ofs.Addr_Len] = '\0';
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
337 s[Ofs.End_Addr + Ofs.Addr_Len] = '\0';
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
338 start = cast(void*) strtoul(s + Ofs.Start_Addr, null, 16);
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
339 end = cast(void*) strtoul(s + Ofs.End_Addr, null, 16);
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
340
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
341 // 1. Exclude anything overlapping [dataStart, dataEnd)
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
342 // 2. Exclude stack
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
343 if ( ( !dataEnd ||
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
344 !( dataStart >= start && dataEnd <= end ) ) &&
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
345 !( &buf[0] >= start && &buf[0] < end ) )
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
346 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
347 // we already have static data from this region. anything else
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
348 // is heap (%% check)
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
349 debug (ProcMaps) printf("Adding map range %p 0%p\n", start, end);
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
350 _d_gc_add_range(start, end);
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
351 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
352 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
353 p++;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
354 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
355 else
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
356 {
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
357 count = p - s;
794
661384d6a936 Fix warnings on x86-64. By fvbommel.
Christian Kamm <kamm incasoftware de>
parents: 664
diff changeset
358 memmove(buf.ptr, s, cast(size_t)count);
577
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
359 p = buf.ptr + count;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
360 break;
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
361 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
362 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
363 }
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
364 close(fd);
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
365 }
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
366 }
577
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
367 else version(linux)
558
02fb65cddc3e Merge rest of patch from #72.
Christian Kamm <kamm incasoftware de>
parents: 443
diff changeset
368 {
577
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
369 dataStart = adjust_up( &Data_Start );
68be7408a0db Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents: 559
diff changeset
370 dataEnd = adjust_down( &Data_End );
558
02fb65cddc3e Merge rest of patch from #72.
Christian Kamm <kamm incasoftware de>
parents: 443
diff changeset
371 }
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
372 else
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
373 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
374 static assert( false, "Operating system not supported." );
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
375 }
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
diff changeset
376 }