mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
drc: some portability fixes
This commit is contained in:
parent
2446536be5
commit
c25d78eec1
5 changed files with 36 additions and 22 deletions
|
@ -1 +1 @@
|
|||
Subproject commit c2981fc0ee15d3b1aff69901550fda32460bb1b1
|
||||
Subproject commit 6282e17ef5f37915df1a77b5d7138c666e94d0fb
|
|
@ -11,6 +11,7 @@
|
|||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <errno.h>
|
||||
#ifdef __MACH__
|
||||
#include <libkern/OSCacheControl.h>
|
||||
#endif
|
||||
|
@ -71,8 +72,10 @@ void *plat_mmap(unsigned long addr, size_t size, int need_exec, int is_fixed)
|
|||
|
||||
req = (void *)addr;
|
||||
ret = mmap(req, size, PROT_READ | PROT_WRITE, flags, -1, 0);
|
||||
if (ret == MAP_FAILED)
|
||||
if (ret == MAP_FAILED) {
|
||||
lprintf("mmap(%08lx, %zd) failed: %d\n", addr, size, errno);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (addr != 0 && ret != (void *)addr) {
|
||||
lprintf("warning: wanted to map @%08lx, got %p\n",
|
||||
|
@ -102,6 +105,15 @@ void plat_munmap(void *ptr, size_t size)
|
|||
munmap(ptr, size);
|
||||
}
|
||||
|
||||
int plat_mem_set_exec(void *ptr, size_t size)
|
||||
{
|
||||
int ret = mprotect(ptr, size, PROT_READ | PROT_WRITE | PROT_EXEC);
|
||||
if (ret != 0)
|
||||
lprintf("mprotect(%p, %zd) failed: %d\n", ptr, size, errno);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void emu_video_mode_change(int start_line, int line_count, int is_32cols)
|
||||
{
|
||||
memset(vout_buf, 0, 320 * 240 * 2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue