programmer >> How does setpatch work?

by a1_nocrap_exh » Fri, 05 Aug 2005 01:26:14 GMT

Anyone here know how setpatch actually works?

I dont mean what are the command line options etc. But how does it
work?

Kickstart is in ROM, the Amiga hardware is designed to boot off
kickstart. I'm guessing it loads as usual, enough drivers to access the
hard disk and run the set-patch command.

I guess the Kickstart ROM code loads some function jump table into RAM.
Set-patch loads OS patches into RAM also and then modifies this jump
table.

What I am curious about is the structure of this table (if there is
one) and approximately how it works.

If someone can point me to some documents about it, or ROM patching in
general I would appreciate it.

Alex


programmer >> How does setpatch work?

by Ben Hutchings » Fri, 05 Aug 2005 20:27:31 GMT



That is pretty much correct.

<snip>

When a shared library is first opened, it generates a jump table in
RAM. Usually this is done from an array of function entry points. On
a 68000 system, each entry in the jump table takes up 6 bytes and
normally consists of a JMP absolute instruction. (There are
exceptions such as dos.library prior to v36 (r2.0) and exec.library's
GetCC function.)

Device drivers also have a jump table along the same lines, though
almost all device driver calls are done through just two functions.

Opening a library returns a "base pointer" for the library; starting
at this address is a standard library structure followed by any
library-specific variables and before it is the jump table. This
allows the two structures to grow in opposite directions as new
features are added to the library. Shared library calls are performed
using a JSR relative instruction with the base pointer loaded into A6
(usually; a few functions don't require this) and the appropriate jump
table offset (also called library vector offset or LVO for short).

Since the jump tables are in RAM, any entry in them can be replaced.
There is a function in exec.library called SetFunction which will do
this, assuming that the entry is initially a JMP instruction. However
this isn't suitable for use by a patch that wraps rather than
replacing the original function.

What I don't know is how SetPatch patches code that isn't called
(at least, not directly) through library functions. For example
SetPatch v38 (r2.1) internationalises Workbench v37 (r2.0).

--
Ben Hutchings
Man invented language to satisfy his deep need to complain. - Lily Tomlin

Similar Threads

1. How was this dithering done ?

2. Best Home Base Work

3. How Trolls Work Together....

On Sat, 01 Apr 2006 09:16:42 +0100, Noel wrote:

> On 31 Mar 2006 20:57:33 -0800, "amiga guy" < XXXX@XXXXX.COM > wrote:

>>On Mon, 27 Mar 2006 23:23:20 GMT, Gary Beeton wrote:

>>> Er, so let me get this straight.  You are saying that, since it is my 
>>> modus operandi to constantly challenge you to back up your 
>>> hallucinogen-induced specious nonsense with some actual proof, that 
>>> makes it okay for you to dodge said challenges??  Wow, I hadn't thought 
>>> it possible but TerryLogik (tm) just got palpably stupider.

>>No Gary, I was speaking about advocacy. 

> Like most other things in life, it is far easier to speak about it
> than to do it, which is why I am sure you prefer the former.

A little projection Noel? 

Backing up your troll mentor and master, the Beeton Troll?

How does it feel to be a "real" sock-puppet repeating the party
line and not being known as a separate individual from the 
other trolls like Clickie and RezZ?

I guess it is easier to go to one liners than try to refute any
of the points that were made about Gary's Modus Operandi.

Terry



4. Working strategy.

6. Good work.

7. Best Home Base Work

8. CAPS & IPF... they are working on Amiga version