ARM架构下不同处理器模式下如何使用内核栈? [英] How Kernel stack is used in case of different processor mode in ARM architecture?

查看:43
本文介绍了ARM架构下不同处理器模式下如何使用内核栈?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,每个进程都有一个用户堆栈和内核堆栈.除此之外,ARM体系结构中的每种模式都有一个堆栈.所以我想知道不同的堆栈和堆栈指针在 ARM 模式下是如何工作的?还有什么时候会用到这个与进程关联的内核栈?

解决方案

<块引用>

...当这个与进程关联的内核堆栈将被使用时?

当您进行系统调用时.就像您想要获取接口的 IP 地址一样,内核就像任何其他应用程序一样需要一些堆栈来准备您想要的东西.所以当你切换到系统调用的内核端时它有一个对应的堆栈.

<块引用><块引用>

堆栈和堆栈指针在 ARM 模式下的工作方式有何不同?

ARM 定义了一些硬件模式来处理系统的不同输入.例如,您可以突然执行非法指令(或未定义).在这种情况下,CPU 中的执行会进入不同的模式,需要被告知如何继续.由于大多数情况下您需要一些堆栈空间才能优雅地处理此问题,因此您需要为此模式使用单独的堆栈.ARM 为您提供不同的堆栈寄存器,因此当您切换到不同的硬件模式时,您不会覆盖先前模式的堆栈指针.

As I understand every process have a user stack and kernel stack. Apart from that there is a stack for every mode in ARM achitecture. So I want to know How different stack and stack pointer works in ARM modes? Also when this kernel stack associated with the process will be used ?

解决方案

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

When you make a system call. Like you want to get IP address of an interface, kernel just like any other application needs some stack to prepare what you want. So it has a corresponding stack when you switch to kernel side of a system call.

How different stack and stack pointer works in ARM modes?

ARM defines a few hardware modes to handle different inputs to the system. For example out of nowhere you can execute an illegal instruction (or undefined). In this case execution in CPU goes into a different mode and needs to be told how to proceed. Since most of the time you require some stack space to be able to handle this gracefully you need a separate stack for this mode. ARM provides you different stack register so when you switch to a different HW mode you don't overwrite previous modes stack pointer.

这篇关于ARM架构下不同处理器模式下如何使用内核栈?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