1. 程式人生 > >嵌入式 ARM中CP的操作指令MCR/MRC詳解

嵌入式 ARM中CP的操作指令MCR/MRC詳解

1. MCR, 將ARM中normal register的值傳向CP register.

format: mcr cpx, op1, src_reg, dst_reg1, dst_reg2, op2

cpx: Integer in the range 0~15 defining coprocessor.

op1: Integer in the range 0~7 selecting different coprocessorfunctions

src_reg: Integer in the range 0~15 defining GP register in theprocessor core containing the value to read or write

dst_reg1: Integer in the range 0~15 defining the targetcoprocessor register.

dst_reg1: integer in the range 0~15 selecting across banks of 16coprocessor registers

op2: integer in the range 0~7 selecting different coprocessorfunctions.

e.g. mcr p15, 0, r0, c7, c7, 0

explain: 此操作將r0中的值傳入cp15的c7中

2. MRC, 將ARM中CP register的值傳向normal register 中。

format: mrc cpx, op1, dst_reg, src_reg1, src_reg2, op2

e.g. mrc p15, 0, r0, c1, c0, 0

explain: 此操作將p15中c1和c0的值存入到r0中