| M E M _ F I L L J U M P T A B L E ( )
| | | | | SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English
AMIGA - MEM_#?
----------------------------------------------------------------------------
NAME
mem_filljumptable() - Fills a range of slots with
given opcode and/or address.
SYNOPSIS
slots = mem_filljumptable(
dst, inst, addr, start, count);
LONG mem_filljumptable(struct Library **,
LONG, LONG, LONG, LONG);
FUNCTION
This routine allows to setup jump table quick such
that single routine can be spread across different
slots.
INPUTS
dst - Destination jump table as created with the
alloc. function.
inst - m68k CPU call instruction after which func
address is to be expected. JMP = 0x4EF9 or
JSR = 0x4EB9. Pass -1 so that instruction
will not be altered.
addr - Routine address for this slot range. Pass
-1 if you do not want to touch the ptr.
start - Start slot. Min. 1. Fyi, in reality slots
grow downwards so 1 == -1, but neg. values
are not accepted!
count - Number of slots affected. Min. 1
RETURNS
Returns 0 if all slots as specified in count have
been filled or a positive number of slots that are
out of range.
BASES
SysBase
NOTES
Warning! No arbitration is applied during filling!
If both: 'inst' and 'addr' are -1 then each jump
table slot will be given respective call table ptr.
Instruction is altered too. Use this mode to fix
jump table quickly.
It is safe to specify out of range values in start
and count. Sanity checks are made.
The func. will return -slots if 'dst' is not local
jump table.
Caution! First 4 slots(offsets 6 - 24) are library
private routines.
This routine modifies the jump table only! It does
not alter call table in any way.
SEE ALSO
mem_allocjumptable(), mem_freejumptable(),
mem_swapjumptable(), mem_importjumptable(),
mem_setdatajtslot(), mem_setaddrjtslot(),
mem_addrfrombase()
EXAMPLE
#include <qdev.h>
#include <a-mem_xxxjumptable.h>
...
long myroutine(void)
{
txt_debugprintf(32, "Unimplemented yet!\n");
return 0;
}
...
struct Library **jt;
/*
* Allocate new jump table that has 8 slots or in
* original meaning is (8 * 6) == 48 bytes wide.
*/
if ((jt = mem_allocjumptable(8, 0)))
{
/*
* Load warning routine address to last 4 slots
* where 5th slot is taken into account as well,
* thus: 5/1, 6/2, 7/3, 8/4 .
*/
mem_filljumptable(jt,
QDEV_PRV_LBS_JMPINST, (LONG)myroutine, 5, 4);
...
}
...
BUGS
None known.
----------------------------------------------------------------------------
| |
| |