📄 mini_simrdi_manager.h
字号:
SimRdi_Advert_Base x;
/* you may advertise only one regwin with a single advert --
afterall it will become rather difficult for users to deal with
10s of them */
RegWin* regwin;
} SimRdi_Regwin_Advert;
/*
* Callback advert
*
* This is the general advert for callbacks into REMSIM.
*/
struct tag_simrdi_Callback_Advert {
SimRdi_Advert_Base x;
bool_int connected; /* true if callback is registered */
/* the following is called by SimRdi_Manager when SIMABS requests
that a particular callback be implemented, the RemSim_Callback to
register will be NULL if REMSIM is asking you to deregister.
c.f. _SimRegisterCallback */
SimRdi_Register_Callback* simregistercallback;
}; /* SimRdi_Callback_Advert */
/*
* Null callback
*
* This is a registration service, it lets objects that implement
* functionality without any more help from SimRdi_Manager to say that
* they exist.
*
* The config flags are in this case a bitmask (no sorting). */
/* null config flags */
enum tag_null_config_flags {
semihosting_null_config_flag = 0x01
};
/* memory callback config flags are determined in simabs.h (though
they are 8 bits, we have 32) */
#if 0
/*
* Iterators -- BEWARE NOT YET (unimplemented)
*
* Iterators are for the moment uni-directional. You obtain one from
* the new_iterator method of the Advert ProcVec. It will point at
* the head. You dereference the iterator using advert(), you set to
* head again using begin(), and get the next iterator using next().
* The iterator is destroyed with destroy_iterator. */
struct tag_private_iterator_##shortname {
Iterator_##advertname my_this;
void* voidstate;
SimRdi_##advertname* current;
};
typedef
struct tag_iterator {
struct tag_private_iterator_##shortname x;
SimRdi_##advertname begin( Iterator_##advertname* );
SimRdi_##advertname advert( Iterator_##advertname* );
void destroy_iterator( Iterator_##advertname* );
SimRdi_##advertname next( Iterator_##advertname* );
};
#else
typedef struct tag_unimplemented { char unimplemented; } Unimplemented;
#endif
/*
* Advert proc vecs
*
* Most adverts have a standard procvec structure constructed by this
* macro and then there are specific members for that advert.
*
* The members should be fairly obvious. 'changed' is 1 if the chain
* was modified last time round. Each time advertise or destroy has
* been called on this advert chain then it is incremented. Thus if
* changed is 0 or 1 after a negotiation session then the chain was
* not altered. This is useful in advert negotiation -- if an advert
* A depends on an advert B in a chain that hasn't changed then A does
* not have to go and check that B is there again. After advert
* negotiation, if it is 1 then it will have a value 0 next time, if
* it is >1 then it will be set to 1. (NOTE: advert negotiation has
* not been implemented yet.) */
#define BEGIN_ADVERT_PROCVEC_STRUCT(advertname,shortname) \
typedef struct tag_##advertname##_ProcVec advertname##_ProcVec; \
typedef SimRdi_##advertname* New_##shortname ( advertname##_ProcVec* ); \
typedef SimRdi_Err Advertise_##shortname( advertname##_ProcVec*, \
SimRdi_##advertname* ad ); \
typedef SimRdi_##advertname* Find_##shortname ( advertname##_ProcVec*, \
Advert_ID id ); \
typedef SimRdi_Err Destroy_##shortname ( advertname##_ProcVec*, \
Advert_ID ad ); \
typedef Unimplemented Iterate_##shortname; \
\
struct tag_##advertname##_ProcVec { \
uint32 version; \
char const* name; \
SimRdiProcVec* spv; \
void* handle; /* &head for linked lists */ \
int32 changed; /* non-zero if an advert was (un)linked */ \
New_##shortname* c_new; \
Advertise_##shortname* advertise; \
Find_##shortname* find; \
Destroy_##shortname* destroy; \
Iterate_##shortname* iterate; \
#define END_ADVERT_PROCVEC_STRUCT(advertname,shortname) \
}
/*
* Callback_Advert_ProcVec
*
* This is meant to act as a base. As more functionality is added
* specific to particular callbacks then this can be used as a base. */
BEGIN_ADVERT_PROCVEC_STRUCT(Callback_Advert,Callback)
SimRdi_Config_Flags config;
END_ADVERT_PROCVEC_STRUCT(Callback_Advert,Callback);
/*
* Uniregs_Advert_ProcVec
*
*
*/
BEGIN_ADVERT_PROCVEC_STRUCT(Uniregs_Advert,Uniregs)
SimRdi_Config_Flags config[NUMBER_OF_UNIREGS_BLOCKS];
END_ADVERT_PROCVEC_STRUCT(Uniregs_Advert,Uniregs);
/*
* Regwin_Advert_ProcVec
*
*/
BEGIN_ADVERT_PROCVEC_STRUCT(Regwin_Advert,Regwin)
SimRdi_Config_Flags config;
END_ADVERT_PROCVEC_STRUCT(Regwin_Advert,Regwin);
/*
* Global_Breaks_Advert_ProcVec
*
*/
BEGIN_ADVERT_PROCVEC_STRUCT(Global_Breaks_Advert,GBreaks)
SimRdi_Config_Flags config;
END_ADVERT_PROCVEC_STRUCT(Global_Breaks_Advert,GBreaks);
/*
* Errors_Advert_ProcVec
*
*/
BEGIN_ADVERT_PROCVEC_STRUCT(Errors_Advert,Errors)
SimRdi_Config_Flags config;
END_ADVERT_PROCVEC_STRUCT(Errors_Advert,Errors);
/*
* Negotiator_Advert_ProcVec
*
*/
BEGIN_ADVERT_PROCVEC_STRUCT(Negotiator_Advert,Negotiator)
SimRdi_Config_Flags config;
END_ADVERT_PROCVEC_STRUCT(Negotiator_Advert,Negotiator);
/*
* End_Gather_Advert_ProcVec
*
*/
BEGIN_ADVERT_PROCVEC_STRUCT(End_Gather_Advert,End_Gather)
SimRdi_Config_Flags config;
END_ADVERT_PROCVEC_STRUCT(End_Gather_Advert,End_Gather);
/*
* SimRdiProcVec
*
* This is the structure that SIMABS-aware modules see, all their
* interactions with advertising capabilities should go through this
* interface. The structure will not move in memory and so the
* modules can store a pointer to it in their state. */
#define SIMRDIPROCVEC_SIGNATURE ((uint32)0xb29d7ef1)
struct tag_simrdiprocvec {
uint32 signature; /* == SIMRDIPROCVEC_SIGNATURE */
struct {
uint32 major;
uint32 minor;
} version;
RDI_AgentHandle agent;
RDI_ModuleHandle armulator_handle;
RDI_ProcVec const* armulator;
SIM_HANDLE* sim_handle; /* this is needed for callbacks to REMSIM */
void *handle; /* private data to SimRdi_Manager, this lets
a single SimRdi_Manager have multiple
SimRdiProcVecs */
bool_int little_endian; /* requested endian */
bool_int really_little_endian; /* actual endian */
/* If you are using the rebuild kit only fill out stop_reason_valid
and stop_info. stop_error_return is not useful to this type of
model.
ARM developers: callbacks can set up the stop cause here and
SimTestStopState and SimExec may not overwrite them if
stopped_reason_valid is true. See comment near RdiExec. */
bool_int stop_reason_valid;
SIM_ERR stop_error_return;
STATUS_INFO stop_info;
/* if we haven't set the PC or we last hit an exit SWI then the
state is 'non-executable'. This is purely to stop people trying
to run programs without setting the PC to the entry point or
trying to run off an exit SWI. */
bool_int target_is_executable;
/* if a callback wants to stop the simulation it should fillout
stop_info, stop_error_return and stop_reason_valid and then make
this call */
RDI_Error (*stop_simulation)( SimRdiProcVec* );
/* modules call these functions to show their ability to implement a
particular functionality of the SIMABS interface. Config flags
are used to show what sub-type of callback it can do. Any of the
procedures may be NULL, if the SimRdi_Manager doesn't what
anything to register for those events. Modules ask for an
advert, fill it in and then advertise it. */
/* the one-true-naming scheme for registers is uniregs, an object
that can provide some uniregs should register using these.
Simulator-defined registers are defined with block numbers >=
uniregs_armulator. Whether a block is exported or not depends on
whether its number appears in blocks_to_export before a
terminating -1 is found. blocks_to_export is
blocks_to_export_len in space. */
int blocks_to_export_len; /* allocated space */
int* blocks_to_export;
Uniregs_Advert_ProcVec* uniregs;
/* Misc */
Global_Breaks_Advert_ProcVec* global_breaks;
Errors_Advert_ProcVec* errors;
/* null callbacks are for those modules that perform some function
that is SIMABS-aware but doesn't require the SimRdi_Manager to do
anything to help it function. An example is the semihosting
module. It merely registers to aid in debugging and to say that
semihosting is SIMABS aware. Its simregistercallback method can
be NULL or could do something like printing out debugging
information. */
Callback_Advert_ProcVec* null;
/* memory callbacks can be called to turn on/off callbacks on memory
accesses */
Callback_Advert_ProcVec* memory;
/* negotiators and end_gatherers */
Negotiator_Advert_ProcVec* negotiator;
End_Gather_Advert_ProcVec* end_gather;
/* register windows */
Regwin_Advert_ProcVec* regwin;
}; /* SimRdiProcVec */
#endif /* MINI_SIMRDI_MANAGER_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -