📄 arminstrs.txt
字号:
decode the SWI number and execute the appropriate routines).55..99.. CCoo--pprroocceessssoorr ddaattaa ooppeerraattiioonnssxxxxxxxx11111100 oooooooonnnnnnnn ddddddddpppppppp qqqqqq00mmmmmmmmTypical Assembler Syntax: CCDDPP pp,, oo,, CCRRdd,, CCRRnn,, CCRRmm,, qq CCDDPP pp,, oo,, CCRRdd,, CCRRnn,, CCRRmmThis instruction is passed on to co-processor p, telling it to performoperation o, on co-processor registers CRn and CRm, and place the resultinto Crd.qqq may supply additional information about the operation concerned.The exact meaning of these instructions depends on the particular co-pro-cessor in use; The above is only a recommended usage for the bits (and -18-indeed the FPA doesn't conform to it). The only part which is obligatory isthat pppp must be the coprocessor number: the coprocessor designer is freeto allocate oooo, nnnn, dddd, qqq and mmmm as desired.If the coprocessor uses the bits in a different way than the recommendedone, assembler macros will probably be needed to translate the instructionsyntax that makes sense to people into the correct CDP instruction. Forcommonly used coprocessors such as the FPA, many assemblers have the extramnemonics built in and do this translation automatically. (For example,assembling MUFEZ F0,F1,#10 as its equivalent CDP 1,1,CR0,CR9,CR15,3.)Currently defined co-processor numbers include: 1 and 2 Floating Point unit 15 Cache ControllerIf a call to a coprocessor is made and the coprocessor does not respond(normally becuase it isn't there!), the undefined instruction vector iscalled (exactly as for one of the undefined instructions given later). Thisis used to transparently provide FP support on machines without an FPA.These instructions take 1S + bI cycles to execute, where b is the number ofcycles that the coprocessor causes the ARM to busy-wait before it acceptsthe instruction: again, this is under the coprocessor's control.55..1100.. CCoo--pprroocceessssoorr ddaattaa ttrraannssffeerr aanndd rreeggiisstteerr ttrraannssffeerrssxxxxxxxx111100PP UUNNWWLLnnnnnnnn DDDDDDDDpppppppp oooooooooooooooo LLDDCC//SSTTCCxxxxxxxx11111100 ooooooLLNNNNNNNN ddddddddpppppppp qqqqqq11MMMMMMMM MMRRCC//MMCCRRAgain these depend on the particular co-processor p in use.N and D signify co-processor register numbers, n and d are ARM processornumbers. o is the co-processor operation to use. M signifies bits thecoprocessor is free to use as it wants.The first form, denotes LDC if L=1, STC otherwise. The instruction behaveslike LDR or STR respectively, in each case with an immediate offset, withthe following exceptions.+o The offset is 4*(oooooooo), not a general 12-bit constant.+o If P=0 (post-indexing) is specified, W must be 1, and W being 1 just indicates that writeback is required, not that the memory system should be told that this is a user mode transfer. Instructions with P=0 and W=0 are reserved for future expansion.+o One or more coprocessor registers are loaded or stored. The coproces- sor determines how many and which registers are to be loaded or stored from the DDDD and N bits: all the ARM does is transfer a word to or -19- from the indicated address, then another to or from the indicated address + 4, then one to or from the indicated address + 8, etc., until the coprocessor tells it to stop.+o By convention, DDDD denotes the (first) coprocessor register to load or store and N denotes the length in some way, with N=1 indicating a "long" form. Coprocessor designers are free to ignore this...+o The assembler syntax is along the lines of: LLDDCC pp,,CCRRdd,,[[RRnn,,##2200]] ;;sshhoorrtt ffoorrmm ((NN==00)),, pprree--iinnddeexxeedd SSTTCCLL pp,,CCRRdd,,[[RRnn,,##--3322]]!! ;;lloonngg ffoorrmm ((NN==11)),, pprree--iinnddeexxeedd wwiitthh wwrriitteebbaacckk LLDDCCNNEELL pp,,CCRRdd,,[[RRnn]],,##--110000 ;;lloonngg ffoorrmm ((NN==11)),, ppoosstt--iinnddeexxeeddThe second form denotes, MRC, if L=1, MCR otherwise. MRC transfers acoprocessor register to an ARM register, MCR the other way around (the let-ters may seem the wrong way around, but remember that destinations are usu-ally written on the left in ARM assembler).MCR transfers the contents of ARM register Rd to the coprocessor. Thecoprocessor is free to do whatever it wants with it based on the values ofthe ooo, dddd, qqq and MMMM fields, though as usual there is a "standard"interpretation: write it to coprocessor register CRN, using operation ooo,with possible additional control provided by CRM and qqq. The assemblersyntax is: MMCCRR pp,,oo,,RRdd,,CCRRNN,,CCRRMM,,qqRd should not be R15 for an MCR instruction.MRC transfers a single word from the coprocessor and puts it in ARM regis-ter Rd. The coprocessor is free to generate this word in any way it likesusing the same fields as for MCR, with the standard interpretation that itcomes from CRN using operation ooo, with possible additional control pro-vided by CRM and qqq. The assembler syntax is: MMRRCC pp,,oo,,RRdd,,CCRRNN,,CCRRMM,,qqIf Rd is R15 for an MRC instruction, the top 4 bits of the word transferredare used to set the flags; the remaining 28 bits are discarded. (This isthe mechanism used e.g. by floating point comparison instructions.)LDC and STC take (n-1)S + 2N + bI cycles to execute, MRC takes 1S+bI+1Ccycles, and MCR takes 1S + (b+1)I + 1C cycles, where b is the number ofcycles that the coprocessor causes the ARM to busy-wait before it acceptsthe instruction: again, this is under the coprocessor's control, and n isthe number of words being transferred (Note this is under the coprocessor'scontrol, not the ARM's) -20-55..1111.. SSiinnggllee DDaattaa SSwwaapp ((AARRMM 33 aanndd llaatteerr iinncclluuddiinngg AARRMM 22aaSS))xxxxxxxx00000011 00BB0000nnnnnnnn dddddddd00000000 11000011mmmmmmmmTypical Assembler Syntax: SSWWPP RRdd,, RRmm,, [[RRnn]]These instructions load a word of memory (address given by register Rn) toa register Rd and store the contents of register Rm to the same address. Rmand Rd may be the same register, in which case the contents of this regis-ter and of the memory location are swapped. The load and store operationsare locked together by setting the LOCK pin high during the operation toindicate to the memory manager that they should be allowed to completewithout interruption.If the B bit is set, then a byte of memory is transferred, otherwise a wordis transferred.None of Rd, Rn, and Rm may be R15.This instruction takes 1S + 2N + 1I cycles to execute.55..1122.. SSttaattuuss RReeggiisstteerr ttrraannssffeerr ((AARRMM 66 aanndd llaatteerr))xxxxxxxx00000011 00ss1100aaaaaaaa 1111111100000000 00000000mmmmmmmm MMSSRR RReeggiisstteerr ffoorrmmxxxxxxxx00001111 00ss1100aaaaaaaa 11111111rrrrrrrr bbbbbbbbbbbbbbbb MMSSRR IImmmmeeddiiaattee ffoorrmmxxxxxxxx00000011 00ss000011111111 dddddddd00000000 0000000000000000 MMRRSSTypical Assembler Syntax: MMSSRR SSPPSSRR__aallll,, RRmm ;;aaaaaaaa == 11000011 MMSSRR CCPPSSRR__ffllgg,, ##&&FF00000000000000 ;;aaaaaaaa == 11000000 MMSSRRNNEE CCPPSSRR__ccttll,, RRmm ;;aaaaaaaa == 00000011 MMRRSS RRdd,, CCPPSSRRThe s bit, when set means access the SPSR of the current privileged mode,rather than the CPSR. This bit must only be set when executing the commandin a privileged mode.MSR is used for transfering a register or constant to a status register.The aaaa bits can take the following values: -21- Value Meaning 0001 Set the control bits of the PSR concerned. 1000 Set the flag bits of the PSR concerned. 1001 Set the control and flag bits of the PSR concerned (i.e. all the bits at present).Other values of aaaa are reserved for future expansion.In the register form, the source register is Rm. In the immediate form, thesource is #b, ROR #2r.R15 should not be specified as the source register of an MRS instruction.MRS is used for transfering processor status to a register.The d bits store the destination register number; Rd must not be R15.N.B. The instruction encodings correspond to the data processing instruc-tions with opcodes 10xx (i.e. the test instructions) and the S bit clear.These instruction always execute in 1-S cycle.55..1133.. UUnnddeeffiinneedd iinnssttrruuccttiioonnssxxxxxxxx00000011 yyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyy 11yyyy11yyyyyyyy AARRMM 22 oonnllyyxxxxxxxx001111yy yyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyy yyyyyy11yyyyyyyyThese instructions are currently undefined. On encountering an undefinedinstruction, the ARM switches to SVC mode (on ARM 3 and below) or Undefmode (on ARM 6 and above), puts the old value of R15 into R14_SVC (orR14_UND) and jumps to location, where it expects to find code to decode theundefined instruction and behave accordingly.Notes:+o These instructions are documented as "undefined" because they enter the undefined instruction processor trap in this way. Plenty of other instructions are undefined in the looser sense that nothing says what they do. For instance, bit patterns of the form: xxxx0000 01xxxxxx xxxxxxxx 1001xxxx are related to data processing instructions, multiplies, long multi- plies and SWPs, but are none of these because:* Data processing instructions with bit 25 = 0 and bit 4 = 1 have regis- ter controlled shifts, and so must have bit 7 = 0.* Multiply instructions have bits 23:22 = 00. -22-* Long multiply instructions have bits 23:22 = 1U.* SWPs have bit 24 = 1.What these instructions do simply isn't defined, whereas the ones listedabove are actually ddeeffiinneedd to enter the undefined instruction trap, atleast until some future use is found for them.+o Note that the "ARM2 only" undefined instructions include those that became SWP instructions on ARM3/ARM2as and later.66.. CCrreeddiittssThis document was originally written by Robin Watts, with considerable con-sultation with Steven Singer. It was then later updated by Mark Smith toinclude more information on ARMs later than 2.David Seal provided a huge list of corrections and amendments, and unwit-tingly provided the basis for the timing information in a posting tousenet.Various corrections were also submitted/posted by Olly Betts, Clive Jones,Alain Noullez, John Veness, Sverker Wiberg and Mark Wooding.Thanks to everyone that helped (and if I have missed you here, please letme know.)JJuusstt bbeeccaauussee II hhaavvee iinncclluuddeedd ppeeoopplleess aaddddrreesssseess hheerree,, pplleeaassee ddoo nnoott ttaakkeetthhiiss aass aann iinnvviittaattiioonn ttoo mmaaiill tthheemm aannyy qquueessttiioonnss yyoouu mmaayy hhaavvee!! Olly Betts olly@mantis.co.uk Paul Hankin pdh13@cus.cam.ac.uk Robert Harley robert@edu.caltech.cs Clive Jones Clive.Jones@armltd.co.uk Alain Noullez anoullez@zig.inria.fr David Seal <address withheld by request> Steven Singer s.singer@ph.surrey.ac.uk Mark Smith ee91mds2@brunel.ac.uk John Veness john@uk.ac.ox.drl Robin Watts Robin.Watts@comlab.ox.ac.uk Sverker Wiberg sverkerw@Student.csd.UU.SE Mark Wooding csuov@csv.warwick.ac.ukFor those not on the internet, messages can be sent by snail mail to: Robin Watts St Catherines College, Oxford, OX1 3UJ
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -