On Tue, Nov 24, 2020 at 05:22:06PM +0100, Claudio Fontana wrote:
> Signed-off-by: Claudio Fontana <cfont...@suse.de>
> ---
[...]
> @@ -908,8 +909,12 @@ int main(int argc, char **argv)
>      }
>  
>      /* init tcg before creating CPUs and to get qemu_host_page_size */
> -    tcg_exec_init(0);
> +    {
> +        AccelClass *ac = accel_find("tcg");
>  
> +        g_assert(ac != NULL);
> +        ac->init_machine(NULL);

Most init_machine() methods will crash if you call them with a
NULL argument.

This looks like another reason for having a
  void accel_init(AccelState*)
function and a
  void (*init)(AccelState*)
method in AccelClass.

Then the whole code block above would be as trivial as:

  accel_init(current_accel());


> +    }
[...]
> 

-- 
Eduardo


Reply via email to