Hangar.La tienda de software del Amiga

ConsoleFix 1.01.1

Fix a bug in the console.device

Short:        Fix a bug in the console.device
Author:       thor@math.tu-berlin.de (Thomas Richter)
Uploader:     thor math tu-berlin de (Thomas Richter)
Type:         util/boot
Version:      1.01.1
Requires:     Os 3.0 (V39) or better
Architecture: m68k-amigaos

_____________________________________________________________________________

Changes made in release 1.01.1:

- Included the updated assembly source of the 1.01 release. Ooops.

_____________________________________________________________________________

Changes made in release 1.01:

-ConsoleFix 1.00 failed from time to time if the console.device main task was, 
due to some unfortune, not waiting in its main loop. Added a workaround
that checks several times.

-Added a version tag.
_____________________________________________________________________________


Purpose of this program:

This little patch fixes possible crashes of the console.device task, which,
luckely, do not show up under "normal" circumstances. However, as soon as
the console.device supervisor task takes more stack than usual, or this
stack is filled by more than just zeros, the console device will crash on
window resizes.

The reason for this crash is that the console.device main task uses a
faulty algorithm to traverse an exec style list: The list header is
also processed as a "node". Due to some lucky coincidences, the only data
that gets querried by this faulty node is on the stack of the console device,
and again due to some coincidence, this points to an area of the stack which
is usually set to zero. All provided the stack of the console.device doesn't 
grow too much.

For the experts: 

	The main loop of the console device looks like this:

	lea WindowList(a6),a2		;get the head of the window list
.loop:
	bsr ProcessWindow		;re-calcutes the window on a resize

	move.l (a2),a2			;get next node
	tst.l (a2)			;end of list?
	bne.s .loop

Hence, the list header is processed as a first node. Urgh!


The correct method would have been:


	lea WindowList(a6),a2		;get the head of the window list
	bra.s .into
.loop:
	bsr ProcessWindow		;re-calcutes the window on a resize
.into:
	move.l (a2),a2			;get next node
	tst.l (a2)			;end of list?
	bne.s .loop


This program fixes this bug by "hacking in" a new main loop for the console
device, the source code is included.

I'm sorry for the uglyness of this patch, it was designed at 2 a.m. in the
night and I was all than awake. It currently works like it is, but I'd really
prefer if someone could write a "nicer" fix, or if AI would include this fix
in the "SetPatch" program.

_____________________________________________________________________________

Credits:

Thanks goes to Nils Goers and his StackSnoop program. This console.device
problem showed up while Nils was beta-testing his program, and I was
curious what could have caused the crash. Stack-Snoop fills the application
stack with a "magic cookie" to find out the true stack size a program re-
quires, and this magic cookie caused the buggy code above to get mad.
Always interested in the true reason for a crash, I found the above bug...

_____________________________________________________________________________

Copyright:

	None, this is freeware, public domain. Do whatever you want to do
	with it.

_____________________________________________________________________________


Thomas,
	October 1999

Gratis

Descargar 4 KB

Desde el Amiga: abre Hangar y busca ConsoleFix.

Autorthor@math.tu-berlin.de (Thomas Richter)
Categoríautil/boot
Tamaño4 KB
Param68k-amigaos
NecesitaOs 3.0 (V39) or better
OrigenAminet