[U-Boot-Users] PXA255 code in start.S

Amit Kumar Amit_Kumar91 at infosys.com
Fri May 16 08:44:29 CEST 2008



Hello,
            Kindly refer code at path     UBOOT / u-boot / cpu / pxa / start.S

Code:
            .macro      irq_save_user_regs
      sub   sp, sp, #S_FRAME_SIZE
      stmia sp, {r0 - r12}                /* Calling r0-r12      */
      add   r8, sp, #S_PC
      stmdb r8, {sp, lr}^                 /* Calling SP, LR      */
      str   lr, [r8, #0]                  /* Save calling PC           */
      mrs   r6, spsr
      str   r6, [r8, #4]                  /* Save CPSR                 */
      str   r0, [r8, #8]                  /* Save OLD_R0               */
      mov   r0, sp
      .endm

Why there is need to save R0? If we refer ARM architecture (section what all happens when interrupt comes) there is no need to save R0.

Moreover, there is no need of writing such big piece of code it can be replaced with below given four liner code:

      Sub   lr, lr, #4
            Stmfd    sp! , {r0-r12, lr}
            MRS     r1, spsr
            Stmfd    sp! , {r1}

Similarly we can write small code for restore of stack
             .macro     irq_restore_user_regs
                         Ldmfd  sp! , {r1}
                        MSR         cpsr_c ,  R1
                        ldmfd    sp!,  {r0-r12, pc}^
             .endm

Can anybody clarify?

Regards
Amit Kumar




**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20080516/c63e06af/attachment.htm 


More information about the U-Boot mailing list