| M E M _ S E T A D D R J T S L O T ( )
| | | | | SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English
AMIGA - MEM_#?
----------------------------------------------------------------------------
NAME
mem_setaddrjtslot() - Sets offset or absolute routine
address per slot.
SYNOPSIS
ofp = mem_setaddrjtslot(jtab, fp, slot);
LONG mem_setaddrjtslot(
struct Library **, LONG, LONG);
FUNCTION
This LBS companion function allows programmer to load
routine offset at which routine jump entry resides or
pass the function address directly per slot.
INPUTS
jtab - Local jump table pointer.
fp - Offset (negative value) or address (a positive
value). Stuffing 0 makes this routine to ret.
existing offset/address only.
slot - Slot number to affect. Counting from 1. If you
want to use offsets then include priv. header:
'a-mem_xxxjumptable.h' and use macros.
RETURNS
Ret. old/curr. offset or absolute pointer or NULL if
nothing was set.
BASES
SysBase
NOTES
Warning! No arbitration is performed when altering the
slot!
Normally this function will call 'CacheClearU()' after
new 'fp' has been set! It is possible to disable that.
This func. works pretty much like 'SetFunction()'. The
difference is it does not modify jump table but a call
table.
Yes, this function can change slot appearance in a way
that if a j. table was allocated strictly for absolute
addressing or strictly for relative addressing it is
possible to change that per slot anytime. See enclosed
example below.
SEE ALSO
mem_allocjumptable(), mem_freejumptable(),
mem_swapjumptable(), mem_importjumptable(),
mem_filljumptable(), mem_setdatajtslot(),
mem_addrfrombase()
EXAMPLE
#include <qlbs.h>
#include <qdev.h>
#include <proto/exec.h>
/*
* Slot number 5 is at offset 30 in our local 'jt'.
*/
#define Wait_CALL(signalSet) LP1(\
30, ULONG, Wait, ULONG, signalSet, d0,, *(void **)jt)
...
struct Library **jt;
if ((jt = mem_allocjumptable(16,
QDEV_MEM_LBS_FABSCALL | QDEV_MEM_LBS_FNOFLUSH)))
{
/*
* Associate jump table with call table. You must
* call this routine if you don't import other lib!
*/
mem_filljumptable(jt, -1, -1, 1, 16);
/*
* I have got 16 slots and i want to map one of the
* 'exec' routines, say 'Wait()' which is at -318 to
* slot 5 in a relative way.
*/
mem_setaddrjtslot(jt, -318, 5);
mem_setdatajtslot(jt, SysBase, 5);
/*
* Allow cache flushes and do flush them right now.
*/
mem_swapjumptable(NULL, jt);
/*
* I can now call 'exec' routine using my local jump
* table.
*/
Wait_CALL(SIGBREAKF_CTRL_C);
mem_freejumptable(jt);
}
BUGS
None known.
----------------------------------------------------------------------------
| |
| |