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***
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to