This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: strange things with ARMulator (thumb state, swi)


Hi Adrian,

> Now, the problem is the thumb swi instruction - there seem to be
> various problems, lr and spsr seem to have bogus values for thumb.

Hmm, well the newlib C library uses the SWI interface to perform
system calls to the Angel or Demon debug interfaces and the ARM
simulator traps and emulates these SWI calls, so I believe that it
should be working.

I have not tried single stepping through a SWI call in GDB however, so
it is quite possible that this does not work. :-(  Personally I would
recommend using lower level debugging techniques than a source
debugger when trying to get SWI code working.  But that is just me.

In case it helps here is a quick overview of how the simulator handles
a SWI:

A Thumb SWI is first caught in ARMul_ThumbDecode() in
sim/arm/thumbemu.c where it is transformed into a ARM SWI (see case 27
around line 391).  This is then transfered to ARMul_Emulate32() in
sim/arm/armemu.c where it is passed to ARMul_OSHandleSWI() defined in
sim/arm/armos.c.  If the SWI value is not oneof the debug commands
then the default case will set up the registers and tell the emulator
to perform a Software Interrupt exception and follow the SWI vector.


Cheers
        Nick



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]