ARM assembly In accessing the

From the below assembler snippet code, I am trying to accesses the CPU id
from the register (r0), to a global variable (_cpu_id), and pass the CPU id
as a parameter to a function (setup_vector_funcs(_cpu_id )). 

.extern setup_vector_funcs

But I am unable to do it. Can any body please help me.Currently I am using
the Processor: ARM7A based LS1021A

  mrc     p15,0,r0,c0,c0,5          /* Read Multiprocessor Affinity
Register (MPIDR) */
  and     r0,r0,#0x3                /* Mask off CPU ID */
  cmp     r0,#0x0                   /* Determine if Core 0 */
  cpy r12,r13
  push {r11-r12,r14,pc}
  sub  r11,r12,#0x04
  ldr sp,=_cpu_id                   /* get address of _cpu_id */
  ldr r0,[sp]                       /*ro will be copied to _cpu_id */  

setup_vector_funcs(_cpu_id )        /*Now call the function*/