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é <phi...@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 :)