AminetAminet
Search:
84439 packages online
About
Recent
Browse
Search
Upload
Setup
Services

util/boot/MemTrailer.lha

Mirror:Random
Showing:m68k-amigaosppc-amigaosppc-morphosi386-arosi386-amithlonppc-warpupppc-powerupgeneric
No screenshot available
Short:allocates 16-96 bytes for mem-protection
Author:Peter Keunecke
Uploader:pkeunecke alice-dsl net
Type:util/boot
Version:1.10
Architecture:m68k-amigaos >= 2.0.4
Date:2007-11-06
Download:http://aminet.net/util/boot/MemTrailer.lha - View contents
Readme:http://aminet.net/util/boot/MemTrailer.readme
Downloads:1731

 Latest changes:     (die deutsche Beschreibung folgt unten)
 ~~~~~~~~~~~~~~
Better support for TLSFMem: MemTrailer will no longer assume
AllocMem() would round up memory requests to chunk size = 8.
Further, no allocations with a trailer over 2 GByte anymore. 

 Description:
 ~~~~~~~~~~~
MemTrailer is a shell command for the startup-sequence which
patches the AllocMem() and the FreeMem() exec functions. It
adds 16 to 96 bytes as a trailer to prevent trashed memory.

Because some programs make illegal accesses past the end of
their own memory allocations or try to use FreeMem() with an
unaligned argument pointing a few bytes out of bounds, you
may sometimes get a delayed and unexpected Guru-Meditation.

With the debugging tools MungWall, WipeOut, MuTools together
with SegTracker you can check your system for this type of
troublemakers. But these programs are not for permanent use,
since they are complex and need quite an amount of CPU-time.

In order to use less CPU-time, I've made MemTrailer as simple
as possible with the intention to fix only the most commonly
occurrences when illegal memory access could happen. Unlike
the debugging tools, MemTrailer never displays any messages.

MemTrailer patches AllocMem() to get additional 16-96 bytes
for each allocation and sets up a signature pointing to the
top of the memblock. These bytes are sacrificed to protect
other programs from memory corruption and the system getting
Guru-Meditations. Usually FreeMem() cleans up all as normal.

Whenever FreeMem() cannot find a valid signature in the last
6 bytes, all the additional bytes are left behind in memory.
But this only happens in very rare cases and then you should
select a longer trailer. Normally, there's no fragmentation!
Ok, this is not a real memory protection, but it helps a bit.
Since WarpOS has its own memory management, its applications
are not affected directly by MemTrailer.

 Installation and usage:
 ~~~~~~~~~~~~~~~~~~~~~~
Copy the command MemTrailer into C: or whereever you like it.
Make some tests first by starting MemTrailer from the Shell.
You may choose the trailer size out of a range from 16 to 96.
With a size of 0 the AllocMem() patch can be disabled again.
Please, remove all other AllocMem() and FreeMem() patches or
at least make sure MemTrailer is installed as the last one.
 
Add a line to your S:startup-sequence close to the bottom or
place it after LoadWB and just call "MemTrailer" without Run.
With no option you'll get a default trailer size of 16 bytes.

Usually, this size is sufficient, but if you need a larger
trailer to catch very far memory trashings, you may choose a
size of up to 96 by giving the number of bytes as an option.
If you get any problems, try to solve them with MemTrailer 96.
On WarpOS you need a 32-byte alignment: select 32, 64 or 96.

 S:startup-sequence
 ~~~~~~~~~~~~~~~~~~
 ...
 LoadWB
 ...
 MemTrailer 64      ; for example, size 16-96, in steps of 8
 ...
 EndCLI

Once MemTrailer is installed, you can remove the AllocMem()
patch by calling "MemTrailer 0". When you activate it later
again, then the size will be ignored. You'll get the old size.
Please, never try to disable the FreeMem() patch. It's needed.

Two other tools I'd like to suggest are TRSaferPtch.lha and
AmberRAM as a Ram-Disk replacement using faster memory pools. 

It would be nice, if you could give me some feedback whether
MemTrailer is working on your system and on which hardware
and software it runs or not, because the only system where
I'm developing and testing my programs is WinUAE and OS 3.9.

 Distribution:
 ~~~~~~~~~~~~
This program and its sourcecode are freeware. I don't give any
warranties. You're using this program on your own risk and you
are responsible for any damage it could cause to your system!

 Copyright 2003-2007:
 ~~~~~~~~~~~~~~~~~~~
   Peter Keunecke


###############################################################

                         MemTrailer 1.10
 Letzte Änderungen:
 ~~~~~~~~~~~~~~~~~
Bessere Unterstützung von TLSFMem: MemTrailer erwartet nicht
mehr, daß AllocMem() Speicherblöcke auf Chunk Size = 8 rundet.
Außerdem können Blöcke mit Trailer nicht größer als 2 GB sein.

 Beschreibung:
 ~~~~~~~~~~~~
MemTrailer ist ein Shell-Befehl für die startup-sequence, der
die exec-Funktionen AllocMem() und FreeMem() patcht. Es fügt
16 bis 96 Bytes als Anhang hinzu, um Speichermüll abzufangen.

Weil einige Programme illegale Zugriffe hinter das Ende ihrer
eigenen Speicherreservierung machen oder versuchen ein falsch
ausgerichtetes FreeMem() außerhalb der Blockgrenzen zu nutzen,
kann es manchmal verzögert und unerwartet zu Gurus kommen.

