Re: [Prex-devel] sp pointer in umem_* functions
Status: Beta
Brought to you by:
kohtani
From: pradeep s. <pra...@gm...> - 2009-07-22 20:49:16
|
Sorry for the previous incomplete mail. I was going through umem_strnlen function defined in sys/arch/arm/arm/locore.S : mov r12, sp stmdb sp!, {r4, r11, r12, lr, pc} mov r4, r0 sub r11, r12, #4 cmp r0, #(UMEM_MAX) bhi umem_fault b 2f 1: add r0, r0, #1 2: subs r1, r1, #1 bcc 3f known_fault3: /* May be fault here */ ldrb r3, [r0] cmp r3, #0 bne 1b 3: rsb r0, r4, r0 str r0, [r2] mov r0, #0 /* Set no error */ ldmia sp, {r4, r11, sp, pc} At entry, r12 contains old sp pointer and 5 registers are pushed on the stack. But at exit only 4 registers are popped out. Why is pc pushed on the stack at entry ? Regards, Pradeep On Wed, Jul 22, 2009 at 1:45 PM, pradeep sawlani<pra...@gm...> wrote: > Hello , > I was going through umem_strnlen function defined in sys/arch/arm/arm/locore.S : > > mov r12, sp > stmdb sp!, {r4, r11, r12, lr, pc} > mov r4, r0 > sub r11, r12, #4 > cmp r0, #(UMEM_MAX) > bhi umem_fault > b 2f > 1: add r0, r0, #1 > 2: subs r1, r1, #1 > bcc 3f > known_fault3: /* May be fault here */ > ldrb r3, [r0] > cmp r3, #0 > bne 1b > 3: rsb r0, r4, r0 > str r0, [r2] > mov r0, #0 /* Set no error */ > ldmia sp, {r4, r11, sp, pc} > |