This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: strange things with ARMulator (thumb state, swi)
- From: Nick Clifton <nickc at cambridge dot redhat dot com>
- To: Adrian von Bidder <avbidder at acter dot ch>
- Cc: binutils <binutils at sources dot redhat dot com>
- Date: 29 Nov 2001 10:15:25 +0000
- Subject: Re: strange things with ARMulator (thumb state, swi)
- References: <3BFE626F.7E50F238@acter.ch>
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