[comp.sys.mac.programmer] Patching traps in LSC

jmm@thoth9.berkeley.edu (03/15/88)

Does anyone have any sample code they can send me that does this?  I'm
having trouble figuring out how to tell SetTrapAddress where I want it
to go in my C code.

Also, I need to find out what the format for PTCH resources is, and exactly
what they do and when they are executed/loaded.
Is there a tech note on this subject that I've missed?

Last but not least, how does one get to the program counter inside LSC
assembly code?  The compiler chokes on both pc and PC.  I can't find
anything in the 2.01 supplement that talks about it.

Thanks,

/ James Moore		/    	|  jmm@bartleby.berkeley.edu
/ 			/	|--------------------------------------------|
/ Ma ta Gaeilge agut,	/	|   Nil aon speis ag Ollscoile na	     |
/ scriobh i!		/	|   California im bharulacha fein.           |

ephraim@think.COM (ephraim vishniac) (03/15/88)

In article <7679@agate.BERKELEY.EDU> jmm@thoth9.berkeley.edu () writes:
>Also, I need to find out what the format for PTCH resources is, and exactly
>what they do and when they are executed/loaded.
>Is there a tech note on this subject that I've missed?

PTCH resources contain patches that are installed early on in the
bootstrapping process.  So far as I know, they're just naked code.
The PTCH executed is selected according to the ROM version number of
the machine that's starting up.  This way new versions of the Apple
system software can contain different patches for different machines
with different ROMs.

I doubt that Apple will ever officially document the format of PTCH
resources.  They're not there for 3rd parties, just for Apple use in
patching the system.  Outside developers are expected to use INITs,
which are much more flexible, easier to install, and generally
approved of.

Why exactly do you *need* this information?  I'm curious.

>Thanks,

You're welcome.

>/ James Moore		/    	|  jmm@bartleby.berkeley.edu



Ephraim Vishniac					  ephraim@think.com
Thinking Machines Corporation / 245 First Street / Cambridge, MA 02142-1214

     On two occasions I have been asked, "Pray, Mr. Babbage, if you put
     into the machine wrong figures, will the right answers come out?"

jmm@thoth9.berkeley.edu (03/16/88)

The reason I wanted to know about the PTCH resources is that I'm fiddling
around with intercepting all attempts to write new resources into the
System file.  It seems as if the viruses currently being discussed install
some sort of resource where it doesn't belong, and I thought that some
sort of watchdog for resources could be installed using patches.
Any comments, anyone?  Does this seem to be a reasonable thing to do?
And where I can get an infected system to experiement with?
/ James Moore		/    	|  jmm@bartleby.berkeley.edu
/ 			/	|--------------------------------------------|
/ Ma ta Gaeilge agut,	/	|   Nil aon speis ag Ollscoile na	     |
/ scriobh i!		/	|   California im bharulacha fein.           |