| 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 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2364 { | 2364 { |
| 2365 register int __flags __asm__("r0") = flags; | 2365 register int __flags __asm__("r0") = flags; |
| 2366 register void *__stack __asm__("r1") = child_stack; | 2366 register void *__stack __asm__("r1") = child_stack; |
| 2367 register void *__ptid __asm__("r2") = parent_tidptr; | 2367 register void *__ptid __asm__("r2") = parent_tidptr; |
| 2368 register void *__tls __asm__("r3") = newtls; | 2368 register void *__tls __asm__("r3") = newtls; |
| 2369 register int *__ctid __asm__("r4") = child_tidptr; | 2369 register int *__ctid __asm__("r4") = child_tidptr; |
| 2370 __asm__ __volatile__(/* if (fn == NULL || child_stack == NULL) | 2370 __asm__ __volatile__(/* if (fn == NULL || child_stack == NULL) |
| 2371 * return -EINVAL; | 2371 * return -EINVAL; |
| 2372 */ | 2372 */ |
| 2373 #ifdef __thumb2__ | 2373 #ifdef __thumb2__ |
| 2374 » » » "push {r7}\n" | 2374 "push {r7}\n" |
| 2375 #endif | 2375 #endif |
| 2376 "cmp %2,#0\n" | 2376 "cmp %2,#0\n" |
| 2377 "it ne\n" | 2377 "it ne\n" |
| 2378 "cmpne %3,#0\n" | 2378 "cmpne %3,#0\n" |
| 2379 "it eq\n" | 2379 "it eq\n" |
| 2380 "moveq %0,%1\n" | 2380 "moveq %0,%1\n" |
| 2381 "beq 1f\n" | 2381 "beq 1f\n" |
| 2382 | 2382 |
| 2383 /* Push "arg" and "fn" onto the stack that will be | 2383 /* Push "arg" and "fn" onto the stack that will be |
| 2384 * used by the child. | 2384 * used by the child. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2422 "mov lr,pc\n" | 2422 "mov lr,pc\n" |
| 2423 "ldr pc,[sp]\n" | 2423 "ldr pc,[sp]\n" |
| 2424 #endif | 2424 #endif |
| 2425 | 2425 |
| 2426 /* Call _exit(%r0). | 2426 /* Call _exit(%r0). |
| 2427 */ | 2427 */ |
| 2428 "mov r7, %10\n" | 2428 "mov r7, %10\n" |
| 2429 "swi 0x0\n" | 2429 "swi 0x0\n" |
| 2430 "1:\n" | 2430 "1:\n" |
| 2431 #ifdef __thumb2__ | 2431 #ifdef __thumb2__ |
| 2432 » » » "pop {r7}" | 2432 "pop {r7}" |
| 2433 #endif | 2433 #endif |
| 2434 : "=r" (__res) | 2434 : "=r" (__res) |
| 2435 : "i"(-EINVAL), | 2435 : "i"(-EINVAL), |
| 2436 "r"(fn), "r"(__stack), "r"(__flags), "r"(arg), | 2436 "r"(fn), "r"(__stack), "r"(__flags), "r"(arg), |
| 2437 "r"(__ptid), "r"(__tls), "r"(__ctid), | 2437 "r"(__ptid), "r"(__tls), "r"(__ctid), |
| 2438 "i"(__NR_clone), "i"(__NR_exit) | 2438 "i"(__NR_clone), "i"(__NR_exit) |
| 2439 #ifdef __thumb2__ | 2439 #ifdef __thumb2__ |
| 2440 » » » : "cc", "lr", "memory"); | 2440 : "cc", "lr", "memory"); |
| 2441 #else | 2441 #else |
| 2442 : "cc", "r7", "lr", "memory"); | 2442 : "cc", "r7", "lr", "memory"); |
| 2443 #endif | 2443 #endif |
| 2444 } | 2444 } |
| 2445 LSS_RETURN(int, __res); | 2445 LSS_RETURN(int, __res); |
| 2446 } | 2446 } |
| 2447 #elif defined(__aarch64__) | 2447 #elif defined(__aarch64__) |
| 2448 /* Most definitions of _syscallX() neglect to mark "memory" as being | 2448 /* Most definitions of _syscallX() neglect to mark "memory" as being |
| 2449 * clobbered. This causes problems with compilers, that do a better job | 2449 * clobbered. This causes problems with compilers, that do a better job |
| 2450 * at optimizing across __asm__ calls. | 2450 * at optimizing across __asm__ calls. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2559 "i"(__NR_clone), "i"(__NR_exit) | 2559 "i"(__NR_clone), "i"(__NR_exit) |
| 2560 : "cc", "x8", "memory"); | 2560 : "cc", "x8", "memory"); |
| 2561 } | 2561 } |
| 2562 LSS_RETURN(int, __res); | 2562 LSS_RETURN(int, __res); |
| 2563 } | 2563 } |
| 2564 #elif defined(__mips__) | 2564 #elif defined(__mips__) |
| 2565 #undef LSS_REG | 2565 #undef LSS_REG |
| 2566 #define LSS_REG(r,a) register unsigned long __r##r __asm__("$"#r) = \ | 2566 #define LSS_REG(r,a) register unsigned long __r##r __asm__("$"#r) = \ |
| 2567 (unsigned long)(a) | 2567 (unsigned long)(a) |
| 2568 #undef LSS_BODY | 2568 #undef LSS_BODY |
| 2569 #undef LSS_SYSCALL_CLOBBERS |
| 2570 #if _MIPS_SIM == _MIPS_SIM_ABI32 |
| 2571 #define LSS_SYSCALL_CLOBBERS "$1", "$3", "$8", "$9", "$10", \ |
| 2572 "$11", "$12", "$13", "$14", "$15", \ |
| 2573 "$24", "$25", "hi", "lo", "memory" |
| 2574 #else |
| 2575 #define LSS_SYSCALL_CLOBBERS "$1", "$3", "$10", "$11", "$12", \ |
| 2576 "$13", "$14", "$15", "$24", "$25", \ |
| 2577 "hi", "lo", "memory" |
| 2578 #endif |
| 2569 #define LSS_BODY(type,name,r7,...) \ | 2579 #define LSS_BODY(type,name,r7,...) \ |
| 2570 register unsigned long __v0 __asm__("$2") = __NR_##name; \ | 2580 register unsigned long __v0 __asm__("$2") = __NR_##name; \ |
| 2571 __asm__ __volatile__ ("syscall\n" \ | 2581 __asm__ __volatile__ ("syscall\n" \ |
| 2572 : "+r"(__v0), r7 (__r7) \ | 2582 : "+r"(__v0), r7 (__r7) \ |
| 2573 : "0"(__v0), ##__VA_ARGS__ \ | 2583 : "0"(__v0), ##__VA_ARGS__ \ |
| 2574 : "$8", "$9", "$10", "$11", "$12", \ | 2584 : LSS_SYSCALL_CLOBBERS); \ |
| 2575 "$13", "$14", "$15", "$24", "$25", \ | |
| 2576 "memory"); \ | |
| 2577 LSS_RETURN(type, __v0, __r7) | 2585 LSS_RETURN(type, __v0, __r7) |
| 2578 #undef _syscall0 | 2586 #undef _syscall0 |
| 2579 #define _syscall0(type, name) \ | 2587 #define _syscall0(type, name) \ |
| 2580 type LSS_NAME(name)(void) { \ | 2588 type LSS_NAME(name)(void) { \ |
| 2581 register unsigned long __r7 __asm__("$7"); \ | 2589 register unsigned long __r7 __asm__("$7"); \ |
| 2582 LSS_BODY(type, name, "=r"); \ | 2590 LSS_BODY(type, name, "=r"); \ |
| 2583 } | 2591 } |
| 2584 #undef _syscall1 | 2592 #undef _syscall1 |
| 2585 #define _syscall1(type, name, type1, arg1) \ | 2593 #define _syscall1(type, name, type1, arg1) \ |
| 2586 type LSS_NAME(name)(type1 arg1) { \ | 2594 type LSS_NAME(name)(type1 arg1) { \ |
| (...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4012 # pragma pop_macro("fstat64") | 4020 # pragma pop_macro("fstat64") |
| 4013 # pragma pop_macro("lstat64") | 4021 # pragma pop_macro("lstat64") |
| 4014 #endif | 4022 #endif |
| 4015 | 4023 |
| 4016 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) | 4024 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) |
| 4017 } | 4025 } |
| 4018 #endif | 4026 #endif |
| 4019 | 4027 |
| 4020 #endif | 4028 #endif |
| 4021 #endif | 4029 #endif |
| OLD | NEW |