Update samples to show the use of uc_ctl

This commit is contained in:
lazymio 2021-11-04 18:41:45 +01:00
parent 3aa2788586
commit 937445466b
No known key found for this signature in database
GPG Key ID: DFF27E34A47CB873
1 changed files with 9 additions and 1 deletions

View File

@ -264,13 +264,21 @@ static void test_thumb_mrs(void)
// 0xf3ef8014 - mrs r0, control // 0xf3ef8014 - mrs r0, control
// Initialize emulator in ARM mode // Initialize emulator in ARM mode
err = uc_open(UC_ARCH_ARM, UC_MODE_THUMB | UC_MODE_MCLASS, &uc); err = uc_open(UC_ARCH_ARM, UC_MODE_THUMB, &uc);
if (err) { if (err) {
printf("Failed on uc_open() with error returned: %u (%s)\n", err, printf("Failed on uc_open() with error returned: %u (%s)\n", err,
uc_strerror(err)); uc_strerror(err));
return; return;
} }
// Setup the cpu model.
err = uc_ctl_set_cpu_model(uc, UC_CPU_ARM_CORTEX_M33);
if (err) {
printf("Failed on uc_ctl() with error returned: %u (%s)\n", err,
uc_strerror(err));
return;
}
// map 2MB memory for this emulation // map 2MB memory for this emulation
uc_mem_map(uc, ADDRESS, 2 * 1024 * 1024, UC_PROT_ALL); uc_mem_map(uc, ADDRESS, 2 * 1024 * 1024, UC_PROT_ALL);