How is the kernel stack used in case of different processor modes in the ARM architecture?

As I understand it, each process has a user stack and a kernel stack. In addition, there is a stack for each mode in the ARM architecture. So I want to know how different stack and stack pointers work in ARM modes? Also, when will this kernel stack associated with the process be used?

+3
arm linux-kernel linux-device-driver
Mar 24 '14 at 4:35
source share
2 answers

... when will this kernel stack associated with the process be used?

When making a system call. Just as you want to get the IP address of an interface, the kernel, like any other application, needs some stack to prepare what you want. Thus, it has an appropriate stack when switching to the kernel side of a system call.

How do different stack and stack pointers work in ARM modes?

ARM defines several hardware modes for processing various system inputs. For example, from nowhere you can execute an illegal instruction (or undefined). In this case, execution in the CPU switches to another mode and it should be told how to proceed. Since most of the time, you need some stack space to be able to handle this gracefully, you need a separate stack for this mode. ARM provides you with a different stack register, so when you switch to another HW mode, you do not overwrite the previous mode stack pointer.

+4
Mar 25 '14 at 7:39
source share

The kernel stack is not associated with any particular process that it uses by the kernel to track its own functions and system calls caused by processes. Since a system call processes kernel data structures, its stack cannot be supported in the stack process, then the process can access private kernel data files that are harmful to the kernel.

0
Mar 24 '14 at 4:44
source share



All Articles