stack pointer used in vector_swi() in arm linux system call

Anonymous Page sourav.jb1988 at gmail.com
Tue Oct 2 10:52:53 EDT 2018


Hi,

While reading the vector_swi() routine for arm linux system call, I
found that r0-r12 registers are copied to the kernel stack(below is
the code).

ENTRY(vector_swi)
#ifdef CONFIG_CPU_V7M
        v7m_exception_entry
#else
        sub     sp, sp, #S_FRAME_SIZE
        stmia   sp, {r0 - r12}                           @ Calling r0 - r12

As per my understanding, during system call arm enters into svc mode
and jumps to vector_swi()routine and begins execution. The sp register
of svc mode(sp_svc)points to kernel stack. r0-r12 registers are copied
to the kernel stack.

My question is how is the sp (sp_svc) register setup?

How does it know the address of kernel stack? Is this kernel stack
same as the process's(the process that called system call) kernel
stack?

Thanks & Regards



More information about the Kernelnewbies mailing list