hw/sparc/leon3: Trivial cleanups around write_bootloader()
cover hw/sparc/leon3: Trivial cleanups around write_bootloader()
Have write_bootloader() take a void* and remove unused 'env' arg.
Philippe Mathieu-Daudé (2):
hw/sparc/leon3: Remove unused 'env' argument of write_bootloader() hw/sparc/leon3: Have write_bootloader() take a void pointer argument
hw/sparc/leon3.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
Signature · 1 line
2.41.0
PATCH 1/2 hw/sparc/leon3: Remove unused 'env' argument of write_bootloader()
'CPUSPARCState *env' argument is unused, remove it.
--- hw/sparc/leon3.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
hw/sparc/leon3.c +2 -3
@@ -94,8 +94,7 @@ static uint32_t *gen_store_u32(uint32_t *code, hwaddr addr, uint32_t val)* state (eg: initialized by the bootloader). This little code reproduces * this behavior. */ -static void write_bootloader (CPUSPARCState *env,uint8_t *base, -hwaddr kernel_addr) +static void write_bootloader (uint8_t *base,hwaddr kernel_addr) {uint32_t *p = (uint32_t *) base;
@@ -342,7 +341,7 @@ static void leon3_generic_hw_init(MachineState *machine)uint8_t *bootloader_entry; bootloader_entry =memory_region_get_ram_ptr (prom); -write_bootloader (env, bootloader_entry, entry); +write_bootloader (bootloader_entry, entry); env->pc =LEON3_PROM_OFFSET ; env->npc =LEON3_PROM_OFFSET +4 ; reset_info->entry =LEON3_PROM_OFFSET ;
Signature · 1 line
2.41.0
Re: [PATCH 1/2] hw/sparc/leon3: Remove unused 'env' argument of write_bootloader()
Quoted 7 lines · Philippe Mathieu-Daudé
'CPUSPARCState *env' argument is unused, remove it.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/sparc/leon3.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
thanks
-- PMM
PATCH 2/2 hw/sparc/leon3: Have write_bootloader() take a void pointer argument
In reply to Philippe Mathieu-DaudéDirectly use the void pointer argument returned
by memory_region_get_ram_ptr().
--- hw/sparc/leon3.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
hw/sparc/leon3.c +3 -6
@@ -94,9 +94,9 @@ static uint32_t *gen_store_u32(uint32_t *code, hwaddr addr, uint32_t val)* state (eg: initialized by the bootloader). This little code reproduces * this behavior. */ -static void write_bootloader (uint8_t *base,hwaddr kernel_addr) +static void write_bootloader (void *ptr,hwaddr kernel_addr) { -uint32_t *p = (uint32_t *) base; +uint32_t *p = (uint32_t *) ptr;/* Initialize the UARTs */ /* *UART_CONTROL = UART_RECEIVE_ENABLE | UART_TRANSMIT_ENABLE; */
@@ -338,10 +338,7 @@ static void leon3_generic_hw_init(MachineState *machine)* the machine in an initialized state through a little * bootloader. */ -uint8_t *bootloader_entry; - - bootloader_entry =memory_region_get_ram_ptr (prom); -write_bootloader (bootloader_entry, entry); +write_bootloader (memory_region_get_ram_ptr (prom), entry); env->pc =LEON3_PROM_OFFSET ; env->npc =LEON3_PROM_OFFSET +4 ; reset_info->entry =LEON3_PROM_OFFSET ;
Signature · 1 line
2.41.0
Re: [PATCH 2/2] hw/sparc/leon3: Have write_bootloader() take a void pointer argument
Quoted 14 lines · Philippe Mathieu-Daudé
Directly use the void pointer argument returned
bymemory_region_get_ram_ptr().Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/sparc/leon3.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)hw/sparc/leon3.c +0
-0
hw/sparc/leon3.c static uint32_t *gen_store_u32(uint32_t *code, hwaddr addr, uint32_t val) · line 99
Quoted 8 lines
hw/sparc/leon3.c +2
-2@@ -94,9 +94,9 @@ static uint32_t *gen_store_u32(uint32_t *code, hwaddr addr, uint32_t val)* state (eg: initialized by the bootloader). This little code reproduces * this behavior. */ -static void write_bootloader (uint8_t *base,hwaddr kernel_addr) +static void write_bootloader (void *ptr,hwaddr kernel_addr) { -uint32_t *p = (uint32_t *) base; +uint32_t *p = (uint32_t *) ptr;
I don't think you need the cast any more now ptr is void*. (If you do, then our coding style doesn't put a space after the cast.)
Quoted 6 lines
hw/sparc/leon3.c +0
-0/* Initialize the UARTs */ /* *UART_CONTROL = UART_RECEIVE_ENABLE | UART_TRANSMIT_ENABLE; */ @@ -338,10 +338,7 @@ static void leon3_generic_hw_init(MachineState *machine)* the machine in an initialized state through a little * bootloader.
hw/sparc/leon3.c static void leon3_generic_hw_init(MachineState *machine)
Quoted 10 lines
hw/sparc/leon3.c +1
-5*/ -uint8_t *bootloader_entry; - - bootloader_entry =memory_region_get_ram_ptr (prom); -write_bootloader (bootloader_entry, entry); +write_bootloader (memory_region_get_ram_ptr (prom), entry); env->pc =LEON3_PROM_OFFSET ; env->npc =LEON3_PROM_OFFSET +4 ; reset_info->entry =LEON3_PROM_OFFSET ; --
Either way,
thanks
-- PMM
Re: [PATCH 2/2] hw/sparc/leon3: Have write_bootloader() take a void pointer argument
Quoted 11 lines · Peter Maydell
Quoted 8 lines · Philippe Mathieu-Daudé
Directly use the void pointer argument returned
bymemory_region_get_ram_ptr().Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/sparc/leon3.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
Quoted 9 lines
hw/sparc/leon3.c static uint32_t *gen_store_u32(uint32_t *code, hwaddr addr, uint32_t val) · line 99
Quoted 5 lines
hw/sparc/leon3.c +2
-2-static void write_bootloader (uint8_t *base,hwaddr kernel_addr) +static void write_bootloader (void *ptr,hwaddr kernel_addr) { -uint32_t *p = (uint32_t *) base; +uint32_t *p = (uint32_t *) ptr;I don't think you need the cast any more now ptr is void*. (If you do, then our coding style doesn't put a space after the cast.)
Right, updated.
Quoted 2 lines
Either way,
Reviewed-by Peter Maydell <[email protected]>
Thank you!
Quoted 5 lines · Philippe Mathieu-Daudé
Have
write_bootloader()take a void* and remove unused 'env' arg.Philippe Mathieu-Daudé (2):
hw/sparc/leon3: Remove unused 'env' argument ofwrite_bootloader()hw/sparc/leon3: Havewrite_bootloader()take a void pointer argument
Series queued.