🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #33793

The BREAK program in comp.sources.atari.st

#33793
From: Allan Pratt
Date: Fri, 26 Aug 1988 18:43
28 lines
1824 bytes
The author of "break" (L.J.M. de Wit) has committed one of the cardinal sins
of TOS programming: he has used the location of an OS private variable
in his utility code.  He uses the address of GEMDOS's current-process
variable.  He uses this to follow the parent's-basepage list up, to see
if he is about to terminate the Desktop.

Moreover, he doesn't check to see whether he is a second-level interrupt.
If the IKBD interrupted some other interrupt (possible but unlikely),
this program will crash hard.

Something that fixes both of these problems is to check the stacked SR
from the interrupt.  If the processor was in User mode, you know (A)
it isn't the desktop, and (B) you aren't a second-level interrupt,
therefore (C) it's safe to call Pterm when you return.

If it's NOT safe, the ctl-delete should be removed from the queue.
That way, it's like it never happened.  This means it might take
several Ctl-Deletes to stop a process, but the ones that don't
stop it also won't do any harm.

I suggest the author take his code apart and look into these changes.. 
The worst part is the absolute-variable-location problem -- this makes
his code ROM-version dependent, and he doesn't even bother to check the
version number!

============================================
Opinions expressed above do not necessarily	-- Allan Pratt, Atari Corp.
reflect those of Atari Corp. or anyone else.	  ...ames!atari!apratt
Technical Details
Message-ID: <1134@atari.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!uwmcsd1!marque!uunet!portal!atari!apratt

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!uwmcsd1!marque!uunet!portal!atari!apratt
From: apratt@atari.UUCP (Allan Pratt)
Newsgroups: comp.sys.atari.st
Subject: The BREAK program in comp.sources.atari.st
Keywords: bad news
Message-ID: <1134@atari.UUCP>
Date: 26 Aug 88 18:43:07 GMT
Organization: Atari Corp., Sunnyvale CA
Lines: 28