Revision a60f24b5 kvm-all.c

b/kvm-all.c
230 230
    }
231 231

  
232 232
    cpu->kvm_fd = ret;
233
    env->kvm_state = s;
233
    cpu->kvm_state = s;
234 234
    cpu->kvm_vcpu_dirty = true;
235 235

  
236 236
    mmap_size = kvm_ioctl(s, KVM_GET_VCPU_MMAP_SIZE, 0);
......
1763 1763
}
1764 1764

  
1765 1765
#ifdef KVM_CAP_SET_GUEST_DEBUG
1766
struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUArchState *env,
1766
struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *cpu,
1767 1767
                                                 target_ulong pc)
1768 1768
{
1769 1769
    struct kvm_sw_breakpoint *bp;
1770 1770

  
1771
    QTAILQ_FOREACH(bp, &env->kvm_state->kvm_sw_breakpoints, entry) {
1771
    QTAILQ_FOREACH(bp, &cpu->kvm_state->kvm_sw_breakpoints, entry) {
1772 1772
        if (bp->pc == pc) {
1773 1773
            return bp;
1774 1774
        }
......
1776 1776
    return NULL;
1777 1777
}
1778 1778

  
1779
int kvm_sw_breakpoints_active(CPUArchState *env)
1779
int kvm_sw_breakpoints_active(CPUState *cpu)
1780 1780
{
1781
    return !QTAILQ_EMPTY(&env->kvm_state->kvm_sw_breakpoints);
1781
    return !QTAILQ_EMPTY(&cpu->kvm_state->kvm_sw_breakpoints);
1782 1782
}
1783 1783

  
1784 1784
struct kvm_set_guest_debug_data {
1785 1785
    struct kvm_guest_debug dbg;
1786
    CPUArchState *env;
1786
    CPUState *cpu;
1787 1787
    int err;
1788 1788
};
1789 1789

  
1790 1790
static void kvm_invoke_set_guest_debug(void *data)
1791 1791
{
1792 1792
    struct kvm_set_guest_debug_data *dbg_data = data;
1793
    CPUState *cpu = ENV_GET_CPU(dbg_data->env);
1794 1793

  
1795
    dbg_data->err = kvm_vcpu_ioctl(cpu, KVM_SET_GUEST_DEBUG, &dbg_data->dbg);
1794
    dbg_data->err = kvm_vcpu_ioctl(dbg_data->cpu, KVM_SET_GUEST_DEBUG,
1795
                                   &dbg_data->dbg);
1796 1796
}
1797 1797

  
1798 1798
int kvm_update_guest_debug(CPUArchState *env, unsigned long reinject_trap)
......
1806 1806
        data.dbg.control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP;
1807 1807
    }
1808 1808
    kvm_arch_update_guest_debug(cpu, &data.dbg);
1809
    data.env = env;
1809
    data.cpu = cpu;
1810 1810

  
1811 1811
    run_on_cpu(cpu, kvm_invoke_set_guest_debug, &data);
1812 1812
    return data.err;
......
1821 1821
    int err;
1822 1822

  
1823 1823
    if (type == GDB_BREAKPOINT_SW) {
1824
        bp = kvm_find_sw_breakpoint(current_env, addr);
1824
        bp = kvm_find_sw_breakpoint(current_cpu, addr);
1825 1825
        if (bp) {
1826 1826
            bp->use_count++;
1827 1827
            return 0;
......
1840 1840
            return err;
1841 1841
        }
1842 1842

  
1843
        QTAILQ_INSERT_HEAD(&current_env->kvm_state->kvm_sw_breakpoints,
1843
        QTAILQ_INSERT_HEAD(&current_cpu->kvm_state->kvm_sw_breakpoints,
1844 1844
                          bp, entry);
1845 1845
    } else {
1846 1846
        err = kvm_arch_insert_hw_breakpoint(addr, len, type);
......
1867 1867
    int err;
1868 1868

  
1869 1869
    if (type == GDB_BREAKPOINT_SW) {
1870
        bp = kvm_find_sw_breakpoint(current_env, addr);
1870
        bp = kvm_find_sw_breakpoint(current_cpu, addr);
1871 1871
        if (!bp) {
1872 1872
            return -ENOENT;
1873 1873
        }
......
1882 1882
            return err;
1883 1883
        }
1884 1884

  
1885
        QTAILQ_REMOVE(&current_env->kvm_state->kvm_sw_breakpoints, bp, entry);
1885
        QTAILQ_REMOVE(&current_cpu->kvm_state->kvm_sw_breakpoints, bp, entry);
1886 1886
        g_free(bp);
1887 1887
    } else {
1888 1888
        err = kvm_arch_remove_hw_breakpoint(addr, len, type);
......
1904 1904
{
1905 1905
    CPUState *current_cpu = ENV_GET_CPU(current_env);
1906 1906
    struct kvm_sw_breakpoint *bp, *next;
1907
    KVMState *s = current_env->kvm_state;
1907
    KVMState *s = current_cpu->kvm_state;
1908 1908
    CPUArchState *env;
1909 1909
    CPUState *cpu;
1910 1910

  

Also available in: Unified diff