| OLD | NEW |
| 1 /* Copyright (c) 2005-2011, Google Inc. | 1 /* Copyright (c) 2005-2011, Google Inc. |
| 2 * All rights reserved. | 2 * All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1606 * clobbered. This causes problems with compilers, that do a better job | 1606 * clobbered. This causes problems with compilers, that do a better job |
| 1607 * at optimizing across __asm__ calls. | 1607 * at optimizing across __asm__ calls. |
| 1608 * So, we just have to redefine all of the _syscallX() macros. | 1608 * So, we just have to redefine all of the _syscallX() macros. |
| 1609 */ | 1609 */ |
| 1610 #undef LSS_ENTRYPOINT | 1610 #undef LSS_ENTRYPOINT |
| 1611 #ifdef SYS_SYSCALL_ENTRYPOINT | 1611 #ifdef SYS_SYSCALL_ENTRYPOINT |
| 1612 static inline void (**LSS_NAME(get_syscall_entrypoint)(void))(void) { | 1612 static inline void (**LSS_NAME(get_syscall_entrypoint)(void))(void) { |
| 1613 void (**entrypoint)(void); | 1613 void (**entrypoint)(void); |
| 1614 asm volatile(".bss\n" | 1614 asm volatile(".bss\n" |
| 1615 ".align 8\n" | 1615 ".align 8\n" |
| 1616 ".globl "SYS_SYSCALL_ENTRYPOINT"\n" | 1616 ".globl " SYS_SYSCALL_ENTRYPOINT "\n" |
| 1617 ".common "SYS_SYSCALL_ENTRYPOINT",8,8\n" | 1617 ".common " SYS_SYSCALL_ENTRYPOINT ",8,8\n" |
| 1618 ".previous\n" | 1618 ".previous\n" |
| 1619 /* This logically does 'lea "SYS_SYSCALL_ENTRYPOINT", %0' */ | 1619 /* This logically does 'lea "SYS_SYSCALL_ENTRYPOINT", %0' */ |
| 1620 "call 0f\n" | 1620 "call 0f\n" |
| 1621 "0:pop %0\n" | 1621 "0:pop %0\n" |
| 1622 "add $_GLOBAL_OFFSET_TABLE_+[.-0b], %0\n" | 1622 "add $_GLOBAL_OFFSET_TABLE_+[.-0b], %0\n" |
| 1623 "mov "SYS_SYSCALL_ENTRYPOINT"@GOT(%0), %0\n" | 1623 "mov " SYS_SYSCALL_ENTRYPOINT "@GOT(%0), %0\n" |
| 1624 : "=r"(entrypoint)); | 1624 : "=r"(entrypoint)); |
| 1625 return entrypoint; | 1625 return entrypoint; |
| 1626 } | 1626 } |
| 1627 | 1627 |
| 1628 #define LSS_ENTRYPOINT ".bss\n" \ | 1628 #define LSS_ENTRYPOINT ".bss\n" \ |
| 1629 ".align 8\n" \ | 1629 ".align 8\n" \ |
| 1630 ".globl "SYS_SYSCALL_ENTRYPOINT"\n" \ | 1630 ".globl " SYS_SYSCALL_ENTRYPOINT "\n" \ |
| 1631 ".common "SYS_SYSCALL_ENTRYPOINT",8,8\n" \ | 1631 ".common " SYS_SYSCALL_ENTRYPOINT ",8,8\n" \ |
| 1632 ".previous\n" \ | 1632 ".previous\n" \ |
| 1633 /* Check the SYS_SYSCALL_ENTRYPOINT vector */ \ | 1633 /* Check the SYS_SYSCALL_ENTRYPOINT vector */ \ |
| 1634 "push %%eax\n" \ | 1634 "push %%eax\n" \ |
| 1635 "call 10000f\n" \ | 1635 "call 10000f\n" \ |
| 1636 "10000:pop %%eax\n" \ | 1636 "10000:pop %%eax\n" \ |
| 1637 "add $_GLOBAL_OFFSET_TABLE_+[.-10000b], %%eax\n" \ | 1637 "add $_GLOBAL_OFFSET_TABLE_+[.-10000b], %%eax\n" \ |
| 1638 "mov "SYS_SYSCALL_ENTRYPOINT"@GOT(%%eax), %%eax\n"\ | 1638 "mov " SYS_SYSCALL_ENTRYPOINT \ |
| 1639 "@GOT(%%eax), %%eax\n" \ |
| 1639 "mov 0(%%eax), %%eax\n" \ | 1640 "mov 0(%%eax), %%eax\n" \ |
| 1640 "test %%eax, %%eax\n" \ | 1641 "test %%eax, %%eax\n" \ |
| 1641 "jz 10002f\n" \ | 1642 "jz 10002f\n" \ |
| 1642 "push %%eax\n" \ | 1643 "push %%eax\n" \ |
| 1643 "call 10001f\n" \ | 1644 "call 10001f\n" \ |
| 1644 "10001:pop %%eax\n" \ | 1645 "10001:pop %%eax\n" \ |
| 1645 "add $(10003f-10001b), %%eax\n" \ | 1646 "add $(10003f-10001b), %%eax\n" \ |
| 1646 "xchg 4(%%esp), %%eax\n" \ | 1647 "xchg 4(%%esp), %%eax\n" \ |
| 1647 "ret\n" \ | 1648 "ret\n" \ |
| 1648 "10002:pop %%eax\n" \ | 1649 "10002:pop %%eax\n" \ |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1900 * our own version so that we can override the location of the errno | 1901 * our own version so that we can override the location of the errno |
| 1901 * location (e.g. when using the clone() system call with the CLONE_VM | 1902 * location (e.g. when using the clone() system call with the CLONE_VM |
| 1902 * option). | 1903 * option). |
| 1903 */ | 1904 */ |
| 1904 #undef LSS_ENTRYPOINT | 1905 #undef LSS_ENTRYPOINT |
| 1905 #ifdef SYS_SYSCALL_ENTRYPOINT | 1906 #ifdef SYS_SYSCALL_ENTRYPOINT |
| 1906 static inline void (**LSS_NAME(get_syscall_entrypoint)(void))(void) { | 1907 static inline void (**LSS_NAME(get_syscall_entrypoint)(void))(void) { |
| 1907 void (**entrypoint)(void); | 1908 void (**entrypoint)(void); |
| 1908 asm volatile(".bss\n" | 1909 asm volatile(".bss\n" |
| 1909 ".align 8\n" | 1910 ".align 8\n" |
| 1910 ".globl "SYS_SYSCALL_ENTRYPOINT"\n" | 1911 ".globl " SYS_SYSCALL_ENTRYPOINT "\n" |
| 1911 ".common "SYS_SYSCALL_ENTRYPOINT",8,8\n" | 1912 ".common " SYS_SYSCALL_ENTRYPOINT ",8,8\n" |
| 1912 ".previous\n" | 1913 ".previous\n" |
| 1913 "mov "SYS_SYSCALL_ENTRYPOINT"@GOTPCREL(%%rip), %0\n" | 1914 "mov " SYS_SYSCALL_ENTRYPOINT "@GOTPCREL(%%rip), %0\n" |
| 1914 : "=r"(entrypoint)); | 1915 : "=r"(entrypoint)); |
| 1915 return entrypoint; | 1916 return entrypoint; |
| 1916 } | 1917 } |
| 1917 | 1918 |
| 1918 #define LSS_ENTRYPOINT \ | 1919 #define LSS_ENTRYPOINT \ |
| 1919 ".bss\n" \ | 1920 ".bss\n" \ |
| 1920 ".align 8\n" \ | 1921 ".align 8\n" \ |
| 1921 ".globl "SYS_SYSCALL_ENTRYPOINT"\n" \ | 1922 ".globl " SYS_SYSCALL_ENTRYPOINT "\n" \ |
| 1922 ".common "SYS_SYSCALL_ENTRYPOINT",8,8\n" \ | 1923 ".common " SYS_SYSCALL_ENTRYPOINT ",8,8\n" \ |
| 1923 ".previous\n" \ | 1924 ".previous\n" \ |
| 1924 "mov "SYS_SYSCALL_ENTRYPOINT"@GOTPCREL(%%rip), %%rcx\n" \ | 1925 "mov " SYS_SYSCALL_ENTRYPOINT "@GOTPCREL(%%rip), %%rcx\n" \ |
| 1925 "mov 0(%%rcx), %%rcx\n" \ | 1926 "mov 0(%%rcx), %%rcx\n" \ |
| 1926 "test %%rcx, %%rcx\n" \ | 1927 "test %%rcx, %%rcx\n" \ |
| 1927 "jz 10001f\n" \ | 1928 "jz 10001f\n" \ |
| 1928 "call *%%rcx\n" \ | 1929 "call *%%rcx\n" \ |
| 1929 "jmp 10002f\n" \ | 1930 "jmp 10002f\n" \ |
| 1930 "10001:syscall\n" \ | 1931 "10001:syscall\n" \ |
| 1931 "10002:\n" | 1932 "10002:\n" |
| 1932 | 1933 |
| 1933 #else | 1934 #else |
| 1934 #define LSS_ENTRYPOINT "syscall\n" | 1935 #define LSS_ENTRYPOINT "syscall\n" |
| (...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4011 # pragma pop_macro("fstat64") | 4012 # pragma pop_macro("fstat64") |
| 4012 # pragma pop_macro("lstat64") | 4013 # pragma pop_macro("lstat64") |
| 4013 #endif | 4014 #endif |
| 4014 | 4015 |
| 4015 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) | 4016 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) |
| 4016 } | 4017 } |
| 4017 #endif | 4018 #endif |
| 4018 | 4019 |
| 4019 #endif | 4020 #endif |
| 4020 #endif | 4021 #endif |
| OLD | NEW |