Home  /  Autodocs  /  exec.library

NAME

MakeFunctions
construct a function jump table

SYNOPSIS

tableSize = MakeFunctions(target, functionArray, funcDispBase)
D0 A0 A1 A2

ULONG MakeFunctions(APTR,APTR,APTR);

FUNCTION

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.

INPUTS

destination
the target address for the high memory end of the function jump table. Typically this will be the library base pointer.

functionArray
pointer to an array of function pointers or function displacements. If funcDispBase is zero, the array is assumed to contain absolute pointers to functions. If funcDispBase is not zero, then the array is assumed to contain word displacements to functions. In both cases, the array is terminated by a -1 (of the same size as the actual entry.

funcDispBase
pointer to the base about which all function displacements are relative. If zero, then the function array contains absolute pointers.

RESULT

tableSize
size of the new table in bytes (for LIB_NEGSIZE).

BUGS

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.

SEE ALSO

MakeLibrary(), SetFunction()