13 #include <sys/prctl.h> 14 #include <sys/resource.h> 15 #include <sys/syscall.h> 27 #include <sys/types.h> 34 #include "src/base/macros.h" 35 #include "src/base/platform/platform-posix-time.h" 36 #include "src/base/platform/platform-posix.h" 37 #include "src/base/platform/platform.h" 44 bool OS::ArmUsingHardFloat() {
54 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) 55 #if GCC_VERSION >= 40600 && !defined(__clang__) 56 #if defined(__ARM_PCS_VFP) 62 #elif GCC_VERSION < 40500 && !defined(__clang__) 66 #if defined(__ARM_PCS_VFP) 68 #elif defined(__ARM_PCS) || defined(__SOFTFP__) || defined(__SOFTFP) || \ 73 "Your version of compiler does not report the FP ABI compiled for." \ 74 "Please report it on this issue" \ 75 "http://code.google.com/p/v8/issues/detail?id=2140" 84 TimezoneCache* OS::CreateTimezoneCache() {
85 return new PosixDefaultTimezoneCache();
88 std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
89 std::vector<SharedLibraryAddress> result;
93 FILE* fp = fopen(
"/proc/self/maps",
"r");
94 if (fp ==
nullptr)
return result;
97 const int kLibNameLen = FILENAME_MAX + 1;
98 char* lib_name =
reinterpret_cast<char*
>(malloc(kLibNameLen));
103 char attr_r, attr_w, attr_x, attr_p;
105 if (fscanf(fp,
"%" V8PRIxPTR
"-%" V8PRIxPTR, &start, &end) != 2)
break;
106 if (fscanf(fp,
" %c%c%c%c", &attr_r, &attr_w, &attr_x, &attr_p) != 4)
break;
107 if (fscanf(fp,
"%" V8PRIxPTR, &offset) != 1)
break;
113 if (attr_r ==
'r' && attr_w !=
'w' && attr_x ==
'x') {
118 }
while ((c != EOF) && (c !=
'\n') && (c !=
'/') && (c !=
'['));
122 if ((c ==
'/') || (c ==
'[')) {
127 if (fgets(lib_name, kLibNameLen, fp) ==
nullptr)
break;
132 lib_name[strlen(lib_name) - 1] =
'\0';
135 snprintf(lib_name, kLibNameLen,
"%08" V8PRIxPTR
"-%08" V8PRIxPTR, start,
138 result.push_back(SharedLibraryAddress(lib_name, start, end));
144 }
while ((c != EOF) && (c !=
'\n'));
153 void OS::SignalCodeMovingGC() {
162 long size = sysconf(_SC_PAGESIZE);
163 FILE* f = fopen(OS::GetGCFakeMMapFile(),
"w+");
165 OS::PrintError(
"Failed to open %s\n", OS::GetGCFakeMMapFile());
168 void* addr = mmap(OS::GetRandomMmapAddr(), size, PROT_READ | PROT_EXEC,
169 MAP_PRIVATE, fileno(f), 0);
170 DCHECK_NE(MAP_FAILED, addr);
171 CHECK(Free(addr, size));