Datasheet

ARMulator Reference
ARM DUI0058D Copyright © 1999-2001 ARM Limited. All rights reserved. 4-3
4.2 Communicating with the core
During initialization, all the models receive a pointer to an
mdesc
structure of type
RDI_ModuleDesc *
. They copy this structure into their own state as a field called
coredesc
.
This is passed as the first parameter to most ARMulif (ARMulator interface) functions.
ARMulator exports these functions to enable models to access the ARMulator state
through this handle.
The following functions provide read and write access to ARM registers:
ARMulif_GetReg on page 4-5
ARMulif_SetReg on page 4-5
ARMulif_GetPC and ARMulif_GetR15 on page 4-6
ARMulif_SetPC and ARMulif_SetR15 on page 4-6
ARMulif_GetCPSR on page 4-7
ARMulif_SetCPSR on page 4-7
ARMulif_GetSPSR on page 4-8
ARMulif_SetSPSR on page 4-8.
A model must pass a pointer to their coredesc structure when calling a function in
ARMulif that calls the core.
The following functions provide convenient access to specific bits or fields in the CPSR:
ARMulif_ThumbBit on page 4-9
ARMulif_GetMode on page 4-9.
The following functions call the read and write methods for a coprocessor:
ARMulif_CPRead on page 4-10
ARMulif_CPWrite on page 4-11.
Note
Note
It is not appropriate to access some parts of the state from certain parts of a model. For
example, you must not set the contents of an ARM register from a memory access
function, because the memory access function can be called during simulation of an
instruction. In contrast, it is sometimes necessary to set the contents of ARM registers
from a SWI handler function.