Re: arm assembly doubt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Thanks for the answer. Actually this is what I am trying to understand.

ENTRY(vector_swi)
345         sub     sp, sp, #S_FRAME_SIZE
346         stmia   sp, {r0 - r12}                  @ Calling r0 - r12
347  ARM(   add     r8, sp, #S_PC           )
348  ARM(   stmdb   r8, {sp, lr}^           )       @ Calling sp, lr
349  THUMB( mov     r8, sp                  )
350  THUMB( store_user_sp_lr r8, r10, S_SP  )       @ calling sp, lr
351         mrs     r8, spsr                        @ called from
non-FIQ mode, so ok.
352         str     lr, [sp, #S_PC]                 @ Save calling PC
353         str     r8, [sp, #S_PSR]                @ Save CPSR
354         str     r0, [sp, #S_OLD_R0]

In this case after the line number 348(if its in arm mode),will the
kernel stack have the contents
r0-r12,sp,lr in this order or r0-r12,lr,sp this one. Beccause I
believe stmdb r8, {sp, lr}^ will push the sp first then lr. In that
case sp and lr will be interchanged in struct pt_regs.

Please correct me if I am wrong.





On Wed, Feb 15, 2012 at 9:34 PM, Surenkumar Nihalani <suren@xxxxxxxxxx> wrote:
> Hi,
> On Feb 15, 2012, at 11:30 PM, subin gangadharan wrote:
>
>> Hi ,
>>
>> I am trying to understand how system call is implmented in linux for
>> arm.And I am not that familiar with arm assembly.
>>
>> Could any body please help me to understand what exactly this ^ does
>> in this instruction stmdb r8,{sp,lr}^
>>
>> --
>> With Regards
>> Subin Gangadharan
>>
>> I am not afraid and I am also not afraid of being afraid.
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies@xxxxxxxxxxxxxxxxx
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
> Example:
>        LDFMD sp!, {r0-r12, pc}^
> - The ^ qualifier specifies that the CPSR is restored from the SPSR.
>   It must be used only from a privileged mode.
>



-- 
With Regards
Subin Gangadharan

I am not afraid and I am also not afraid of being afraid.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Networking]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux