qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Qemu-ppc] [PATCH 1/4] spapr: Add rtas_st_buffer utilit


From: Alexander Graf
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 1/4] spapr: Add rtas_st_buffer utility function
Date: Tue, 24 Jun 2014 13:51:43 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0


On 24.06.14 02:22, Sam Bobroff wrote:
Add a function to write lengh + data into a buffer as required for the
emulation of the RTAS ibm,get-system-parameter call.

If the destination is smaller than the source, the write is truncated
and success is returned. This matches the behaviour of pHyp.

This will be used in following patches.

Signed-off-by: Sam Bobroff <address@hidden>
---
  include/hw/ppc/spapr.h | 17 +++++++++++++++++
  1 file changed, 17 insertions(+)

diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 08c301f..39a7764 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -373,6 +373,23 @@ static inline void rtas_st(target_ulong phys, int n, 
uint32_t val)
      stl_be_phys(&address_space_memory, ppc64_phys_to_real(phys + 4*n), val);
  }
+
+static inline void rtas_st_buffer(target_ulong phys, target_ulong phys_len,
+                                  uint8_t *buffer, uint16_t buffer_len)
+{
+    uint16_t i;
+
+    if (phys_len < 2) {
+        return;
+    }
+    stw_be_phys(&address_space_memory,
+                ppc64_phys_to_real(phys), buffer_len);
+    for (i = 0; i < MIN(buffer_len, phys_len - 2); i++) {
+        stb_phys(&address_space_memory,
+                 ppc64_phys_to_real(phys + 2 + i), buffer[i]);
+    }

cpu_physical_memory_write()?


Alex




reply via email to

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