@@ -151,6 +151,9 @@ struct thread {
int (*getspr)(struct thread *, int, uint64_t *);
int (*putspr)(struct thread *, int, uint64_t);
+ int (*getfpr)(struct thread *, int, uint64_t *);
+ int (*putfpr)(struct thread *, int, uint64_t);
+
int (*getmsr)(struct thread *, uint64_t *);
int (*putmsr)(struct thread *, uint64_t);
@@ -946,6 +946,24 @@ int thread_getxer(struct pdbg_target *thread, uint64_t *value);
*/
int thread_putxer(struct pdbg_target *thread, uint64_t value);
+/**
+ * @brief Set a FPR on a thread
+ * @param[in] thread the thread target to operate on
+ * @param[in] fpr the FPR number to set
+ * @param[in] value value to set FPR to
+ * @return 0 on success, -1 otherwise
+ */
+int thread_putfpr(struct pdbg_target *thread, int fpr, uint64_t value);
+
+/**
+ * @brief Get a FPR on a thread
+ * @param[in] thread the thread target to operate on
+ * @param[in] fpr the FPR number to get
+ * @param[in] value value of the given FPR
+ * @return 0 on success, -1 otherwise
+ */
+int thread_getfpr(struct pdbg_target *thread, int fpr, uint64_t *value);
+
/**
* @brief Get the value of all interesting registers on a thread
* @param[in] target the thread target to operate on
@@ -361,6 +361,44 @@ int thread_putspr(struct pdbg_target *target, int spr, uint64_t value)
return thread->putspr(thread, spr, value);
}
+int thread_getfpr(struct pdbg_target *target, int fpr, uint64_t *value)
+{
+ struct thread *thread;
+
+ assert(pdbg_target_is_class(target, "thread"));
+
+ if (pdbg_target_status(target) != PDBG_TARGET_ENABLED)
+ return -1;
+
+ thread = target_to_thread(target);
+
+ if (!thread->getfpr) {
+ PR_ERROR("getfpr() not imeplemented for the target\n");
+ return -1;
+ }
+
+ return thread->getfpr(thread, fpr, value);
+}
+
+int thread_putfpr(struct pdbg_target *target, int fpr, uint64_t value)
+{
+ struct thread *thread;
+
+ assert(pdbg_target_is_class(target, "thread"));
+
+ if (pdbg_target_status(target) != PDBG_TARGET_ENABLED)
+ return -1;
+
+ thread = target_to_thread(target);
+
+ if (!thread->putfpr) {
+ PR_ERROR("putfpr() not imeplemented for the target\n");
+ return -1;
+ }
+
+ return thread->putfpr(thread, fpr, value);
+}
+
int thread_getmsr(struct pdbg_target *target, uint64_t *value)
{
struct thread *thread;
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> --- libpdbg/hwunit.h | 3 +++ libpdbg/libpdbg.h | 18 ++++++++++++++++++ libpdbg/thread.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+)