Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Richard Earnshaw <rearnsha@arm.com>
To: "Odd Lindahl" <odd.lindahl@mail.com>
Cc: gdb@sources.redhat.com, Richard.Earnshaw@arm.com
Subject: Re: assembler version of "set $cpsr = 0xd3"
Date: Thu, 14 Jun 2001 02:27:00 -0000	[thread overview]
Message-ID: <200106140926.KAA27128@cam-mail2.cambridge.arm.com> (raw)
In-Reply-To: <20010614090729.13656.qmail@mail.com>

> Hi all,
> 
> I have writen a program to my AT91EB40 boards flash at 0x10100000
> and I want to execute it after reset by putting the switch, SW1, in the
> UPPER MEM position.
> 
> The program doesn't work correctly though :-(
> 
> But if I boot in Angel mode and issue the gdb commands:
> 
> set rdiromatzero 1
> set remotebaud 9600
> target rdi com1
> set $cpsr = 0xd3
> jump *0x01010000
> ( or either of jump *0x01000000 and jump *0x01010000 with the switch in
> UPPER MEM position)
> 
> it starts up fine!!
> 
> But if I skipp the "set $cpsr = 0xd3" command it wont run correctly.
> 
> So what exactly does the "set $cpsr = 0xd3" command do and
> how do I replace the mode switch in software that I can flash.

You need the MSR instruction.  More precisely, the direct equivalent is

	mov	r0, #0xd3
	msr	cpsr_all, r0

But beware, you should not normally set the PSR registers in this way.  
Instead you should use a read-modify-write sequence so as the preserve the 
status of those bits that are not relevant to you at that time.  For 
example, to disable interrupts you would use

Disable_interrupts:
	mrs	r0, cpsr_all	// Get current status
	orr	r1, r0, #0xc0	// FIQ and IRQ ...
	msr	cpsr_all, r1	// ... block them
	mov	pc, lr

Full details of the bits in the CPSR registers are described in the ARM-ARM

R.




      reply	other threads:[~2001-06-14  2:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-14  2:07 Odd Lindahl
2001-06-14  2:27 ` Richard Earnshaw [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200106140926.KAA27128@cam-mail2.cambridge.arm.com \
    --to=rearnsha@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gdb@sources.redhat.com \
    --cc=odd.lindahl@mail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox