tableSize = MakeFunctions(target, functionArray, funcDispBase)
D0 A0 A1 A2
ULONG MakeFunctions(APTR,APTR,APTR);
A low level function used by
MakeLibrary() to build jump tables of the type used by libraries, devices and resources. It allows the table to be built anywhere in memory, and can be used both for initialization and replacement. This function also supports function pointer compression by expanding relative displacements into absolute pointers.
The processor instruction cache is cleared after the table building.
MakeFunctions() does not check if the number of entries in the table referenced by the functionArray parameter will require more than 65535 bytes of storage. This is a problem because the Library->lib_NegSize member is an unsigned 16 bit integer.
Library and device functions are called with a signed 16 bit displacement relative to the library base address in register A6. Any functions outside this range (-32766..-6) will be unusable. This limits the number usable functions to "only" 5461.
The contents of Library jump tables whose size exceeds 32767 bytes can no longer be changed via
SetFunction() as the offset will be clipped to a signed 16 bit value.
MakeFunctions() will fill in as many functions as requested, even if the space reserved for storing them is insufficient.
This bug exists in all Amiga operating system versions, including Kickstart 1.1 and beyond.