Posts

Showing posts from December, 2011

Entering different modes in ARM architecture

Image
In ARM srchitecture, there are several processor modes provided for safty issues. Except user mode, other six modes are called "priviledge mode". And except user mode and system mode, other fives are also called  "exception mode"[8]. This is shown in Table 3-1.                                     User mode: Application usually runs in the user mode (except system mode since ARMv4). In user mode, the memory access is restricted. For example, you are not allowed to access the memory where OS kernel  is stored[7]. And you also cannot write CPSR register. Hardware devices cannot be read directly in user mode. So here when you start up the system(i.e. 2440init.S) as surpervisor mode and go to user mode, you can only enter other modes by exceptions because we cannot change the content of CPSR in user mode(see figure 2-6). For example, you can use SWI to enter supervisor mode. An inte...

Difference between instructions, pseudo-instructions and assembly directives

Instruction:  No need to say more. It is a kind of mnemonic which can be mapped into binary code directly by translating opcode and operand . Pseudo-instruction:  Pseudo-instruction is not a real instruction related to ISA(Instruction Set Architecture) . It exists in assembler which can produce corresponding real instructions after assembling . For example, LDR R0, = immediate is a pseudo-instruction. It may produce one MOV or several instructions which depends on the size of the immediate. PS: LDR R0, [indirect address] is not a pseudo-instruction. It is a real instruction in ISA of ARM . Pseudo instructions are essentially pre-defined macros, so you can implement your own pseudo instructions if you want. Directive:  Also not a real instruction, and only exists in assembler. But after assembling, it does not produce any code. It just indicates the assembler how to configure the processor, for example: changing modes (ARM or Thumb-2) , code location (AREA NAME...