Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.46 KB | None | 0 0
  1. static int rec_mmap_psx_mem_local(const uptr vaddr, int psxM_memfd, int psxP_memfd, int psxH_memfd, int psxR_memfd)
  2. {
  3.     const size_t page_size = host_page_size;
  4.  
  5.     // Note that we create just a page-sized mirror of psxH (scratchpad/HW).
  6.     //  If page size is just 4KB, this will allow dynarec to emit optimized
  7.     //  load/store code that relies on a SIGSEGV signal handler to catch HW
  8.     //  I/O port access. The HW ports start 4KB past beginning of scratchpad,
  9.     //  and here they will be left unmapped, along with cache control port
  10.     //  at 0xfffe_0130. 8MB ROM Expansion region is hopefully never written
  11.     //  to, so its 8MB doesn't actually allocate any pages of host RAM.
  12.     //  If it *is* written to, it'd probably be harmlessly soaking up
  13.     //  out-of-bounds scratchpad stores at its end from buggy PS1 code.
  14.     if (rec_mmap_shared_memfd(vaddr           ,  0x200000, true, psxM_memfd) == MAP_FAILED ||
  15.         rec_mmap_shared_memfd(vaddr+0x00200000,  0x200000, true, psxM_memfd) == MAP_FAILED ||
  16.         rec_mmap_shared_memfd(vaddr+0x00400000,  0x200000, true, psxM_memfd) == MAP_FAILED ||
  17.         rec_mmap_shared_memfd(vaddr+0x00600000,  0x200000, true, psxM_memfd) == MAP_FAILED ||
  18.         rec_mmap_shared_memfd(vaddr+0x01000000,  0x800000, true, psxP_memfd) == MAP_FAILED ||
  19.         rec_mmap_shared_memfd(vaddr+0x01800000, page_size, true, psxH_memfd) == MAP_FAILED ||
  20.         rec_mmap_shared_memfd(vaddr+0x01c00000,   0x80000, true, psxR_memfd) == MAP_FAILED)
  21.         return -1;
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement