cmn.c 673 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * PicoDrive
  3. * Copyright (C) 2009,2010 notaz
  4. *
  5. * This work is licensed under the terms of MAME license.
  6. * See COPYING file in the top-level directory.
  7. */
  8. #include <stdio.h>
  9. #ifdef __linux__
  10. #include <sys/mman.h>
  11. #endif
  12. #include "cmn.h"
  13. u8 __attribute__((aligned(4096))) tcache[DRC_TCACHE_SIZE];
  14. void drc_cmn_init(void)
  15. {
  16. #ifdef __linux__
  17. void *tmp;
  18. tmp = mmap(tcache, DRC_TCACHE_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
  19. printf("mmap tcache: %p, asked %p\n", tmp, tcache);
  20. #endif
  21. }
  22. void drc_cmn_cleanup(void)
  23. {
  24. #ifdef __linux__
  25. int ret;
  26. ret = munmap(tcache, DRC_TCACHE_SIZE);
  27. printf("munmap tcache: %i\n", ret);
  28. #endif
  29. }