mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
spapr: Add rtas_st_buffer utility function
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 <sam.bobroff@au1.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
6026db4501
commit
ce3fa1eca2
1 changed files with 13 additions and 0 deletions
|
@ -412,6 +412,19 @@ 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)
|
||||
{
|
||||
if (phys_len < 2) {
|
||||
return;
|
||||
}
|
||||
stw_be_phys(&address_space_memory,
|
||||
ppc64_phys_to_real(phys), buffer_len);
|
||||
cpu_physical_memory_write(ppc64_phys_to_real(phys + 2),
|
||||
buffer, MIN(buffer_len, phys_len - 2));
|
||||
}
|
||||
|
||||
typedef void (*spapr_rtas_fn)(PowerPCCPU *cpu, sPAPREnvironment *spapr,
|
||||
uint32_t token,
|
||||
uint32_t nargs, target_ulong args,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue