Browse Source

Try to implement CheckPointer exclusion range for FreeBSD OS

git-svn-id: trunk@39394 -
pierre 7 years ago
parent
commit
18cc1f1709
1 changed files with 16 additions and 0 deletions
  1. 16 0
      rtl/inc/heaptrc.pp

+ 16 - 0
rtl/inc/heaptrc.pp

@@ -968,6 +968,13 @@ var
    eend : ptruint; external name '_end';
    eend : ptruint; external name '_end';
 {$endif}
 {$endif}
 
 
+{$ifdef freebsd}
+var
+   text_start: ptruint; external name '__executable_start';
+   etext: ptruint; external name '_etext';
+   eend : ptruint; external name '_end';
+{$endif}
+
 {$ifdef os2}
 {$ifdef os2}
 (* Currently still EMX based - possibly to be changed in the future. *)
 (* Currently still EMX based - possibly to be changed in the future. *)
 var
 var
@@ -1081,6 +1088,15 @@ begin
     exit;
     exit;
 {$endif linux}
 {$endif linux}
 
 
+{$ifdef freebsd}
+  { inside stack ? }
+  if (ptruint(p)>ptruint(get_frame)) and
+     (ptruint(p)<ptruint(StackTop)) then
+    exit;
+  { inside data or bss ? }
+  if (ptruint(p)>=ptruint(@text_start)) and (ptruint(p)<ptruint(@eend)) then
+    exit;
+{$endif linux}
 {$ifdef morphos}
 {$ifdef morphos}
   { inside stack ? }
   { inside stack ? }
   if (ptruint(p)<ptruint(StackTop)) and (ptruint(p)>ptruint(StackBottom)) then
   if (ptruint(p)<ptruint(StackTop)) and (ptruint(p)>ptruint(StackBottom)) then