臂。 Access用户R13和R14的管理模式 [英] ARM. Access user R13 and R14 from Supervisor mode

查看:178
本文介绍了臂。 Access用户R13和R14的管理模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何访问进入监控模式时被保存在用户R13和R14?我使用的是ARM7TDMI。

How do I access the user R13 and R14 which are saved when supervisor mode is entered? I am using an ARM7TDMI.

即。我不想访问监R14现在包含返回地址到用户模式,而不是想用户模式的链接寄存器的值。这是一个调试器我写的一部分。

I.E. I do not want to access supervisor R14 which now contains the return address to user mode, instead want the value of user mode's link register. This is part of a debugger I am writing.

是否有特殊别名这些寄存器?

Are there special aliases for these registers?

感谢

推荐答案

我将描述答案您的具体问题,但同样的方法也适用于其他模式也是如此。

I'll describe the answer for your specific question but the same approach applies to other modes as well.

您将需要通过在CPSR系统模式改变模式位改变处理器模式。这会给你到用户模式的SP接入/ LR(R13和放大器; R14)。请记住,系统模式是特权,但它的R13和R14是相同的用户模式的R13和R14。

You'll need to change the processor mode by changing the mode bits in the CPSR to system mode. This will give you access to user mode's SP/LR (R13 & R14). Remember that system mode is privileged, but its R13 and R14 are the same as user mode's R13 and R14.

一旦你在系统模式是,阅读R13和R14,并把它们在那里你想要的。然后,只需切换模式位回到你的previous模式(我相信这是你的榜样管理员模式),你是好去。

Once you're in system mode, read R13 and R14 and put them where you want. Then just switch the mode bits back to your previous mode (I believe that was supervisor mode in your example) and you're good to go.

注意,我们没有从主管到用户模式切换。如果您从主管切换到用户,你不能回去的管理方式。 (否则就不会有来自用户code升级特权的保护)。这就是为什么我们使用的系统模式 - 系统模式的特权,但寄存器是相同的用户模式

Note that we did not switch from supervisor to user mode. If you switched from supervisor to user, you couldn't get back to supervisor mode. (Otherwise there would be no protection from user code escalating privilege). That's why we used system mode -- system mode is privileged, but the registers are the same as user mode.

您可以在任何特权模式间随意由CPSR操作模式位进行切换。我认为他们是低5位?我在路上和放大器上;不必在我的指尖的信息。否则,我会为您提供装配code为我所如上所述。其实,如果你想要把一些头发在你的胸部,采取什么我给你上面,实现它,测试它,和背部张贴在这里。 :-D

You can switch between any of the privileged modes at will by manipulating the mode bits in the CPSR. I think they're the lower 5 bits? I'm on the road & don't have the info at my fingertips. Otherwise I would have provided you with the assembly code for what I've described above. Actually, if you want to put some hair on your chest, take what I've given you above, implement it, test it, and post it back here. :-D

(有一件事我要补充,为一般情况(你的是非常具体的) - 您可以检查SPSR看到你从哪里来 - 并用它来确定你需要切换到哪种模式。)

(One thing I should add for the "general case" (yours is very specific) -- you can examine the SPSR to see "where you came from" -- and use that to determine which mode you need to switch to.)

顺便说一句,我只是做这个最近为我的客户....小世界中的一个,我猜。

By the way, I just did this recently for one of my customers.... small world, I guess.

这篇关于臂。 Access用户R13和R14的管理模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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