qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH-for-8.0 1/7] hw/mips/bootloader: Handle buffers as opaque arr


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH-for-8.0 1/7] hw/mips/bootloader: Handle buffers as opaque arrays
Date: Sun, 11 Dec 2022 21:29:57 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.1

On 11/12/22 01:16, BALATON Zoltan wrote:
On Sat, 10 Dec 2022, Philippe Mathieu-Daudé wrote:
It is irrelevant to the API what the buffers to fill are made of.
In particular, some MIPS ISA have 16-bit wide instructions.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/mips/bootloader.c         | 55 +++++++++++++++++++++---------------
hw/mips/malta.c              | 19 +++++++------
include/hw/mips/bootloader.h | 10 +++----
3 files changed, 48 insertions(+), 36 deletions(-)

diff --git a/hw/mips/bootloader.c b/hw/mips/bootloader.c
index f5f42f2bf2..fc14eb0894 100644
--- a/hw/mips/bootloader.c
+++ b/hw/mips/bootloader.c
@@ -55,16 +55,20 @@ static bool bootcpu_supports_isa(uint64_t isa_mask)
}

/* Base types */
-static void bl_gen_nop(uint32_t **p)
+static void bl_gen_nop(void **ptr)
{
-    stl_p(*p, 0);
-    *p = *p + 1;
+    uint32_t *p = (uint32_t *)*ptr;

Do you need to cast void * ? I thought in C that's not necessary but maybe I'm missing why it's needed here.

No, you are right.

+
+    stl_p(p, 0);
+    p++;
+    *ptr = p;

Do you need a cast here though? (You could also combine the ++ either in stl_p(p++, 0) or *ptr = ++p but not sure you want to.)

If the compiler were unhappy it would have complained :)




reply via email to

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