qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/9] Add risu_ppc.c file


From: G 3
Subject: Re: [Qemu-devel] [PATCH 2/9] Add risu_ppc.c file
Date: Tue, 25 Apr 2017 10:23:54 -0400


On Apr 25, 2017, at 4:36 AM, Peter Maydell wrote:

On 25 April 2017 at 04:18, G 3 <address@hidden> wrote:
Add the risu_ppc.c file. It defines several functions used by risu.

Signed-off-by: John Arbuckle <address@hidden>
---
 risu_ppc.c | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 risu_ppc.c

diff --git a/risu_ppc.c b/risu_ppc.c
new file mode 100644
index 0000000..70a1cf7
--- /dev/null
+++ b/risu_ppc.c
@@ -0,0 +1,41 @@
+/*****************************************************************
+ * File: risu_ppc.c
+ * Date: 3-27-2017
+ * Description: Implement advance_pc(), set_ucontext_paramreg(),
+ *              get_reginfo_paramreg(), get_risuop()
+ *****************************************************************/
+
+#include "risu.h"
+
+/* Advances the program counter register to the next instruction */
+void advance_pc(void *vuc)
+{
+    ucontext_t *uc = (ucontext_t*)vuc;
+    uc->uc_mcontext->ss.srr0 += 4;
+}
+
+/* Sets register r0 to the address of a memory block. */
+void set_ucontext_paramreg(void *vuc, uint64_t value)
+{
+    ucontext_t *uc = vuc;
+    uc->uc_mcontext->ss.r0 = value;
+}

This doesn't look like it matches the Linux PPC uc_mcontext
struct, which (like the ppc64 one) has a uc_mcontext.regs
field, not uc_mcontext->ss.

Risu is a Linux program, so all CPU backends must build
on Linux. It could perhaps be ported to other host OSes,
but we'd need to put in more infrastructure for dealing
with host OS differences, not just have "PPC works only
on OSX and the others work only on Linux".

thanks
-- PMM

What about having it work on both Mac OS X and Linux? A few #ifdef's should work.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]