Mercurial > projects > ldc
annotate runtime/internal/memory.d @ 577:68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Thu, 04 Sep 2008 18:57:03 +0200 |
parents | 5d6ef6e6805d |
children | 8caa9adce5ae |
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 } |
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
|
63 version(LLVMDC) |
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 */ |
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
|
76 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
|
77 { |
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
|
78 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
|
79 { |
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
|
80 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
|
81 { |
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
|
82 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
|
83 mov EAX,FS:4; |
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 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
|
85 } |
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 } |
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
|
87 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
|
88 { |
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 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
|
90 { |
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
|
91 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
|
92 } |
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
|
93 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
|
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 // 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
|
96 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
|
97 |
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 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
|
99 { |
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 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
|
101 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
|
102 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
|
103 } |
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 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
|
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 } |
558
02fb65cddc3e
Merge rest of patch from #72.
Christian Kamm <kamm incasoftware de>
parents:
443
diff
changeset
|
107 else version( darwin ) |
02fb65cddc3e
Merge rest of patch from #72.
Christian Kamm <kamm incasoftware de>
parents:
443
diff
changeset
|
108 { |
559
5d6ef6e6805d
Make rt_stackBottom return the right fixed value for darwin.
Christian Kamm <kamm incasoftware de>
parents:
558
diff
changeset
|
109 // 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
|
110 return cast(void*) 0xc0000000; |
558
02fb65cddc3e
Merge rest of patch from #72.
Christian Kamm <kamm incasoftware de>
parents:
443
diff
changeset
|
111 } |
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
|
112 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
|
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 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
|
115 } |
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
|
116 } |
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
|
117 |
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
|
118 |
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
|
119 /** |
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
|
120 * |
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
|
121 */ |
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
|
122 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
|
123 { |
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
|
124 version(LLVMDC) |
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
|
125 { |
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
|
126 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
|
127 } |
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
|
128 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
|
129 { |
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 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
|
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 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
|
133 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
|
134 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
|
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 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
|
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 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
|
140 } |
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 } |
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
|
142 |
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 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
|
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 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
|
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 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
|
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 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
|
151 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
|
152 |
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 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
|
154 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
|
155 } |
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 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
|
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 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
|
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 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
|
162 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
|
163 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
|
164 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
|
165 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
|
166 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
|
167 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
|
168 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
|
169 } |
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 _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 } |
577
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
174 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
175 version( GC_Use_Dynamic_Ranges ) |
558
02fb65cddc3e
Merge rest of patch from #72.
Christian Kamm <kamm incasoftware de>
parents:
443
diff
changeset
|
176 { |
577
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
177 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
|
178 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
179 struct DataSeg |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
180 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
181 void* beg; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
182 void* end; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
183 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
184 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
185 DataSeg* allSegs = null; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
186 size_t numSegs = 0; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
187 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
188 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
|
189 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
190 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
|
191 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
192 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
|
193 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
194 allSegs = cast(DataSeg*) ptr; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
195 allSegs[numSegs].beg = beg; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
196 allSegs[numSegs].end = end; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
197 numSegs++; |
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 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
200 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
201 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
|
202 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
203 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
|
204 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
205 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
|
206 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
207 while( ++pos < numSegs ) |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
208 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
209 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
|
210 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
211 numSegs--; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
212 return; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
213 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
214 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
215 } |
558
02fb65cddc3e
Merge rest of patch from #72.
Christian Kamm <kamm incasoftware de>
parents:
443
diff
changeset
|
216 } |
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
|
217 |
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
|
218 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
|
219 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
220 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
|
221 } |
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
|
222 |
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
|
223 |
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
|
224 /** |
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
|
225 * |
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
|
226 */ |
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
|
227 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
|
228 { |
577
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
229 scan( dataStart, dataEnd ); |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
230 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
231 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
|
232 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
233 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
|
234 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
235 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
|
236 } |
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 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
239 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
240 void initStaticDataPtrs() |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
241 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
242 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
|
243 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
244 // 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
|
245 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
|
246 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
247 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
|
248 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
249 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
250 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
|
251 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
252 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
|
253 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
254 |
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
|
255 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
|
256 { |
577
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
257 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
|
258 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
|
259 } |
577
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
260 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
|
261 { |
577
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
262 // 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
|
263 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
264 int fd = open("/proc/self/maps", O_RDONLY); |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
265 int count; // %% need to configure ret for read.. |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
266 char buf[2024]; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
267 char* p; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
268 char* e; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
269 char* s; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
270 void* start; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
271 void* end; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
272 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
273 p = buf.ptr; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
274 if (fd != -1) |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
275 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
276 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
|
277 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
278 e = p + count; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
279 p = buf.ptr; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
280 while (true) |
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 s = p; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
283 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
|
284 p++; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
285 if (p < e) |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
286 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
287 // 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
|
288 static if( S == 4 ) |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
289 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
290 enum Ofs |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
291 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
292 Write_Prot = 19, |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
293 Start_Addr = 0, |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
294 End_Addr = 9, |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
295 Addr_Len = 8, |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
296 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
297 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
298 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
|
299 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
300 enum Ofs |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
301 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
302 Write_Prot = 35, |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
303 Start_Addr = 0, |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
304 End_Addr = 9, |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
305 Addr_Len = 17, |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
306 } |
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 else |
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 static assert( false ); |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
311 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
312 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
313 // %% 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
|
314 // 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
|
315 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
316 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
|
317 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
318 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
|
319 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
|
320 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
|
321 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
|
322 |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
323 // 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
|
324 // 2. Exclude stack |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
325 if ( ( !dataEnd || |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
326 !( dataStart >= start && dataEnd <= end ) ) && |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
327 !( &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
|
328 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
329 // 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
|
330 // is heap (%% check) |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
331 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
|
332 _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
|
333 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
334 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
335 p++; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
336 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
337 else |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
338 { |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
339 count = p - s; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
340 memmove(buf.ptr, s, count); |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
341 p = buf.ptr + count; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
342 break; |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
343 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
344 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
345 } |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
346 close(fd); |
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
347 } |
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
|
348 } |
577
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
349 else version(linux) |
558
02fb65cddc3e
Merge rest of patch from #72.
Christian Kamm <kamm incasoftware de>
parents:
443
diff
changeset
|
350 { |
577
68be7408a0db
Merge Dynamic_Ranges and Data_Proc_Maps from GDC runtime.
Christian Kamm <kamm incasoftware de>
parents:
559
diff
changeset
|
351 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
|
352 dataEnd = adjust_down( &Data_End ); |
558
02fb65cddc3e
Merge rest of patch from #72.
Christian Kamm <kamm incasoftware de>
parents:
443
diff
changeset
|
353 } |
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
|
354 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
|
355 { |
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
|
356 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
|
357 } |
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
|
358 } |