vl: convert -tb-size to qemu_strtoul

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2017-07-03 17:44:13 +02:00
parent b3f6ea7e55
commit 8b3ae692b8
3 changed files with 5 additions and 5 deletions

View File

@ -28,7 +28,7 @@
#include "sysemu/sysemu.h" #include "sysemu/sysemu.h"
#include "qom/object.h" #include "qom/object.h"
int tcg_tb_size; unsigned long tcg_tb_size;
static bool tcg_allowed = true; static bool tcg_allowed = true;
static int tcg_init(MachineState *ms) static int tcg_init(MachineState *ms)

View File

@ -63,7 +63,7 @@ typedef struct AccelClass {
#define ACCEL_GET_CLASS(obj) \ #define ACCEL_GET_CLASS(obj) \
OBJECT_GET_CLASS(AccelClass, (obj), TYPE_ACCEL) OBJECT_GET_CLASS(AccelClass, (obj), TYPE_ACCEL)
extern int tcg_tb_size; extern unsigned long tcg_tb_size;
void configure_accelerator(MachineState *ms); void configure_accelerator(MachineState *ms);
/* Register accelerator specific global properties */ /* Register accelerator specific global properties */

6
vl.c
View File

@ -3933,9 +3933,9 @@ int main(int argc, char **argv, char **envp)
configure_rtc(opts); configure_rtc(opts);
break; break;
case QEMU_OPTION_tb_size: case QEMU_OPTION_tb_size:
tcg_tb_size = strtol(optarg, NULL, 0); if (qemu_strtoul(optarg, NULL, 0, &tcg_tb_size) < 0) {
if (tcg_tb_size < 0) { error_report("Invalid argument to -tb-size");
tcg_tb_size = 0; exit(1);
} }
break; break;
case QEMU_OPTION_icount: case QEMU_OPTION_icount: