braner@batcomputer.tn.cornell.edu (braner) (12/20/86)
[]
Since I posted several unfinished sources for KILLER, and never the final
version, and since the posted binary did not conform to my later suggested
"protocol for the installation of resident utilities", here is an update:
[uuencoded binary after the source...]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* KILLER - a resident utility for the ST
*
* by Moshe Braner, 861219
*
* Run this program once, early in a session.
* (Best: from the AUTO folder, but anyway NOT from a shell.)
*
* Later, holding down both Shift keys, the Control and the
* Alternate keys, and pressing another key (e.g. Return), causes
* the currently running application to terminate. This is useful
* in case the application hangs, or is otherwise out of control.
*
* WARNINGS:
*
* This program is put in the public domain for the convenience of
* developers who need its effect. Use at your own risk!
*
* Some addresses used here are NOT to be used in commercial programs.
* They refer to undocumented, and unstable, ROM contents.
*
* This is NOT a "well-behaved" TOS program. In fact, it probably
* will not work as-is with the next version of the TOS ROMs.
*
* Do NOT use in a multi-tasking situation (e.g. while a printer-
* spooler is printing) - one cannot predict which application
* will be killed!
CODE
* Install our own keyboard-interrupt vector:
pea install(PC) ; tell TOS what to execute
move.w #$26,-(a7) ; in supervisor mode
trap #14
addq.l #6,a7
clr.w -(a7)
move.l #$00000200,-(a7) ; terminate, but keep $200 bytes
move.w #$31,-(a7)
trap #1
install:
* Check if KILLER has been installed before, using our
* standard protocol for resident utilities:
move.l $118,d0 ; kbd interrupt vector
move.l d0,a0
cmp.l #$4B494C4C,-8(a0) ; if "KILL" is there
beq.S done ; then don't do it over
* Replace old vector with new:
lea killer(PC),a0
move.l d0,-4(a0) ; save old vector
move.l a0,$118 ; poke new
done:
rts
* Our protocol stuff:
dc.b "KILL" ; for ID
old:
dc.l $FC281C ; space for old vector
* A fatal piece of code:
killer:
* If interrupted program was in supervisor mode, skip:
btst #5,(a7) ; super bit in stacked status word
bne.S skip
* If not all the shift keys are down, skip:
cmp.b #$0F,$E1B ; where TOS keeps shift info
bne.S skip ; ("classified" and "illegal")
* Return from this interrupt to the bomb factory:
* (we jmp into the middle of the bomb handler - "illegal"!)
bset #5,(a7) ; keep super mode after RTE
move.l #$FC0A5A,2(a7) ; overwrite return address
skip:
move.l old(PC),-(a7) ; do usual handling of kbd intrpt
rts
END
~~~~~~~~~~~~~~~~ cut here ~~~~~~~~~~~~~~~~~~~
begin 644 KILLER.PRG
M8!H```!F``````````````````````````#__TAZ`!@_/``F3DY<CT)G+SP`a
M``(`/SP`,4Y!(#D```$8($`,J$M)3$S_^&<.0?H`%B%`__PCR````1A.=4M)a
M3$Q.<4YQ"!<`!686##D`#P``#AMF#`C7``4O?`#\"EH``B\Z_]Y.=0``````a
`
end
~~~~~~~~~~~~~~~~ and here ~~~~~~~~~~~~~~~~~~~~~~
- Moshe Braner