Subject: Way Off Topic: Patching Running Code
To: None <port-macppc@netbsd.org>
From: Henry B. Hotz <hotz@jpl.nasa.gov>
List: port-macppc
Date: 06/08/2001 13:39:31
I have a need to replace/upgrade a subroutine in a running image.

On this OS (VxWorks) the loader is active and I can link the new 
routine in under a new name to resolve its references.  Then I 
believe I should be able to locate the first instruction in the old 
routine and replace it with a jump (longjump?) to the beginning of 
the new routine.

I don't know PPC assembly so can anyone comment on the feasibility of 
this approach?  Pitfalls like jump instruction range?  Side effects 
of different stack frame size?  Atomicity of writing the jump?  I 
assume the new routine is constrained to have the same arguments, and 
it's likely to be very similar, but slightly larger than the original.

For those who want to know the application: it is some possible 
after-end-of-mission communications technology demonstrations to be 
done on the DS1 spacecraft.  A reboot would likely use up all 
remaining hydrazine and kill the spacecraft at this time.  It uses a 
RAD6000 CPU which is a 40 MHz single-CPU implementation of the IBM 
RS6000 architecture and therefore very similar to a PPC 601.  128MB 
of RAM, most of which is taken by various memory file systems.  ROM 
image of the operating code is about 4MB.

Sorry I haven't been able to track this list for the last few months. 
Wish you-all well.  Thanks for any help.

Signature held pending an ISO 9000 compliant
signature design and approval process.
h.b.hotz@jpl.nasa.gov, or hbhotz@oxy.edu