Port plat_m(un)map from the VFIO branch
This commit is contained in:
@@ -302,7 +302,7 @@ plat_get_basename(const char *path)
|
||||
|
||||
while (c > 0) {
|
||||
if (path[c] == '/')
|
||||
return((char *)&path[c]);
|
||||
return((char *)&path[c + 1]);
|
||||
c--;
|
||||
}
|
||||
|
||||
@@ -366,6 +366,19 @@ plat_dir_create(char *path)
|
||||
return mkdir(path, S_IRWXU);
|
||||
}
|
||||
|
||||
void *
|
||||
plat_mmap(size_t size, uint8_t executable)
|
||||
{
|
||||
void *ret = mmap(0, size, PROT_READ | PROT_WRITE | (executable ? PROT_EXEC : 0), MAP_ANON | MAP_PRIVATE, 0, 0);
|
||||
return (ret < 0) ? NULL : ret;
|
||||
}
|
||||
|
||||
void
|
||||
plat_munmap(void *ptr, size_t size)
|
||||
{
|
||||
munmap(ptr, size);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
plat_timer_read(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user