diff --git a/crates/aarch64/src/lib.rs b/crates/aarch64/src/lib.rs index 11f7867..ac4efae 100644 --- a/crates/aarch64/src/lib.rs +++ b/crates/aarch64/src/lib.rs @@ -33,6 +33,7 @@ const CARRY_FLAG_BIT: u32 = 29; const OVERFLOW_FLAG_BIT: u32 = 28; const ROOT_SPEC: &str = "AARCH64.slaspec"; const SUPERVISOR_USER_OP: &str = "CallSupervisor"; +const CLEAR_EXCLUSIVE_LOCAL_USER_OP: &str = "ClearExclusiveLocal"; const EXCLUSIVE_MONITOR_PASS_USER_OP: &str = "ExclusiveMonitorPass"; const EXCLUSIVE_MONITORS_STATUS_USER_OP: &str = "ExclusiveMonitorsStatus"; const DATA_MEMORY_BARRIER_USER_OP: &str = "DataMemoryBarrier"; @@ -1085,6 +1086,9 @@ fn lower_control_pcode( SUPERVISOR_USER_OP => Some(Operation::SupervisorCall { immediate: lower_value(language, left)?, }), + CLEAR_EXCLUSIVE_LOCAL_USER_OP | DATA_MEMORY_BARRIER_USER_OP => { + Some(Operation::MemoryBarrier) + } EXCLUSIVE_MONITOR_PASS_USER_OP => Some(Operation::ExclusiveMonitorPass { destination: lower_place(language, output)?, address: lower_value(language, left)?, @@ -1093,7 +1097,6 @@ fn lower_control_pcode( EXCLUSIVE_MONITORS_STATUS_USER_OP => Some(Operation::ExclusiveMonitorsStatus { destination: lower_place(language, output)?, }), - DATA_MEMORY_BARRIER_USER_OP => Some(Operation::MemoryBarrier), NEON_COUNT_USER_OP => Some(Operation::NeonCount { destination: lower_place(language, output)?, source: lower_value(language, left)?, @@ -3823,6 +3826,20 @@ mod tests { assert_eq!(state.vector(1), Some(u128::from((-9.5_f64).to_bits()))); } + #[test] + fn executes_clear_exclusive_as_a_single_threaded_no_op() { + const CODE: &[u8] = &[ + 0x5f, 0x3f, 0x03, 0xd5, // clrex + ]; + let mut memory = executable_memory(CODE); + let mut state = Aarch64State::new(CODE_ADDRESS, GuestAddress::new(0x8000)); + let mut interpreter = Interpreter::new().unwrap(); + + interpreter.step(&mut state, &mut memory).unwrap(); + + assert_eq!(state.pc(), CODE_ADDRESS.checked_add(4).unwrap()); + } + #[test] fn executes_cpython_scalar_fused_multiply_add() { const CODE: &[u8] = &[