Mit den Prüfprogrammen MungWall, WipeOut und MuTools zusammen
mit SegTracker kann man sein System auf diese Art von Fehler-
quellen untersuchen. Aber diese Programme sind kaum für den
dauerhaften Einsatz geeignet, denn sie sind recht komplex und
benötigen ziemlich viel CPU-Zeit.

Um weniger Rechenleistung zu beanspruchen, habe ich MemTrailer
so einfach wie möglich gestaltet, mit dem Ziel, nur die aller-
häufigsten Situationen mit illegalen Speicherzugriffen zu be-
heben. Entgegen den anderen Debugging-Tools zeigt MemTrailer
jedoch niemals irgendwelche Fehlermeldungen an.

MemTrailer patcht AllocMem(), um zusätzliche 16 bis 96 Bytes
pro Speicherreservierung zu erhalten und fügt eine Signatur,
die auf den Blockanfang zeigt, hinzu. Diese zugefügten Bytes
werden geopfert, um andere Programme vor Datenbeschädigungen
und das System vor Guru-Meditationen zu schützen. Normaler-
weise räumt FreeMem() danach alles wieder auf, wie gewohnt.

Falls FreeMem() in de letzten 6 Bytes keine gültige Signatur
finden kann, verbleiben alle zusätzlichen Bytes im Speicher.
Dies passiert aber nur in sehr seltenen Fällen und man sollte
dann einen längeren Trailer wählen. Normalerweise gibt's keine
Fragmentierung. Ok, dies ist zwar kein echter Speicherschutz,
aber es hilft etwas. Da WarpOS seine eigene Speicherverwaltung
hat, sind darunter laufende Anwendungen nicht direkt betroffen.

 Installation und Benutzung:
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
Kopiere den Befehl MemTrailer nach C: oder wohin Du möchtest.
Starte MemTrailer zunächst testweise von der Shell aus. Man
kann die Trailergröße aus einem Bereich von 16 bis 96 wählen.
Mit der Größe 0 kann der AllocMem()-Patch deaktiviert werden.
Bitte entferne alle anderen AllocMem() und FreeMem() Patches
oder stelle zumindest sicher, daß MT zuletzt installiert wird.

Füge am Ende der startup-sequence oder unter LoadWB eine Zeile
hinzu und rufe MemTrailer einfach ohne Run auf. Ohne weitere
Optionen werden als vorgegebene Trailergröße 16 Bytes benutzt.

Gewöhnlich reicht diese Größe, sollte aber ein längerer Trailer
notwendig sein, um weit entfernte Speicherschäden zu vermeiden,
können bis zu 96 Bytes mit der Zahl als Option gewählt werden.
Falls irgendwelche Probleme auftreten, probiere MemTrailer 96.
WarpOS braucht eine 32-Byte Ausrichtung, wähle 32, 64 oder 96.

 S:startup-sequence
 ~~~~~~~~~~~~~~~~~~
 ...
 LoadWB
 ...
 MemTrailer 64     ; als Beispiel, Größe 16-96, gerundet mit 8
 ...
 EndCLI

Sofern MemTrailer installiert ist, kann der AllocMem() Patch
mit "MemTrailer 0" abgeschaltet werden. Bei späterer Reakti-
vierung wird die Größe ignoriert, man erhält die alte Größe.
Versuche nie den FreeMem() Patch abzuschalten. 'Ist notwendig.

Zwei weitere Tools, die ich vorschlagen möchte: TRSaferPatches
und AmberRAM, das als Ram-Disk Ersatz schnellere Pools benutzt.

Es wäre schön, einige Rückmeldungen zu bekommen, ob MemTrailer
auf anderen Systemen läuft und mit welcher Hard- und Software
es funktioniert oder nicht, denn ich schreibe und teste meine
Programme nur unter WinUAE mit AmigaOS 3.9 und meinem A2000 :)

 Rechtliches:
 ~~~~~~~~~~~~
Dieses Programm, inklusive Sourcecode, ist Freeware. Ich gebe
keine Garantien. Die Benutzung erfolgt auf eigenes Risiko und
die Benutzer sind für eventuelle Systemschäden selbst haftbar.

 Copyright 2003-2007:
 ~~~~~~~~~~~~~~~~~~~
   Peter Keunecke




Contents of util/boot/MemTrailer.lha
 PERMSSN    UID  GID    PACKED    SIZE  RATIO METHOD CRC     STAMP          NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[generic]                 1466    3451  42.5% -lh5- cf91 Nov  6 00:08 MemTrailer.info
[generic]                  403     456  88.4% -lh5- 1214 Nov  6 00:08 MemTrailer/MemTrailer
[generic]                 1352    8312  16.3% -lh5- b03d Nov  6 00:08 MemTrailer/MemTrailer.asm
[generic]                 5203    7973  65.3% -lh5- d669 Nov  6 00:08 MemTrailer/MemTrailer.asm.info
[generic]                 3717    8205  45.3% -lh5- f985 Nov  6 00:08 MemTrailer/MemTrailer.readme
[generic]                 5030    7973  63.1% -lh5- 00cf Nov  6 00:08 MemTrailer/MemTrailer.readme.info
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total         6 files   17171   36370  47.2%            Nov  6 09:06

Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>