Skip to content

Commit

Permalink
Implement UC_ARM64_REG_WSP
Browse files Browse the repository at this point in the history
  • Loading branch information
wtdcode committed Oct 2, 2024
1 parent d30ba77 commit 05e29b4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions qemu/target/arm/unicorn_aarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ uc_err reg_read(void *_env, int mode, unsigned int regid, void *value,
CHECK_REG_TYPE(uint64_t);
*(uint64_t *)value = env->pc;
break;
case UC_ARM64_REG_WSP:
CHECK_REG_TYPE(uint32_t);
*(uint32_t *)value = READ_DWORD(env->xregs[31]);
break;
case UC_ARM64_REG_SP:
CHECK_REG_TYPE(uint64_t);
*(uint64_t *)value = env->xregs[31];
Expand Down Expand Up @@ -263,6 +267,14 @@ uc_err reg_read(void *_env, int mode, unsigned int regid, void *value,
CHECK_REG_TYPE(uint32_t);
*(uint32_t *)value = vfp_get_fpsr(env);
break;
case UC_ARM64_REG_XZR:
CHECK_REG_TYPE(uint64_t);
*(uint64_t *)value = 0;
break;
case UC_ARM64_REG_WZR:
CHECK_REG_TYPE(uint32_t);
*(uint32_t *)value = 0;
break;
}
}

Expand Down Expand Up @@ -356,6 +368,10 @@ uc_err reg_write(void *_env, int mode, unsigned int regid, const void *value,
env->pc = *(uint64_t *)value;
*setpc = 1;
break;
case UC_ARM64_REG_WSP:
CHECK_REG_TYPE(uint32_t);
WRITE_DWORD(env->xregs[31], (*(uint32_t *)value));
break;
case UC_ARM64_REG_SP:
CHECK_REG_TYPE(uint64_t);
env->xregs[31] = *(uint64_t *)value;
Expand Down Expand Up @@ -397,6 +413,14 @@ uc_err reg_write(void *_env, int mode, unsigned int regid, const void *value,
CHECK_REG_TYPE(uint32_t);
vfp_set_fpsr(env, *(uint32_t *)value);
break;
case UC_ARM64_REG_XZR:
CHECK_REG_TYPE(uint64_t);
// no-ops actually
break;
case UC_ARM64_REG_WZR:
CHECK_REG_TYPE(uint32_t);
// no-ops actually
break;
}
}

Expand Down

0 comments on commit 05e29b4

Please sign in to comment.