Commit 6cb7ee859a1b28aae8eab7f88908c9c9262b8a5c

Authored by pbrook
1 parent e4d165c2

Only use /dev/shm hack when kqemu is enabled.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1930 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 18 additions and 4 deletions
... ... @@ -29,6 +29,9 @@
29 29 #include <unistd.h>
30 30  
31 31 #include "cpu.h"
  32 +#if defined(USE_KQEMU)
  33 +#include "vl.h"
  34 +#endif
32 35  
33 36 #if defined(__i386__) && !defined(CONFIG_SOFTMMU) && !defined(CONFIG_USER_ONLY)
34 37  
... ... @@ -321,13 +324,15 @@ void qemu_vfree(void *ptr)
321 324 VirtualFree(ptr, 0, MEM_RELEASE);
322 325 }
323 326  
324   -#elif defined(USE_KQEMU)
  327 +#else
  328 +
  329 +#if defined(USE_KQEMU)
325 330  
326 331 #include <sys/vfs.h>
327 332 #include <sys/mman.h>
328 333 #include <fcntl.h>
329 334  
330   -void *qemu_vmalloc(size_t size)
  335 +void *kqemu_vmalloc(size_t size)
331 336 {
332 337 static int phys_ram_fd = -1;
333 338 static int phys_ram_size = 0;
... ... @@ -362,6 +367,7 @@ void *qemu_vmalloc(size_t size)
362 367 "QEMU_TMPDIR environment variable to set another directory where the QEMU\n"
363 368 "temporary RAM file will be opened.\n");
364 369 }
  370 + fprintf(stderr, "Or disable the accelerator module with -no-kqemu\n");
365 371 exit(1);
366 372 }
367 373 }
... ... @@ -403,16 +409,20 @@ void *qemu_vmalloc(size_t size)
403 409 return ptr;
404 410 }
405 411  
406   -void qemu_vfree(void *ptr)
  412 +void kqemu_vfree(void *ptr)
407 413 {
408 414 /* may be useful some day, but currently we do not need to free */
409 415 }
410 416  
411   -#else
  417 +#endif
412 418  
413 419 /* alloc shared memory pages */
414 420 void *qemu_vmalloc(size_t size)
415 421 {
  422 +#if defined(USE_KQEMU)
  423 + if (kqemu_allowed)
  424 + return kqemu_vmalloc(size);
  425 +#endif
416 426 #ifdef _BSD
417 427 return valloc(size);
418 428 #else
... ... @@ -422,6 +432,10 @@ void *qemu_vmalloc(size_t size)
422 432  
423 433 void qemu_vfree(void *ptr)
424 434 {
  435 +#if defined(USE_KQEMU)
  436 + if (kqemu_allowed)
  437 + kqemu_vfree(ptr);
  438 +#endif
425 439 free(ptr);
426 440 }
427 441  
... ...