堆栈在微处理器中的作用是什么? [英] What is the role of stack in a microprocessor?

查看:131
本文介绍了堆栈在微处理器中的作用是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

堆栈在微处理器中的作用是什么?

What is the role of stack in a microprocessor?

推荐答案

堆栈在函数调用期间主要使用,但取决于语言和编程级别可用于临时存储处理器寄存器数据或其他变量。

Stack is used largely during a function call but depending on the language and level of programming it may be used to temporarily store processor register data or other variables.

此外,使用递归函数将堆栈中的部分数据存储在堆栈中时,堆栈还可用于短期大规模数据存储。堆叠并再次打电话给自己。

Further, the stack may also be used for short-term large-scale storage of data when using recursive functions that store partial data in the stack and call themselves again.

堆栈的一般用途是例如,


  1. 返回地址


    • 返回值

    • 被调用函数的参数

    • 被调用函数中的局部变量

    • 处理器寄存器,将在被调用函数中重用

  1. Return address
    • return value
    • parameters to called function
    • local variables in the called function
    • processor registers that will be reused in the called function

是的,堆栈也用于漏洞

将返回地址携带到被调用函数返回的位置的性质,
加上 C 语言,提供了一种非常有用的
方式来引起 缓冲区溢出 在易受攻击的(不安全编写的)程序的堆栈中。

And, yes, stack is also used for exploits.
Its nature of carrying the return-address to where a called function returns back, coupled with the weakness of array-bounds checks in the C language, gives a very nice way to cause buffer overflows in the stack of a vulnerable (unsafely written) program.

这篇关于堆栈在微处理器中的作用是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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