Revision 02ba45c5 vl.c

b/vl.c
787 787
static void host_alarm_handler(int host_signum)
788 788
#endif
789 789
{
790
#if 0
791
#define DISP_FREQ 1000
792
    {
793
        static int64_t delta_min = INT64_MAX;
794
        static int64_t delta_max, delta_cum, last_clock, delta, ti;
795
        static int count;
796
        ti = qemu_get_clock(vm_clock);
797
        if (last_clock != 0) {
798
            delta = ti - last_clock;
799
            if (delta < delta_min)
800
                delta_min = delta;
801
            if (delta > delta_max)
802
                delta_max = delta;
803
            delta_cum += delta;
804
            if (++count == DISP_FREQ) {
805
                printf("timer: min=%lld us max=%lld us avg=%lld us avg_freq=%0.3f Hz\n",
806
                       muldiv64(delta_min, 1000000, ticks_per_sec),
807
                       muldiv64(delta_max, 1000000, ticks_per_sec),
808
                       muldiv64(delta_cum, 1000000 / DISP_FREQ, ticks_per_sec),
809
                       (double)ticks_per_sec / ((double)delta_cum / DISP_FREQ));
810
                count = 0;
811
                delta_min = INT64_MAX;
812
                delta_max = 0;
813
                delta_cum = 0;
814
            }
815
        }
816
        last_clock = ti;
817
    }
818
#endif
790 819
    if (qemu_timer_expired(active_timers[QEMU_TIMER_VIRTUAL],
791 820
                           qemu_get_clock(vm_clock)) ||
792 821
        qemu_timer_expired(active_timers[QEMU_TIMER_REALTIME],
......
892 921
            setitimer(ITIMER_REAL, &itv, NULL);
893 922

  
894 923
            /* use the RTC */
895
            sigaction(SIGIO, &act, NULL);
924
            sigaction(SIGRTMIN, &act, NULL);
925
            fcntl(rtc_fd, F_SETSIG, SIGRTMIN);
896 926
            fcntl(rtc_fd, F_SETFL, O_ASYNC);
897 927
            fcntl(rtc_fd, F_SETOWN, getpid());
898 928
        } else {
......
1184 1214

  
1185 1215
/* init terminal so that we can grab keys */
1186 1216
static struct termios oldtty;
1217
static int old_fd0_flags;
1187 1218

  
1188 1219
static void term_exit(void)
1189 1220
{
1190 1221
    tcsetattr (0, TCSANOW, &oldtty);
1222
    fcntl(0, F_SETFL, old_fd0_flags);
1191 1223
}
1192 1224

  
1193 1225
static void term_init(void)
......
1196 1228

  
1197 1229
    tcgetattr (0, &tty);
1198 1230
    oldtty = tty;
1231
    old_fd0_flags = fcntl(0, F_GETFL);
1199 1232

  
1200 1233
    tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
1201 1234
                          |INLCR|IGNCR|ICRNL|IXON);
......
1570 1603

  
1571 1604
static void cpu_put_seg(QEMUFile *f, SegmentCache *dt)
1572 1605
{
1606
    qemu_put_be32(f, dt->selector);
1573 1607
    qemu_put_be32(f, (uint32_t)dt->base);
1574 1608
    qemu_put_be32(f, dt->limit);
1575 1609
    qemu_put_be32(f, dt->flags);
......
1577 1611

  
1578 1612
static void cpu_get_seg(QEMUFile *f, SegmentCache *dt)
1579 1613
{
1614
    dt->selector = qemu_get_be32(f);
1580 1615
    dt->base = (uint8_t *)qemu_get_be32(f);
1581 1616
    dt->limit = qemu_get_be32(f);
1582 1617
    dt->flags = qemu_get_be32(f);
......
1650 1685
    uint32_t hflags;
1651 1686
    uint16_t fpus, fpuc, fptag;
1652 1687

  
1653
    if (version_id != 1)
1688
    if (version_id != 2)
1654 1689
        return -EINVAL;
1655 1690
    for(i = 0; i < 8; i++)
1656 1691
        qemu_get_be32s(f, &env->regs[i]);
......
2683 2718
    cpu_single_env = env;
2684 2719

  
2685 2720
    register_savevm("timer", 0, 1, timer_save, timer_load, env);
2686
    register_savevm("cpu", 0, 1, cpu_save, cpu_load, env);
2721
    register_savevm("cpu", 0, 2, cpu_save, cpu_load, env);
2687 2722
    register_savevm("ram", 0, 1, ram_save, ram_load, NULL);
2688 2723
    qemu_register_reset(main_cpu_reset, global_env);
2689 2724

  

Also available in: Unified diff