* PC and PSR on 26-bit ARM
@ 2001-10-22 17:27 Ben Harris
2001-10-23 1:35 ` Philip Blundell
2001-10-25 21:48 ` Andrew Cagney
0 siblings, 2 replies; 4+ messages in thread
From: Ben Harris @ 2001-10-22 17:27 UTC (permalink / raw)
To: gdb
I'm trying to make GDB work happily on NetBSD/arm26, which runs on ancient
ARM processors, where the PC and PSR share R15. As far as I can tell, the
code in arm-linux-nat.c, when fetching registers subprocess on a 26-bit
CPU, puts the PC in registers[PC_REGNUM], and the PC+PSR in
registers[PS_REGNUM]. When putting registers back into the process, it
sets R15 (PC+PSR) from registers[PC_REGNUM] and ignores
registers[PS_REGNUM].
I suppose my question is: is this the intended behaviour? i.e. should I:
(1) do the same on NetBSD,
(2) accurately emulate a 32-bit CPU in 26-bit mode (splitting and
merging PC and PSR at the subprocess interface), or
(3) present GDB with the real state of the CPU?
I think my preference is for (2), since this saves complexity in the rest
of GDB.
--
Ben Harris <bjh21@netbsd.org>
Portmaster, NetBSD/arm26 <URL: http://www.netbsd.org/Ports/arm26/ >
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PC and PSR on 26-bit ARM
2001-10-22 17:27 PC and PSR on 26-bit ARM Ben Harris
@ 2001-10-23 1:35 ` Philip Blundell
2001-10-25 21:48 ` Andrew Cagney
1 sibling, 0 replies; 4+ messages in thread
From: Philip Blundell @ 2001-10-23 1:35 UTC (permalink / raw)
To: Ben Harris; +Cc: gdb
>I'm trying to make GDB work happily on NetBSD/arm26, which runs on ancient
>ARM processors, where the PC and PSR share R15. As far as I can tell, the
>code in arm-linux-nat.c, when fetching registers subprocess on a 26-bit
>CPU, puts the PC in registers[PC_REGNUM], and the PC+PSR in
>registers[PS_REGNUM]. When putting registers back into the process, it
>sets R15 (PC+PSR) from registers[PC_REGNUM] and ignores
>registers[PS_REGNUM].
I don't think the 26-bit support for arm-linux has ever really been tested, so
you probably don't want to put too much faith in it. What you've described
doesn't really sound like the right thing to me; the fetching side is OK, but
when it writes registers back into the process I think it needs to combine
registers[PC_REGNUM] and registers[PS_REGNUM] in order to get the correct R15
value.
p.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PC and PSR on 26-bit ARM
2001-10-22 17:27 PC and PSR on 26-bit ARM Ben Harris
2001-10-23 1:35 ` Philip Blundell
@ 2001-10-25 21:48 ` Andrew Cagney
2001-10-29 14:44 ` Ben Harris
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2001-10-25 21:48 UTC (permalink / raw)
To: Ben Harris; +Cc: gdb
> I'm trying to make GDB work happily on NetBSD/arm26, which runs on ancient
> ARM processors, where the PC and PSR share R15. As far as I can tell, the
> code in arm-linux-nat.c, when fetching registers subprocess on a 26-bit
> CPU, puts the PC in registers[PC_REGNUM], and the PC+PSR in
> registers[PS_REGNUM]. When putting registers back into the process, it
> sets R15 (PC+PSR) from registers[PC_REGNUM] and ignores
> registers[PS_REGNUM].
>
> I suppose my question is: is this the intended behaviour? i.e. should I:
> (1) do the same on NetBSD,
> (2) accurately emulate a 32-bit CPU in 26-bit mode (splitting and
> merging PC and PSR at the subprocess interface), or
> (3) present GDB with the real state of the CPU?
>
> I think my preference is for (2), since this saves complexity in the rest
> of GDB.
GDB doesn't really care what happens. It has mechanisms (if only Arm
was multi-arched) to handle cases such as 2.
Do arm26 and arm32 run the same binaries? If they do then you probably
want a consistent interface with carefully documented semantics.
Otherwise, the best rule I know of is ``don't lie'' - present GDB with
the real raw CPU state.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: PC and PSR on 26-bit ARM
2001-10-25 21:48 ` Andrew Cagney
@ 2001-10-29 14:44 ` Ben Harris
0 siblings, 0 replies; 4+ messages in thread
From: Ben Harris @ 2001-10-29 14:44 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb
On Fri, 26 Oct 2001, Andrew Cagney wrote:
> Do arm26 and arm32 run the same binaries?
Yes, with an appropriately careful compiler (ours is).
> If they do then you probably
> want a consistent interface with carefully documented semantics.
That's what I'm going for. Actually, I'm wrapping the interface in a
couple of functions so that targets will be able to get it right easily.
I'll send them to gdb-patches in a moment.
--
Ben Harris <bjh21@netbsd.org>
Portmaster, NetBSD/arm26 <URL: http://www.netbsd.org/Ports/arm26/ >
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-10-29 14:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-22 17:27 PC and PSR on 26-bit ARM Ben Harris
2001-10-23 1:35 ` Philip Blundell
2001-10-25 21:48 ` Andrew Cagney
2001-10-29 14:44 ` Ben Harris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox