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