什么寄存器指向堆? [英] What register points to the heap?

查看:30
本文介绍了什么寄存器指向堆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚完成了 ARM 架构/汇编的学习.如果 SP 寄存器保存下一个要放入数据的内存位置的地址,那么堆的地址是什么?例如,在 C++ 中,如果您在堆上声明一个对象(例如 MyObj example = new MyObj();),程序集会是什么样子,从某种意义上说,它在哪里知道 example 是?

I just finished learning ARM architecture/assembly. If the SP register holds the address of the next memory location to put data into, what holds the address of the heap? For example in C++ if you declare an object on the heap (e.g. MyObj example = new MyObj();) what would the assembly look like, in the sense where would it know where example is?

推荐答案

在此上下文中的堆栈是 OS/EABI 提供的较低级别的结构.这就是为什么有一个传统的寄存器.但是,堆是操作系统提供的更高级别的结构.因此,管理和使用它取决于与您的应用程序和操作系统的协议.在汇编术语中,您将使用该堆并通过寄存器取消引用某些地址.

Stack in this context is a lower level structure provided by OS/EABI. That's why there is a conventional register for that. However, heap is a higher level structure provided by OS. So managing and playing with it depends on the agreement with your app and OS. In assembly terms, you'll be using that heap with dereferencing some addresses through registers.

这篇关于什么寄存器指向堆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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