target-arm: Implement AArch64 CurrentEL sysreg
Implement the CurrentEL sysreg. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
This commit is contained in:
		
							parent
							
								
									7da845b0f4
								
							
						
					
					
						commit
						0eef9d9833
					
				@ -731,7 +731,8 @@ static inline uint64_t cpreg_to_kvm_id(uint32_t cpregid)
 | 
				
			|||||||
#define ARM_CP_NOP (ARM_CP_SPECIAL | (1 << 8))
 | 
					#define ARM_CP_NOP (ARM_CP_SPECIAL | (1 << 8))
 | 
				
			||||||
#define ARM_CP_WFI (ARM_CP_SPECIAL | (2 << 8))
 | 
					#define ARM_CP_WFI (ARM_CP_SPECIAL | (2 << 8))
 | 
				
			||||||
#define ARM_CP_NZCV (ARM_CP_SPECIAL | (3 << 8))
 | 
					#define ARM_CP_NZCV (ARM_CP_SPECIAL | (3 << 8))
 | 
				
			||||||
#define ARM_LAST_SPECIAL ARM_CP_NZCV
 | 
					#define ARM_CP_CURRENTEL (ARM_CP_SPECIAL | (4 << 8))
 | 
				
			||||||
 | 
					#define ARM_LAST_SPECIAL ARM_CP_CURRENTEL
 | 
				
			||||||
/* Used only as a terminator for ARMCPRegInfo lists */
 | 
					/* Used only as a terminator for ARMCPRegInfo lists */
 | 
				
			||||||
#define ARM_CP_SENTINEL 0xffff
 | 
					#define ARM_CP_SENTINEL 0xffff
 | 
				
			||||||
/* Mask of only the flag bits in a type field */
 | 
					/* Mask of only the flag bits in a type field */
 | 
				
			||||||
 | 
				
			|||||||
@ -1533,6 +1533,9 @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
 | 
				
			|||||||
      .opc0 = 3, .opc1 = 3, .opc2 = 7, .crn = 0, .crm = 0,
 | 
					      .opc0 = 3, .opc1 = 3, .opc2 = 7, .crn = 0, .crm = 0,
 | 
				
			||||||
      .access = PL0_R, .type = ARM_CP_CONST,
 | 
					      .access = PL0_R, .type = ARM_CP_CONST,
 | 
				
			||||||
      .resetvalue = 0x10 },
 | 
					      .resetvalue = 0x10 },
 | 
				
			||||||
 | 
					    { .name = "CURRENTEL", .state = ARM_CP_STATE_AA64,
 | 
				
			||||||
 | 
					      .opc0 = 3, .opc1 = 0, .opc2 = 2, .crn = 4, .crm = 2,
 | 
				
			||||||
 | 
					      .access = PL1_R, .type = ARM_CP_CURRENTEL },
 | 
				
			||||||
    REGINFO_SENTINEL
 | 
					    REGINFO_SENTINEL
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1231,6 +1231,13 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread,
 | 
				
			|||||||
            gen_set_nzcv(tcg_rt);
 | 
					            gen_set_nzcv(tcg_rt);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					    case ARM_CP_CURRENTEL:
 | 
				
			||||||
 | 
					        /* Reads as current EL value from pstate, which is
 | 
				
			||||||
 | 
					         * guaranteed to be constant by the tb flags.
 | 
				
			||||||
 | 
					         */
 | 
				
			||||||
 | 
					        tcg_rt = cpu_reg(s, rt);
 | 
				
			||||||
 | 
					        tcg_gen_movi_i64(tcg_rt, s->current_pl << 2);
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user