Cryptography Reference
In-Depth Information
CHAPTER 9
Dynamic Registers
“What a depressingly stupid machine,” said Marvin and trudged away.
—Douglas Adams, The Restaurant at the End of the Universe
I N ADDITION TO THE AUTOMATIC, or in exceptional cases global, CLINT objects used
up to now, it is sometimes practical to be able to create and purge CLINT variables
automatically. To this end we shall create several functions that will enable us to
generate, use, clear, and remove a set of CLINT objects, the so-called register bank,
as a dynamically allocated data structure, where we take up the sketch presented
in [Skal] and work out the details for its use with CLINT objects.
We shall divide the functions into private management functions and public
functions; the latter of these will be made available to other external functions
for manipulating the registers. However, the FLINT/C functions do not use the
registers themselves, so that complete control over the use of the registers can be
guaranteed to the user's functions.
The number of registers available should be configurable while the program
is running, for which we need a static variable NoofRegs that takes the number of
registers, which is predefined in the constant NOOFREGS .
static USHORT NoofRegs = NOOFREGS;
Now we define the central data structure for managing the register bank:
struct clint_registers
{
int noofregs;
int created;
clint **reg_l;
/* pointer to vector of CLINT addresses */
};
The structure clint_registers contains the variable noofregs , which specifies
the number of registers contained in our register bank, and the variable created ,
which will indicate whether the set of registers is allocated, as well as the pointer
reg_l to a vector that takes the start address of the individual registers:
static struct clint_registers registers = {0, 0, 0};
 
Search WWH ::




Custom Search