Mercurial > hg > truffle
comparison src/os/linux/vm/os_linux.cpp @ 1029:b0b36f0de97e
Merge
author | tonyp |
---|---|
date | Tue, 20 Oct 2009 11:28:25 -0700 |
parents | 354d3184f6b2 |
children | 95e9083cf4a7 |
comparison
equal
deleted
inserted
replaced
1028:052a899eec3e | 1029:b0b36f0de97e |
---|---|
174 #error define gettid for the arch | 174 #error define gettid for the arch |
175 #endif | 175 #endif |
176 #endif | 176 #endif |
177 | 177 |
178 // Cpu architecture string | 178 // Cpu architecture string |
179 #if defined(IA64) | 179 #if defined(ZERO) |
180 static char cpu_arch[] = ZERO_LIBARCH; | |
181 #elif defined(IA64) | |
180 static char cpu_arch[] = "ia64"; | 182 static char cpu_arch[] = "ia64"; |
181 #elif defined(IA32) | 183 #elif defined(IA32) |
182 static char cpu_arch[] = "i386"; | 184 static char cpu_arch[] = "i386"; |
183 #elif defined(AMD64) | 185 #elif defined(AMD64) |
184 static char cpu_arch[] = "amd64"; | 186 static char cpu_arch[] = "amd64"; |
1741 {EM_X86_64, EM_X86_64, ELFCLASS64, ELFDATA2LSB, (char*)"AMD 64"}, | 1743 {EM_X86_64, EM_X86_64, ELFCLASS64, ELFDATA2LSB, (char*)"AMD 64"}, |
1742 {EM_SPARC, EM_SPARC, ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"}, | 1744 {EM_SPARC, EM_SPARC, ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"}, |
1743 {EM_SPARC32PLUS, EM_SPARC, ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"}, | 1745 {EM_SPARC32PLUS, EM_SPARC, ELFCLASS32, ELFDATA2MSB, (char*)"Sparc 32"}, |
1744 {EM_SPARCV9, EM_SPARCV9, ELFCLASS64, ELFDATA2MSB, (char*)"Sparc v9 64"}, | 1746 {EM_SPARCV9, EM_SPARCV9, ELFCLASS64, ELFDATA2MSB, (char*)"Sparc v9 64"}, |
1745 {EM_PPC, EM_PPC, ELFCLASS32, ELFDATA2MSB, (char*)"Power PC 32"}, | 1747 {EM_PPC, EM_PPC, ELFCLASS32, ELFDATA2MSB, (char*)"Power PC 32"}, |
1746 {EM_PPC64, EM_PPC64, ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"} | 1748 {EM_PPC64, EM_PPC64, ELFCLASS64, ELFDATA2MSB, (char*)"Power PC 64"}, |
1749 {EM_ARM, EM_ARM, ELFCLASS32, ELFDATA2LSB, (char*)"ARM"}, | |
1750 {EM_S390, EM_S390, ELFCLASSNONE, ELFDATA2MSB, (char*)"IBM System/390"}, | |
1751 {EM_ALPHA, EM_ALPHA, ELFCLASS64, ELFDATA2LSB, (char*)"Alpha"}, | |
1752 {EM_MIPS_RS3_LE, EM_MIPS_RS3_LE, ELFCLASS32, ELFDATA2LSB, (char*)"MIPSel"}, | |
1753 {EM_MIPS, EM_MIPS, ELFCLASS32, ELFDATA2MSB, (char*)"MIPS"}, | |
1754 {EM_PARISC, EM_PARISC, ELFCLASS32, ELFDATA2MSB, (char*)"PARISC"}, | |
1755 {EM_68K, EM_68K, ELFCLASS32, ELFDATA2MSB, (char*)"M68k"} | |
1747 }; | 1756 }; |
1748 | 1757 |
1749 #if (defined IA32) | 1758 #if (defined IA32) |
1750 static Elf32_Half running_arch_code=EM_386; | 1759 static Elf32_Half running_arch_code=EM_386; |
1751 #elif (defined AMD64) | 1760 #elif (defined AMD64) |
1758 static Elf32_Half running_arch_code=EM_SPARC; | 1767 static Elf32_Half running_arch_code=EM_SPARC; |
1759 #elif (defined __powerpc64__) | 1768 #elif (defined __powerpc64__) |
1760 static Elf32_Half running_arch_code=EM_PPC64; | 1769 static Elf32_Half running_arch_code=EM_PPC64; |
1761 #elif (defined __powerpc__) | 1770 #elif (defined __powerpc__) |
1762 static Elf32_Half running_arch_code=EM_PPC; | 1771 static Elf32_Half running_arch_code=EM_PPC; |
1772 #elif (defined ARM) | |
1773 static Elf32_Half running_arch_code=EM_ARM; | |
1774 #elif (defined S390) | |
1775 static Elf32_Half running_arch_code=EM_S390; | |
1776 #elif (defined ALPHA) | |
1777 static Elf32_Half running_arch_code=EM_ALPHA; | |
1778 #elif (defined MIPSEL) | |
1779 static Elf32_Half running_arch_code=EM_MIPS_RS3_LE; | |
1780 #elif (defined PARISC) | |
1781 static Elf32_Half running_arch_code=EM_PARISC; | |
1782 #elif (defined MIPS) | |
1783 static Elf32_Half running_arch_code=EM_MIPS; | |
1784 #elif (defined M68K) | |
1785 static Elf32_Half running_arch_code=EM_68K; | |
1763 #else | 1786 #else |
1764 #error Method os::dll_load requires that one of following is defined:\ | 1787 #error Method os::dll_load requires that one of following is defined:\ |
1765 IA32, AMD64, IA64, __sparc, __powerpc__ | 1788 IA32, AMD64, IA64, __sparc, __powerpc__, ARM, S390, ALPHA, MIPS, MIPSEL, PARISC, M68K |
1766 #endif | 1789 #endif |
1767 | 1790 |
1768 // Identify compatability class for VM's architecture and library's architecture | 1791 // Identify compatability class for VM's architecture and library's architecture |
1769 // Obtain string descriptions for architectures | 1792 // Obtain string descriptions for architectures |
1770 | 1793 |
1792 if (lib_arch.endianess != arch_array[running_arch_index].endianess) { | 1815 if (lib_arch.endianess != arch_array[running_arch_index].endianess) { |
1793 ::snprintf(diag_msg_buf, diag_msg_max_length-1," (Possible cause: endianness mismatch)"); | 1816 ::snprintf(diag_msg_buf, diag_msg_max_length-1," (Possible cause: endianness mismatch)"); |
1794 return NULL; | 1817 return NULL; |
1795 } | 1818 } |
1796 | 1819 |
1820 #ifndef S390 | |
1797 if (lib_arch.elf_class != arch_array[running_arch_index].elf_class) { | 1821 if (lib_arch.elf_class != arch_array[running_arch_index].elf_class) { |
1798 ::snprintf(diag_msg_buf, diag_msg_max_length-1," (Possible cause: architecture word width mismatch)"); | 1822 ::snprintf(diag_msg_buf, diag_msg_max_length-1," (Possible cause: architecture word width mismatch)"); |
1799 return NULL; | 1823 return NULL; |
1800 } | 1824 } |
1825 #endif // !S390 | |
1801 | 1826 |
1802 if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) { | 1827 if (lib_arch.compat_class != arch_array[running_arch_index].compat_class) { |
1803 if ( lib_arch.name!=NULL ) { | 1828 if ( lib_arch.name!=NULL ) { |
1804 ::snprintf(diag_msg_buf, diag_msg_max_length-1, | 1829 ::snprintf(diag_msg_buf, diag_msg_max_length-1, |
1805 " (Possible cause: can't load %s-bit .so on a %s-bit platform)", | 1830 " (Possible cause: can't load %s-bit .so on a %s-bit platform)", |
2584 // | 2609 // |
2585 // If we can't determine the value (e.g. /proc is not mounted, or the text | 2610 // If we can't determine the value (e.g. /proc is not mounted, or the text |
2586 // format has been changed), we'll use the largest page size supported by | 2611 // format has been changed), we'll use the largest page size supported by |
2587 // the processor. | 2612 // the processor. |
2588 | 2613 |
2614 #ifndef ZERO | |
2589 _large_page_size = IA32_ONLY(4 * M) AMD64_ONLY(2 * M) IA64_ONLY(256 * M) SPARC_ONLY(4 * M); | 2615 _large_page_size = IA32_ONLY(4 * M) AMD64_ONLY(2 * M) IA64_ONLY(256 * M) SPARC_ONLY(4 * M); |
2616 #endif // ZERO | |
2590 | 2617 |
2591 FILE *fp = fopen("/proc/meminfo", "r"); | 2618 FILE *fp = fopen("/proc/meminfo", "r"); |
2592 if (fp) { | 2619 if (fp) { |
2593 while (!feof(fp)) { | 2620 while (!feof(fp)) { |
2594 int x = 0; | 2621 int x = 0; |