📄 c_r.htm
字号:
<title>The r Command</title><h1>r</h1><!--INDEX "r command" "display registers" "pseudo registers" -->The r command sets or displays register values.<p></dl><h2>Format</h2><dl><dd>The format for the r command is:<p><pre> r [reg|* [val|field val]]</pre>where:<p><dl><dd><table><tr><td valign=top width=100>reg</td><td>is the name of the register or registers (specified by wildcard characters) to display or modify.</td></tr><tr><td valign=top>val</td><td>is the value to which the specified register or registers should be modified.</td></tr><tr><td valign=top>field val</td><td>is the value to which the specified field in the specified register should be modified.</td></tr><tr><td valign=top>* </td><td>displays the contents of all registers except floating-point registers.</td></tr><tr><td valign=top>f* </td><td>displays the contents of all floating-point registers.</td></tr></table></dl><p>Invoking the r command without any parameters or arguments displays a list of all the general-purpose registers. <p></dl><h2>Functional Description</h2><dl><dd>The r command sets or displays register values. The character and wordwildcards, "*" and "?", can be used in the register name. The '?'character matches any single character, while the '*' character matchesany number of any characters. This command accepts both hardware andsoftware names. Examples illustrating the use of the r commandfollow.<p><dl><dd><table><tr><td width=300><samp>r </samp></td><td>Display all General-purpose registers.</td></tr><tr><td> <samp>r * </samp></td><td>Display all register values.</td></tr><tr><td> <samp>r 8 </samp></td><td>Display $8 (t0).</td></tr><tr><td> <samp>r t0 </samp></td><td>Display t0 ($8).</td></tr><tr><td> <samp>r t* </samp></td><td>Display t0 through t9.</td></tr><tr><td> <samp>r epc </samp></td><td>Display EPC register.</td></tr><tr><td> <samp>r epc start </samp></td><td>Set EPC register to the symbol start value.</td></tr><tr><td> <samp>r 4 45 </samp></td><td>Set register 4 to 45.</td></tr><tr><td> <samp>r t0 45 </samp></td><td>Set register t0 to 45.</td></tr><tr><td> <samp>r sr 0 </samp></td><td>Set SR to zero.</td></tr><tr><td> <samp>r sr bev 1 </samp></td><td>Set the BEV bit of SR to one.</td></tr><tr><td> <samp>r epc a0020000 </samp></td><td>Set EPC to a0020000.</td></tr><tr><td> <samp>r a </samp></td><td>Display the value of pseudo register 'a'.</td></tr><tr><td> <samp>r ? </samp></td><td>Display the value of all pseudo registers.</td></tr></table></dl><p>There are 26 pseudo registers (named a thru z). These can be referencedin the same way as real registers, and are typically used to implementcomplex breakpoint conditions (see the <a href="c_when.htm">when</a>command).<p></dl><h2>Examples</h2><dl><dd>Display all General Purpose registers.<p><pre>PMON> r zero at v0 v1 a0 a1 a2 a3 $0- 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 t0 t1 t2 t3 t4 t5 t6 t7 $8- 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 s0 s1 s2 s3 s4 s5 s6 s7 $16- 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 t8 t9 k0 k1 gp sp s8 ra $24- 00000000 00000000 00000000 00000000 00000000 80008b40 00000000 00000000</pre>Display all registers. Note that the actual registers that aredisplayed by the "<samp>r *</samp>" command depends on what type ofprocessor you are using. This display was generated using a LR33000.<p><pre>PMON> r * $0- 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 $8- 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 $16- 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 $24- 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000C0_EPC=a0020000 C0_BADADDR=00000000 C0_BPC=00000000 C0_BDA=00000000 M_TIC1=000000 M_TIC2=000000 M_RTIC=025 C0_SR: CU BEV TS PE CM PZ SWC ISC IM&SW KUo IEo KUp IEp KUc IEc 0000 0 0 0 0 0 0 0 00000000 0 0 0 0 0 0 C0_CAUSE: BD CE IP SW EXCODE 0 0 000000 00 Int C0_PRID: IMP Rev 0 0 C0_DCIC: TR UD KD TE DW DR DAE PCE DE D I T W R DA PC DG 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 M_CFG: ICD DCD IBS DBS IW IOWAIT PW PWAIT CS PE DGE BFD RGN RPC CL DCE 0 0 16 16 0 6 0 6 0 0 1 0 1 1 1 1 M_TC1: CE IE INT 0 0 0 M_TC2: CE IE INT 0 0 0 </pre>Set the IEC bit of the Status Register.<p><pre>PMON> r sr iec 1</pre>Display the Status Register.<p><pre>PMON> r sr C0_SR: CU BEV TS PE CM PZ SWC ISC IM&SW KUo IEo KUp IEp KUc IEc 0000 1 0 0 0 0 0 0 00000000 0 0 0 0 0 1 </pre><p>You can use the <a href="c_ls.htm">ls</a> command to display the Status Register as a hex value. This technique can be used for any register.<p><pre>PMON> ls -v @sr0x00400001 = 0t4194305 = 0o20000001</pre></dl><h2>Files</h2><dl><dd>The r command is located in <a href="../mon/regs.c">mon/regs.c</a>.</dl><h2>See Also</h2><dl><dd><a href="c_l.htm">l command</a>for disassembling instructions from memory.</dl><p><hr><b>Navigation:</b> <a href="index.htm">Document Home</a> | <a href="doctoc.htm">Document Contents</a> | <a href="docindex.htm">Document Index</a> <p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -