+ added the TP7-compatible pointer variables HeapOrg and HeapEnd, indicating,

respectively, the start and end of the tiny heap. Eventually they are also
  going to be used for catching attempts to free memory that is outside the
  heap.

git-svn-id: trunk@28437 -
This commit is contained in:
nickysn 2014-08-17 22:42:44 +00:00
parent e6017bceed
commit 9979aa702f
4 changed files with 25 additions and 0 deletions

1
.gitattributes vendored
View File

@ -8287,6 +8287,7 @@ rtl/inc/thread.inc svneol=native#text/plain
rtl/inc/threadh.inc svneol=native#text/plain
rtl/inc/threadvr.inc svneol=native#text/plain
rtl/inc/tinyheap.inc svneol=native#text/plain
rtl/inc/tnyheaph.inc svneol=native#text/plain
rtl/inc/typefile.inc svneol=native#text/plain
rtl/inc/ufloat128.pp svneol=native#text/plain
rtl/inc/ustringh.inc svneol=native#text/plain

View File

@ -271,6 +271,10 @@
Inc(AAddress,alignment_inc);
Dec(ASize,alignment_inc);
Dec(ASize,ASize mod TinyHeapAllocGranularity);
if (HeapOrg=nil) or (TTinyHeapPointerArithmeticType(HeapOrg) > TTinyHeapPointerArithmeticType(AAddress)) then
HeapOrg:=AAddress;
if (HeapEnd=nil) or (TTinyHeapPointerArithmeticType(HeapEnd) < (TTinyHeapPointerArithmeticType(AAddress)+ASize)) then
HeapEnd:=Pointer(TTinyHeapPointerArithmeticType(AAddress)+ASize);
InternalTinyFreeMem(AAddress, ASize);
end;

19
rtl/inc/tnyheaph.inc Normal file
View File

@ -0,0 +1,19 @@
{
This file is part of the Free Pascal run time library.
Copyright (c) 2014 by the Free Pascal development team.
Tiny heap manager for the i8086 near heap, embedded targets, etc.
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
var
{ these vars are TP7-compatible }
HeapOrg: Pointer = nil; { start of heap }
HeapEnd: Pointer = nil; { end of heap }

View File

@ -14,6 +14,7 @@ interface
$mode switch is not effective }
{$I systemh.inc}
{$I tnyheaph.inc}
const
LineEnding = #13#10;