From e84a5c44e9bf2e9dc8b25818ec263c90530b4b32 Mon Sep 17 00:00:00 2001 From: lazymio Date: Wed, 5 Jan 2022 21:57:32 +0100 Subject: [PATCH] Add a test for arm mrc instruction (also for coproc) --- tests/unit/test_arm.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/unit/test_arm.c b/tests/unit/test_arm.c index b1eaebde..100f8b5c 100644 --- a/tests/unit/test_arm.c +++ b/tests/unit/test_arm.c @@ -457,6 +457,20 @@ static void test_arm_not_allow_privilege_escalation() OK(uc_close(uc)); } +static void test_arm_mrc() +{ + uc_engine *uc; + // mrc p15, #0, r0, c1, c1, #0 + char code[] = "\x11\x0F\x11\xEE"; + + uc_common_setup(&uc, UC_ARCH_ARM, UC_MODE_ARM, code, sizeof(code) - 1, + UC_CPU_ARM_MAX); + + OK(uc_emu_start(uc, code_start, code_start + sizeof(code) - 1, 0, 0)); + + OK(uc_close(uc)); +} + TEST_LIST = {{"test_arm_nop", test_arm_nop}, {"test_arm_thumb_sub", test_arm_thumb_sub}, {"test_armeb_sub", test_armeb_sub}, @@ -471,4 +485,5 @@ TEST_LIST = {{"test_arm_nop", test_arm_nop}, {"test_arm_thumb_smlabb", test_arm_thumb_smlabb}, {"test_arm_not_allow_privilege_escalation", test_arm_not_allow_privilege_escalation}, + {"test_arm_mrc", test_arm_mrc}, {NULL, NULL}}; \ No newline at end of file