12.11.1. Installing and removing upcalls

Each upcall has its own installation and removal functions. These functions follow a standard format, as described below.

Installing an upcall

Each upcall in installed using a function of the form:


void *ARMul_Install<UpcallName>(ARMul_State *state,                                typename *fn
                                void *handle)

where:

<UpcallName>

is the name of the upcall. For example, the ExitUpcall() is installed with ARMul_InstallExitHandler. The upcalls are:

  • ExitUpcall()

  • ModeChangeUpcall()

  • TransChangeUpcall()

  • ConfigChangeUpcall()

  • InterruptUpcall()

  • ExceptionUpcall()

  • UnkRDIInfoUpcall().

state

is a pointer to the ARMulator state.

typename

is the type of the function, as defined by typedef in the upcall prototype.

fn

is a pointer to the function to be installed.

handle

is the handle to be passed to the corresponding Remove upcall function.

The function returns a void * handle to the upcall handler. This should be kept because it is required by the corresponding Remove upcall function.

Removing an upcall

Each upcall is removed using a function of the form:


int *ARMul_Remove<UpcallName>(ARMulState *statevoid *node)

where:

<UpcallName>

is the name of the upcall to be removed. For example,the ExitUpcall() is removed with ARMul_RemoveExitHandler. See the description of the Install upcall function for a list of upcall names.

state

is the state pointer.

node

is the handle returned from the corresponding Install upcall function.

The remove upcall functions return:

  • TRUE if the upcall is removed

  • FALSE if the upcall remove failed.

Copyright © 1997, 1998 ARM Limited. All rights reserved.ARM DUI 0041C
Non-Confidential