Port plat_m(un)map from the VFIO branch

This commit is contained in:
RichardG867
2021-10-16 20:12:49 -03:00
parent e25482db11
commit 5bf8aa2d58
6 changed files with 66 additions and 69 deletions

View File

@@ -728,7 +728,7 @@ plat_get_basename(const char *path)
while (c > 0) {
if (path[c] == '/' || path[c] == '\\')
return((char *)&path[c]);
return((char *)&path[c + 1]);
c--;
}
@@ -858,6 +858,20 @@ plat_dir_create(char *path)
}
void *
plat_mmap(size_t size, uint8_t executable)
{
return VirtualAlloc(NULL, size, MEM_COMMIT, executable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE);
}
void
plat_munmap(void *ptr, size_t size)
{
VirtualFree(ptr, 0, MEM_RELEASE);
}
uint64_t
plat_timer_read(void)
{