4.7.2. Unknown RDI information handler

The unknown RDI information function is called if ARMulator cannot handle an RDI_InfoProc request itself. It returns an RDIError value. This function can be used by a model extending the RDI interface between ARMulator and the debugger. For example, the profiler module (in profiler.c) provides the RDIProfile info calls.

Syntax


typedef int RDI_InfoProc(void *handleunsigned type,                         ARMword *arg1, ARMword *arg2)

where:

handle

is the handle passed to ARMulif_InstallUnkRDIInfoHandler.

type

is the RDI_InfoProc subcode. These are defined in rdi_info.h. See below for some examples.

arg1/arg2

are arguments passed to the handler from ARMulator.

Usage

ARMulator stops calling RDI_InfoProc() functions when one returns a value other than RDIError_UnimplementedMessage.

The following codes are examples of the RDI_InfoProc subcodes that can be specified as type:

RDIInfo_Target

This enables models to declare how to extend the functionality of the target. For example, profiler.c intercepts this call to set the RDITarget_CanProfile flag.

RDIInfo_SetLog

This is passed around so that models can switch logging information on and off. For example, tracer.c uses this call to switch tracing on and off from bit 4 of the rdi_log value.

RDIRequestCyclesDesc

This enables models to extend the list of counters provided by the debugger in $statistics. Models call ARMul_AddCounterDesc() (see General purpose functions) to declare each counter in turn. It is essential that the model also trap the RDICycles RDI info call.

RDICycles

Models that have declared a statistics counter by trapping RDIRequestCyclesDesc must also respond to RDICycles by calling ARMul_AddCounterValue() (see General purpose functions) for each counter in turn, in the same order as they were declared.

The above RDI info calls have already been dealt with by ARMulator, and are passed for information only, or so that models can add information to the reply. Models must always respond to these messages with RDIError_UnimplementedMessage, so that the message is passed on even if the model has responded.

Install the handler using:


int ARMulif_InstallUnkRDIInfoHandler(RDI_ModuleDesc *mdesc,                                     RDI_InfoProc *funcvoid *handle)

Remove the handler using:


int ARMulif_RemoveUnkRDIInfoHandler(RDI_ModuleDesc *mdesc,                                    RDI_InfoProc *funcvoid *handle)

Example

The semihost.c model supplied with ARMulator uses the UnkRDIInfoUpcall() to interact with the debugger:

RDIErrorP

returns errors raised by the program running under ARMulator to the debugger.

RDISet_Cmdline

finds the command line set for the program by the debugger.

RDIVector_Catch

intercepts the hardware vectors.

Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI0058D
Non-Confidential