📄 32rules.html
字号:
<!doctype html public "-//W3C//DTD HTML 3.2//EN"><html><head><title>32 bit rules</title><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><meta http-equiv="content-language" content="en" /><meta name="resource-type" content="document"><meta name="copyright" content="This document copyright 2001 by Richard Murray. Use for non-profit and education purposes explicitly granted."><meta name="author" content="Richard Murray"><meta name="rating" content="general"></head><!-- /assembler/32rules.html --><!-- --><!-- (C) Copyright 2001 Richard Murray --><!-- Designed by Richard Murray --><!-- rmurray@heyrick.co.uk --><!-- --><body bgcolor="#f0f0f0" text="#000000" link="#0022dd" vlink="#002288"><table border = "0" width="100%"> <tr> <td align=center width=100> <img src="arm3.gif" width=79 height=78 align = middle> </td> <td> <h1 align="center"><font color="#800080">32 bit rules</font></h1> </td> <td align=center width=100> <img src="arm3.gif" width=79 height=78 align = middle> </td></table><p> <p><ul> <li> Do <i>not</i> use: <ul> <li> TEQP <li> TSTP <li> CMPP <li> CMNP </ul> (non-P versions, ie <code>CMP</code> and <code>TST</code> are okay). <br> <br> <li> Check instructions such as BIC and ORR which update PC, R14, or a register copied into PC. <br> The trick of using <code>ORRS PC, R14, #1<<28</code> won't work.<br> In fact, do not use <i>any</i> instruction which writes to PC with the S bit set. <br> <br> <li> Don't use R15 (PC) as the shift register in data processing operations. <br> <br> <li> In LDR/STR, don't use PC as register offset and do <i>not</i> write back to it. <br> <br> <li> In post-indexed LDR/STR, Rm and Rn must not be the same register. Likewise, for anything involving writeback, Rm and Rn should be different registers. <br> <br> <li> LDM/STM, don't use the S bit in user mode. That means, don't use the '^' (ie <code>LDMFD R13!, {PC}^</code>). <br> <br> <li> BL does not save the status register. This must be performed explicitly, but such code will not operate on ARM2 or ARM3 because they don't support the MRS/MSR instructions.<br> Note, also, that it is <b>NOT</b> possible to see what the callee flags were, thus it does not make sense to restore flags that you don't know the status of. The best you can do is preserve the flags set on entry.</ul><p> <p>For those interested in what the S bit does in 32bit mode...<p>Any 32-bit write to R15 with the S bit set (MOVS, ORRS, TEQP, LDM...^) will transfer the SPSRfor the current mode to the CPSR.<br>For example, assuming we are in irq_32 mode:<pre> MOVS PC, R14</pre>would copy R14 to PC, and then copy SPSR_IRQ32 to CPSR.<p>This is not terribly useful as USR mode does not even have an SPSR!<p> <p><hr size = 3><a href="index.html#09">Return to assembler index</a><hr size = 3><address>Copyright © 2001 Richard Murray</address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -