Revision fdec9918 target-s390x/kvm.c

b/target-s390x/kvm.c
135 135
    return 0;
136 136
}
137 137

  
138
/*
139
 * Legacy layout for s390:
140
 * Older S390 KVM requires the topmost vma of the RAM to be
141
 * smaller than an system defined value, which is at least 256GB.
142
 * Larger systems have larger values. We put the guest between
143
 * the end of data segment (system break) and this value. We
144
 * use 32GB as a base to have enough room for the system break
145
 * to grow. We also have to use MAP parameters that avoid
146
 * read-only mapping of guest pages.
147
 */
148
static void *legacy_s390_alloc(ram_addr_t size)
149
{
150
    void *mem;
151

  
152
    mem = mmap((void *) 0x800000000ULL, size,
153
               PROT_EXEC|PROT_READ|PROT_WRITE,
154
               MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
155
    if (mem == MAP_FAILED) {
156
        fprintf(stderr, "Allocating RAM failed\n");
157
        abort();
158
    }
159
    return mem;
160
}
161

  
162
void *kvm_arch_vmalloc(ram_addr_t size)
163
{
164
    /* Can we use the standard allocation ? */
165
    if (kvm_check_extension(kvm_state, KVM_CAP_S390_GMAP) &&
166
        kvm_check_extension(kvm_state, KVM_CAP_S390_COW)) {
167
        return NULL;
168
    } else {
169
        return legacy_s390_alloc(size);
170
    }
171
}
172

  
138 173
int kvm_arch_insert_sw_breakpoint(CPUS390XState *env, struct kvm_sw_breakpoint *bp)
139 174
{
140 175
    static const uint8_t diag_501[] = {0x83, 0x24, 0x05, 0x01};

Also available in: Unified diff