int kvm_arch_init(KVMState *s, int smp_cpus)

{

    int ret;



    struct utsname utsname;



    uname(&utsname);

    lm_capable_kernel = strcmp(utsname.machine, "x86_64") == 0;



    /* create vm86 tss.  KVM uses vm86 mode to emulate 16-bit code

     * directly.  In order to use vm86 mode, a TSS is needed.  Since this

     * must be part of guest physical memory, we need to allocate it.  Older

     * versions of KVM just assumed that it would be at the end of physical

     * memory but that doesn't work with more than 4GB of memory.  We simply

     * refuse to work with those older versions of KVM. */

    ret = kvm_check_extension(s, KVM_CAP_SET_TSS_ADDR);

    if (ret <= 0) {

        fprintf(stderr, "kvm does not support KVM_CAP_SET_TSS_ADDR\n");

        return ret;

    }



    /* this address is 3 pages before the bios, and the bios should present

     * as unavaible memory.  FIXME, need to ensure the e820 map deals with

     * this?

     */

    /*

     * Tell fw_cfg to notify the BIOS to reserve the range.

     */

    if (e820_add_entry(0xfffbc000, 0x4000, E820_RESERVED) < 0) {

        perror("e820_add_entry() table is full");

        exit(1);

    }

    ret = kvm_vm_ioctl(s, KVM_SET_TSS_ADDR, 0xfffbd000);

    if (ret < 0) {

        return ret;

    }



    return kvm_init_identity_map_page(s);

}

int kvm_arch_init(KVMState *s, int smp_cpus)

{

    int ret;



    struct utsname utsname;



    uname(&utsname);

    lm_capable_kernel = strcmp(utsname.machine, "x86_64") == 0;



    











    ret = kvm_check_extension(s, KVM_CAP_SET_TSS_ADDR);

    if (ret <= 0) {

        fprintf(stderr, "kvm does not support KVM_CAP_SET_TSS_ADDR\n");

        return ret;

    }



    







    





    if (e820_add_entry(0xfffbc000, 0x4000, E820_RESERVED) < 0) {

        perror("e820_add_entry() table is full");

        exit(1);

    }

    ret = kvm_vm_ioctl(s, KVM_SET_TSS_ADDR, 0xfffbd000);

    if (ret < 0) {

        return ret;

    }



    return kvm_init_identity_map_page(s);

}

int FUNC_0(KVMState *VAR_0, int VAR_1)

{

    int VAR_2;



    struct VAR_3 VAR_3;



    uname(&VAR_3);

    lm_capable_kernel = strcmp(VAR_3.machine, "x86_64") == 0;



    











    VAR_2 = kvm_check_extension(VAR_0, KVM_CAP_SET_TSS_ADDR);

    if (VAR_2 <= 0) {

        fprintf(stderr, "kvm does not support KVM_CAP_SET_TSS_ADDR\n");

        return VAR_2;

    }



    







    





    if (e820_add_entry(0xfffbc000, 0x4000, E820_RESERVED) < 0) {

        perror("e820_add_entry() table is full");

        exit(1);

    }

    VAR_2 = kvm_vm_ioctl(VAR_0, KVM_SET_TSS_ADDR, 0xfffbd000);

    if (VAR_2 < 0) {

        return VAR_2;

    }



    return kvm_init_identity_map_page(VAR_0);

}

int FUNC_0(KVMState *VAR_0, int VAR_1)
{ int VAR_2; struct VAR_3 VAR_3; uname(&VAR_3); lm_capable_kernel = strcmp(VAR_3.machine, "x86_64") == 0; VAR_2 = kvm_check_extension(VAR_0, KVM_CAP_SET_TSS_ADDR); if (VAR_2 <= 0) { fprintf(stderr, "kvm does not support KVM_CAP_SET_TSS_ADDR\n"); return VAR_2; } if (e820_add_entry(0xfffbc000, 0x4000, E820_RESERVED) < 0) { perror("e820_add_entry() table is full"); exit(1); } VAR_2 = kvm_vm_ioctl(VAR_0, KVM_SET_TSS_ADDR, 0xfffbd000); if (VAR_2 < 0) { return VAR_2; } return kvm_init_identity_map_page(VAR_0); }