Pseudo-directives, which are "pseudo" instructions, are for "true" instructions. The real instructions are the common instructions, such as the arm's ldr,bic,msr and so on, which are the real instructions in the ARM architecture, and you find the corresponding meanings in the arm assembly instruction set. and the pseudo-instruction is written to the assembler, the assembler can see the pseudo-directive specific expression of what the meaning, and then translate it into a real instruction or the corresponding processing. Pseudo instruction Ldr syntax and meaning: Http://blog.csdn.net/lihaoweiV/archive/2010/11/24/6033003.aspx Another is the LDR pseudo-directive, although the LDR pseudo-directive and arm's LDR directive are very similar, but the function is not quite the same. LDR Pseudo-directives can be preceded by an immediate number = to indicate that an address is written to a register, such as: Ldr R0, =0x12345678 In this way, the 0x12345678 address is written to the r0. Therefore, LDR Pseudo-instructions and MOV are more similar. Only the immediate number behind the MOV instruction is limited, this immediate number, can have to be a 8-bit binary number, that is, a value within the 0x00-0xff, after an even number of right to get, this is the legitimate data, and LDR pseudo-directive does not have this restriction. Then why is the operand of the LDR pseudo-instruction Unlimited, that is because it is a pseudo-directive, written out of the pseudo-instructions, will eventually be interpreted by the compiler into a real, legitimate instructions, and generally the corresponding MOV instructions. In this case, to write the assembler, the use of MOV instructions is more troublesome, because some simple data is easier to see, some data is not easy to see whether it is legitimate data. So, to this, LDR pseudo-instructions appear, is to solve this problem, you just rest assured with the LDR pseudo-instructions, do not care about the operand, and write the LDR pseudo-instructions, the compiler will help you translate into the corresponding real assembly instructions. And about how the compiler will translate these LDR pseudo-directives into a real assembly instructions, my understanding is that it will automatically calculate the corresponding operand, whether it is a legitimate MOV operand, if it is, will be the LDR pseudo-instructions translated into MOV instructions, otherwise, in other ways to deal with, I observed, One way is to apply a single 4-byte space to hold the operand, and then implement it with LDR instructions. In Uboot, after the final make is finished, the U-boot is produced, Pass: Arm-linux-objdump–d u-boot > Dump_u-boot.txt The corresponding assembly code can be exported to the TXT file, where the pseudo-directive can be found: Ldr R0, =0x53000000 The corresponding, real assembly code: 33d00068: e3a00453 mov r0, #1392508928 ; 0x53000000 So it was translated into MOV instructions. And after my attempt, deliberately changed 0x53000000 to 0x53000010, the corresponding production of the assembly code for: 33d00068: e59f0408 Ldr r0, [pc, #1032] ; 33d00478 <fiq+0x58>
... 33d00478: 53000010 . Word 0x53000010
It can be seen that because 0x53000010 is not a valid MOV operand, unable to find the right 0x00-0xff to go through an even number of cycles to the right, so can only be replaced here in this way, that is, in addition to the application of a word space to store this value: 33d00478: 53000010 . Word 0x53000010 Then by calculating the relative current PC offset, get the address, with LDR instructions to remove the value of the address, that is, 0x53000010, to r0, compared to the MOV instructions, to more complex, but also consumes a word space. Correspondingly, the other way, the personal understanding, seems can also through the mvn instruction to realize, the concrete detail, waits for further exploration. |