Revision 0e607a80 target-i386/machine.c

b/target-i386/machine.c
2 2
#include "hw/boards.h"
3 3
#include "hw/pc.h"
4 4
#include "hw/isa.h"
5
#include "host-utils.h"
6 5

  
7 6
#include "exec-all.h"
8 7
#include "kvm.h"
......
320 319
static void cpu_pre_save(void *opaque)
321 320
{
322 321
    CPUState *env = opaque;
323
    int i, bit;
322
    int i;
324 323

  
325 324
    cpu_synchronize_state(env);
326 325

  
......
336 335
#else
337 336
    env->fpregs_format_vmstate = 1;
338 337
#endif
339

  
340
    /* There can only be one pending IRQ set in the bitmap at a time, so try
341
       to find it and save its number instead (-1 for none). */
342
    env->pending_irq_vmstate = -1;
343
    for (i = 0; i < ARRAY_SIZE(env->interrupt_bitmap); i++) {
344
        if (env->interrupt_bitmap[i]) {
345
            bit = ctz64(env->interrupt_bitmap[i]);
346
            env->pending_irq_vmstate = i * 64 + bit;
347
            break;
348
        }
349
    }
350 338
}
351 339

  
352 340
static int cpu_pre_load(void *opaque)
......
375 363
    for (i = 0; i < 4; i++)
376 364
        hw_breakpoint_insert(env, i);
377 365

  
378
    if (version_id >= 9) {
379
        memset(&env->interrupt_bitmap, 0, sizeof(env->interrupt_bitmap));
380
        if (env->pending_irq_vmstate >= 0) {
381
            env->interrupt_bitmap[env->pending_irq_vmstate / 64] |=
382
                (uint64_t)1 << (env->pending_irq_vmstate % 64);
383
        }
384
    }
385

  
386 366
    tlb_flush(env, 1);
387 367
    return 0;
388 368
}
......
465 445
        VMSTATE_UINT64_V(mtrr_deftype, CPUState, 8),
466 446
        VMSTATE_MTRR_VARS(mtrr_var, CPUState, 8, 8),
467 447
        /* KVM-related states */
468
        VMSTATE_INT32_V(pending_irq_vmstate, CPUState, 9),
448
        VMSTATE_INT32_V(interrupt_injected, CPUState, 9),
469 449
        VMSTATE_UINT32_V(mp_state, CPUState, 9),
470 450
        VMSTATE_UINT64_V(tsc, CPUState, 9),
471 451
        /* MCE */

Also available in: Unified diff