@@ -382,14 +382,14 @@ static void handle_sbi_ecall(hart_t *hart)
382
382
hart -> error = ERR_NONE ;
383
383
}
384
384
385
- #define MAPPER_SIZE 4
385
+ #define N_MAPPERS 4
386
386
387
387
struct mapper {
388
388
char * addr ;
389
389
uint32_t size ;
390
390
};
391
391
392
- static struct mapper mapper [MAPPER_SIZE ] = {0 };
392
+ static struct mapper mapper [N_MAPPERS ] = {0 };
393
393
static int map_index = 0 ;
394
394
static void unmap_files (void )
395
395
{
@@ -498,7 +498,7 @@ static void handle_options(int argc,
498
498
499
499
500
500
#define INIT_HART (hart , emu , id ) \
501
- ({ \
501
+ do { \
502
502
hart->priv = emu; \
503
503
hart->mhartid = id; \
504
504
hart->mem_fetch = mem_fetch; \
@@ -508,7 +508,7 @@ static void handle_options(int argc,
508
508
hart->s_mode = true; \
509
509
hart->hsm_status = SBI_HSM_STATE_STOPPED; \
510
510
vm_init(hart); \
511
- })
511
+ } while (0 )
512
512
513
513
static int semu_start (int argc , char * * argv )
514
514
{
@@ -558,10 +558,11 @@ static int semu_start(int argc, char **argv)
558
558
/* Hook for unmapping files */
559
559
atexit (unmap_files );
560
560
561
- /* Set up RISC-V hart */
562
- vm_t vm ;
563
- vm .n_hart = hart_count ;
564
- vm .hart = malloc (sizeof (hart_t * ) * vm .n_hart );
561
+ /* Set up RISC-V harts */
562
+ vm_t vm = {
563
+ .n_hart = hart_count ,
564
+ .hart = malloc (sizeof (hart_t * ) * vm .n_hart ),
565
+ };
565
566
for (uint32_t i = 0 ; i < vm .n_hart ; i ++ ) {
566
567
hart_t * newhart = malloc (sizeof (hart_t ));
567
568
INIT_HART (newhart , & emu , i );
0 commit comments