forked from fi01/backdoor_mmap_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmm.c
41 lines (32 loc) · 694 Bytes
/
mm.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/system_properties.h>
#include "device_database/device_database.h"
#include "kallsyms.h"
#include "mm.h"
unsigned long int
_get_remap_pfn_range_address(void)
{
unsigned long int address = device_get_symbol_address(DEVICE_SYMBOL(remap_pfn_range));
if (address) {
return address;
}
return 0;
}
void *
get_remap_pfn_range_address(void)
{
void *ret = NULL;
if (kallsyms_exist()) {
ret = kallsyms_get_symbol_address("remap_pfn_range");
}
if (!ret) {
ret = (void*)_get_remap_pfn_range_address();
}
if (!ret) {
print_reason_device_not_supported();
return NULL;
}
return ret;
}