Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: third_party/tcmalloc/chromium/src/base/linux_syscall_support.h

Issue 13648012: tcmalloc: add x32 abi support to linux_syscall_support.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2005-2008, Google Inc. 1 /* Copyright (c) 2005-2008, 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 /* Some system header files in older versions of gcc neglect to properly 141 /* Some system header files in older versions of gcc neglect to properly
142 * handle being included from C++. As it appears to be harmless to have 142 * handle being included from C++. As it appears to be harmless to have
143 * multiple nested 'extern "C"' blocks, just add another one here. 143 * multiple nested 'extern "C"' blocks, just add another one here.
144 */ 144 */
145 extern "C" { 145 extern "C" {
146 #endif 146 #endif
147 147
148 #include <errno.h> 148 #include <errno.h>
149 #include <signal.h> 149 #include <signal.h>
150 #include <stdarg.h> 150 #include <stdarg.h>
151 #include <stddef.h>
152 #include <stdint.h>
151 #include <string.h> 153 #include <string.h>
152 #include <sys/ptrace.h> 154 #include <sys/ptrace.h>
153 #include <sys/resource.h> 155 #include <sys/resource.h>
154 #include <sys/time.h> 156 #include <sys/time.h>
155 #include <sys/types.h> 157 #include <sys/types.h>
156 #include <syscall.h> 158 #include <syscall.h>
157 #include <unistd.h> 159 #include <unistd.h>
158 #include <linux/unistd.h> 160 #include <linux/unistd.h>
159 #include <endian.h> 161 #include <endian.h>
160 162
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 unsigned st_atime_nsec_; 399 unsigned st_atime_nsec_;
398 unsigned st_mtime_; 400 unsigned st_mtime_;
399 unsigned st_mtime_nsec_; 401 unsigned st_mtime_nsec_;
400 unsigned st_ctime_; 402 unsigned st_ctime_;
401 unsigned st_ctime_nsec_; 403 unsigned st_ctime_nsec_;
402 unsigned __unused4; 404 unsigned __unused4;
403 unsigned __unused5; 405 unsigned __unused5;
404 }; 406 };
405 #elif defined(__x86_64__) 407 #elif defined(__x86_64__)
406 struct kernel_stat { 408 struct kernel_stat {
407 unsigned long st_dev; 409 uint64_t st_dev;
408 unsigned long st_ino; 410 uint64_t st_ino;
409 unsigned long st_nlink; 411 uint64_t st_nlink;
410 unsigned st_mode; 412 unsigned st_mode;
411 unsigned st_uid; 413 unsigned st_uid;
412 unsigned st_gid; 414 unsigned st_gid;
413 unsigned __pad0; 415 unsigned __pad0;
414 unsigned long st_rdev; 416 uint64_t st_rdev;
415 long st_size; 417 int64_t st_size;
416 long st_blksize; 418 int64_t st_blksize;
417 long st_blocks; 419 int64_t st_blocks;
418 unsigned long st_atime_; 420 uint64_t st_atime_;
419 unsigned long st_atime_nsec_; 421 uint64_t st_atime_nsec_;
420 unsigned long st_mtime_; 422 uint64_t st_mtime_;
421 unsigned long st_mtime_nsec_; 423 uint64_t st_mtime_nsec_;
422 unsigned long st_ctime_; 424 uint64_t st_ctime_;
423 unsigned long st_ctime_nsec_; 425 uint64_t st_ctime_nsec_;
424 long __unused[3]; 426 int64_t __unused[3];
425 }; 427 };
426 #elif defined(__PPC__) 428 #elif defined(__PPC__)
427 struct kernel_stat { 429 struct kernel_stat {
428 unsigned st_dev; 430 unsigned st_dev;
429 unsigned long st_ino; // ino_t 431 unsigned long st_ino; // ino_t
430 unsigned long st_mode; // mode_t 432 unsigned long st_mode; // mode_t
431 unsigned short st_nlink; // nlink_t 433 unsigned short st_nlink; // nlink_t
432 unsigned st_uid; // uid_t 434 unsigned st_uid; // uid_t
433 unsigned st_gid; // gid_t 435 unsigned st_gid; // gid_t
434 unsigned st_rdev; 436 unsigned st_rdev;
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 : "i" (__NR_sigreturn)); 1008 : "i" (__NR_sigreturn));
1007 return res; 1009 return res;
1008 } 1010 }
1009 #elif defined(__x86_64__) 1011 #elif defined(__x86_64__)
1010 /* There are no known problems with any of the _syscallX() macros 1012 /* There are no known problems with any of the _syscallX() macros
1011 * currently shipping for x86_64, but we still need to be able to define 1013 * currently shipping for x86_64, but we still need to be able to define
1012 * our own version so that we can override the location of the errno 1014 * our own version so that we can override the location of the errno
1013 * location (e.g. when using the clone() system call with the CLONE_VM 1015 * location (e.g. when using the clone() system call with the CLONE_VM
1014 * option). 1016 * option).
1015 */ 1017 */
1018 #undef LSS_ENTRYPOINT
1019 #define LSS_ENTRYPOINT "syscall\n"
1020
1021 /* The x32 ABI has 32 bit longs, but the syscall interface is 64 bit.
1022 * We need to explicitly cast to an unsigned 64 bit type to avoid implicit
1023 * sign extension. We can't cast pointers directly because those are
1024 * 32 bits, and gcc will dump ugly warnings about casting from a pointer
1025 * to an integer of a different size.
1026 */
1027 #undef LSS_SYSCALL_ARG
1028 #define LSS_SYSCALL_ARG(a) ((uint64_t)(uintptr_t)(a))
1029 #undef _LSS_RETURN
1030 #define _LSS_RETURN(type, res, cast) \
1031 do { \
1032 if ((uint64_t)(res) >= (uint64_t)(-4095)) { \
1033 LSS_ERRNO = -(res); \
1034 res = -1; \
1035 } \
1036 return (type)(cast)(res); \
1037 } while (0)
1038 #undef LSS_RETURN
1039 #define LSS_RETURN(type, res) _LSS_RETURN(type, res, uintptr_t)
1040
1041 #undef _LSS_BODY
1042 #define _LSS_BODY(nr, type, name, cast, ...) \
1043 long long __res; \
1044 __asm__ __volatile__(LSS_BODY_ASM##nr LSS_ENTRYPOINT \
1045 : "=a" (__res) \
1046 : "0" (__NR_##name) LSS_BODY_ARG##nr(__VA_ARGS__) \
1047 : LSS_BODY_CLOBBER##nr "r11", "rcx", "memory"); \
1048 _LSS_RETURN(type, __res, cast)
1016 #undef LSS_BODY 1049 #undef LSS_BODY
1017 #define LSS_BODY(type,name, ...) \ 1050 #define LSS_BODY(nr, type, name, args...) \
1018 long __res; \ 1051 _LSS_BODY(nr, type, name, uintptr_t, ## args)
1019 __asm__ __volatile__("syscall" : "=a" (__res) : "0" (__NR_##name), \ 1052
1020 ##__VA_ARGS__ : "r11", "rcx", "memory"); \ 1053 #undef LSS_BODY_ASM0
1021 LSS_RETURN(type, __res) 1054 #undef LSS_BODY_ASM1
1055 #undef LSS_BODY_ASM2
1056 #undef LSS_BODY_ASM3
1057 #undef LSS_BODY_ASM4
1058 #undef LSS_BODY_ASM5
1059 #undef LSS_BODY_ASM6
1060 #define LSS_BODY_ASM0
1061 #define LSS_BODY_ASM1 LSS_BODY_ASM0
1062 #define LSS_BODY_ASM2 LSS_BODY_ASM1
1063 #define LSS_BODY_ASM3 LSS_BODY_ASM2
1064 #define LSS_BODY_ASM4 LSS_BODY_ASM3 "movq %5,%%r10;"
1065 #define LSS_BODY_ASM5 LSS_BODY_ASM4 "movq %6,%%r8;"
1066 #define LSS_BODY_ASM6 LSS_BODY_ASM5 "movq %7,%%r9;"
1067
1068 #undef LSS_BODY_CLOBBER0
1069 #undef LSS_BODY_CLOBBER1
1070 #undef LSS_BODY_CLOBBER2
1071 #undef LSS_BODY_CLOBBER3
1072 #undef LSS_BODY_CLOBBER4
1073 #undef LSS_BODY_CLOBBER5
1074 #undef LSS_BODY_CLOBBER6
1075 #define LSS_BODY_CLOBBER0
1076 #define LSS_BODY_CLOBBER1 LSS_BODY_CLOBBER0
1077 #define LSS_BODY_CLOBBER2 LSS_BODY_CLOBBER1
1078 #define LSS_BODY_CLOBBER3 LSS_BODY_CLOBBER2
1079 #define LSS_BODY_CLOBBER4 LSS_BODY_CLOBBER3 "r10",
1080 #define LSS_BODY_CLOBBER5 LSS_BODY_CLOBBER4 "r8",
1081 #define LSS_BODY_CLOBBER6 LSS_BODY_CLOBBER5 "r9",
1082
1083 #undef LSS_BODY_ARG0
1084 #undef LSS_BODY_ARG1
1085 #undef LSS_BODY_ARG2
1086 #undef LSS_BODY_ARG3
1087 #undef LSS_BODY_ARG4
1088 #undef LSS_BODY_ARG5
1089 #undef LSS_BODY_ARG6
1090 #define LSS_BODY_ARG0()
1091 #define LSS_BODY_ARG1(arg1) \
1092 LSS_BODY_ARG0(), "D" (arg1)
1093 #define LSS_BODY_ARG2(arg1, arg2) \
1094 LSS_BODY_ARG1(arg1), "S" (arg2)
1095 #define LSS_BODY_ARG3(arg1, arg2, arg3) \
1096 LSS_BODY_ARG2(arg1, arg2), "d" (arg3)
1097 #define LSS_BODY_ARG4(arg1, arg2, arg3, arg4) \
1098 LSS_BODY_ARG3(arg1, arg2, arg3), "r" (arg4)
1099 #define LSS_BODY_ARG5(arg1, arg2, arg3, arg4, arg5) \
1100 LSS_BODY_ARG4(arg1, arg2, arg3, arg4), "r" (arg5)
1101 #define LSS_BODY_ARG6(arg1, arg2, arg3, arg4, arg5, arg6) \
1102 LSS_BODY_ARG5(arg1, arg2, arg3, arg4, arg5), "r" (arg6)
1103
1022 #undef _syscall0 1104 #undef _syscall0
1023 #define _syscall0(type,name) \ 1105 #define _syscall0(type,name) \
1024 type LSS_NAME(name)() { \ 1106 type LSS_NAME(name)() { \
1025 LSS_BODY(type, name); \ 1107 LSS_BODY(0, type, name); \
1026 } 1108 }
1027 #undef _syscall1 1109 #undef _syscall1
1028 #define _syscall1(type,name,type1,arg1) \ 1110 #define _syscall1(type,name,type1,arg1) \
1029 type LSS_NAME(name)(type1 arg1) { \ 1111 type LSS_NAME(name)(type1 arg1) { \
1030 LSS_BODY(type, name, "D" ((long)(arg1))); \ 1112 LSS_BODY(1, type, name, LSS_SYSCALL_ARG(arg1)); \
1031 } 1113 }
1032 #undef _syscall2 1114 #undef _syscall2
1033 #define _syscall2(type,name,type1,arg1,type2,arg2) \ 1115 #define _syscall2(type,name,type1,arg1,type2,arg2) \
1034 type LSS_NAME(name)(type1 arg1, type2 arg2) { \ 1116 type LSS_NAME(name)(type1 arg1, type2 arg2) { \
1035 LSS_BODY(type, name, "D" ((long)(arg1)), "S" ((long)(arg2))); \ 1117 LSS_BODY(2, type, name, LSS_SYSCALL_ARG(arg1), LSS_SYSCALL_ARG(arg2));\
1036 } 1118 }
1037 #undef _syscall3 1119 #undef _syscall3
1038 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ 1120 #define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
1039 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3) { \ 1121 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3) { \
1040 LSS_BODY(type, name, "D" ((long)(arg1)), "S" ((long)(arg2)), \ 1122 LSS_BODY(3, type, name, LSS_SYSCALL_ARG(arg1), LSS_SYSCALL_ARG(arg2), \
1041 "d" ((long)(arg3))); \ 1123 LSS_SYSCALL_ARG(arg3)); \
1042 } 1124 }
1043 #undef _syscall4 1125 #undef _syscall4
1044 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ 1126 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
1045 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ 1127 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \
1046 long __res; \ 1128 LSS_BODY(4, type, name, LSS_SYSCALL_ARG(arg1), LSS_SYSCALL_ARG(arg2), \
1047 __asm__ __volatile__("movq %5,%%r10; syscall" : \ 1129 LSS_SYSCALL_ARG(arg3), LSS_SYSCALL_ARG(arg4));\
1048 "=a" (__res) : "0" (__NR_##name), \
1049 "D" ((long)(arg1)), "S" ((long)(arg2)), "d" ((long)(arg3)), \
1050 "r" ((long)(arg4)) : "r10", "r11", "rcx", "memory"); \
1051 LSS_RETURN(type, __res); \
1052 } 1130 }
1053 #undef _syscall5 1131 #undef _syscall5
1054 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ 1132 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
1055 type5,arg5) \ 1133 type5,arg5) \
1056 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ 1134 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
1057 type5 arg5) { \ 1135 type5 arg5) { \
1058 long __res; \ 1136 LSS_BODY(5, type, name, LSS_SYSCALL_ARG(arg1), LSS_SYSCALL_ARG(arg2), \
1059 __asm__ __volatile__("movq %5,%%r10; movq %6,%%r8; syscall" : \ 1137 LSS_SYSCALL_ARG(arg3), LSS_SYSCALL_ARG(arg4), \
1060 "=a" (__res) : "0" (__NR_##name), \ 1138 LSS_SYSCALL_ARG(arg5)); \
1061 "D" ((long)(arg1)), "S" ((long)(arg2)), "d" ((long)(arg3)), \
1062 "r" ((long)(arg4)), "r" ((long)(arg5)) : \
1063 "r8", "r10", "r11", "rcx", "memory"); \
1064 LSS_RETURN(type, __res); \
1065 } 1139 }
1066 #undef _syscall6 1140 #undef _syscall6
1067 #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ 1141 #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
1068 type5,arg5,type6,arg6) \ 1142 type5,arg5,type6,arg6) \
1069 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ 1143 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
1070 type5 arg5, type6 arg6) { \ 1144 type5 arg5, type6 arg6) { \
1071 long __res; \ 1145 LSS_BODY(6, type, name, LSS_SYSCALL_ARG(arg1), LSS_SYSCALL_ARG(arg2), \
1072 __asm__ __volatile__("movq %5,%%r10; movq %6,%%r8; movq %7,%%r9;" \ 1146 LSS_SYSCALL_ARG(arg3), LSS_SYSCALL_ARG(arg4), \
1073 "syscall" : \ 1147 LSS_SYSCALL_ARG(arg5), LSS_SYSCALL_ARG(arg6));\
1074 "=a" (__res) : "0" (__NR_##name), \
1075 "D" ((long)(arg1)), "S" ((long)(arg2)), "d" ((long)(arg3)), \
1076 "r" ((long)(arg4)), "r" ((long)(arg5)), "r" ((long)(arg6)) : \
1077 "r8", "r9", "r10", "r11", "rcx", "memory"); \
1078 LSS_RETURN(type, __res); \
1079 } 1148 }
1080 LSS_INLINE int LSS_NAME(clone)(int (*fn)(void *), void *child_stack, 1149 LSS_INLINE int LSS_NAME(clone)(int (*fn)(void *), void *child_stack,
1081 int flags, void *arg, int *parent_tidptr, 1150 int flags, void *arg, int *parent_tidptr,
1082 void *newtls, int *child_tidptr) { 1151 void *newtls, int *child_tidptr) {
1083 long __res; 1152 long long __res;
1084 { 1153 {
1085 __asm__ __volatile__(/* if (fn == NULL) 1154 __asm__ __volatile__(/* if (fn == NULL)
1086 * return -EINVAL; 1155 * return -EINVAL;
1087 */ 1156 */
1088 "testq %4,%4\n" 1157 "testq %4,%4\n"
1089 "jz 1f\n" 1158 "jz 1f\n"
1090 1159
1091 /* if (child_stack == NULL) 1160 /* if (child_stack == NULL)
1092 * return -EINVAL; 1161 * return -EINVAL;
1093 */ 1162 */
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 */ 1207 */
1139 "movq %%rax,%%rdi\n" 1208 "movq %%rax,%%rdi\n"
1140 "movq %3,%%rax\n" 1209 "movq %3,%%rax\n"
1141 "syscall\n" 1210 "syscall\n"
1142 1211
1143 /* Return to parent. 1212 /* Return to parent.
1144 */ 1213 */
1145 "1:\n" 1214 "1:\n"
1146 : "=a" (__res) 1215 : "=a" (__res)
1147 : "0"(-EINVAL), "i"(__NR_clone), "i"(__NR_exit), 1216 : "0"(-EINVAL), "i"(__NR_clone), "i"(__NR_exit),
1148 "r"(fn), "S"(child_stack), "D"(flags), "r"(arg), 1217 "r"(LSS_SYSCALL_ARG(fn)),
1149 "d"(parent_tidptr), "g"(newtls), "g"(child_tidptr ) 1218 "S"(LSS_SYSCALL_ARG(child_stack)),
1219 "D"(LSS_SYSCALL_ARG(flags)),
1220 "r"(LSS_SYSCALL_ARG(arg)),
1221 "d"(LSS_SYSCALL_ARG(parent_tidptr)),
1222 "r"(LSS_SYSCALL_ARG(newtls)),
1223 "r"(LSS_SYSCALL_ARG(child_tidptr))
1150 : "rsp", "memory", "r8", "r10", "r11", "rcx"); 1224 : "rsp", "memory", "r8", "r10", "r11", "rcx");
1151 } 1225 }
1152 LSS_RETURN(int, __res); 1226 LSS_RETURN(int, __res);
1153 } 1227 }
1154 1228
1155 LSS_INLINE void (*LSS_NAME(restore_rt)(void))(void) { 1229 LSS_INLINE void (*LSS_NAME(restore_rt)(void))(void) {
1156 /* On x86-64, the kernel does not know how to return from 1230 /* On x86-64, the kernel does not know how to return from
1157 * a signal handler. Instead, it relies on user space to provide a 1231 * a signal handler. Instead, it relies on user space to provide a
1158 * restorer function that calls the rt_sigreturn() system call. 1232 * restorer function that calls the rt_sigreturn() system call.
1159 * Unfortunately, we cannot just reference the glibc version of this 1233 * Unfortunately, we cannot just reference the glibc version of this
1160 * function, as glibc goes out of its way to make it inaccessible. 1234 * function, as glibc goes out of its way to make it inaccessible.
1161 */ 1235 */
1162 void (*res)(void); 1236 long long res;
1163 __asm__ __volatile__("call 2f\n" 1237 __asm__ __volatile__("call 2f\n"
1164 "0:.align 16\n" 1238 "0:.align 16\n"
1165 "1:movq %1,%%rax\n" 1239 "1:movq %1,%%rax\n"
1166 "syscall\n" 1240 "syscall\n"
1167 "2:popq %0\n" 1241 "2:popq %0\n"
1168 "addq $(1b-0b),%0\n" 1242 "addq $(1b-0b),%0\n"
1169 : "=a" (res) 1243 : "=a" (res)
1170 : "i" (__NR_rt_sigreturn)); 1244 : "i" (__NR_rt_sigreturn));
1171 return res; 1245 return (void (*)(void))(uintptr_t)res;
1172 } 1246 }
1173 #elif defined(__arm__) 1247 #elif defined(__arm__)
1174 /* Most definitions of _syscallX() neglect to mark "memory" as being 1248 /* Most definitions of _syscallX() neglect to mark "memory" as being
1175 * clobbered. This causes problems with compilers, that do a better job 1249 * clobbered. This causes problems with compilers, that do a better job
1176 * at optimizing across __asm__ calls. 1250 * at optimizing across __asm__ calls.
1177 * So, we just have to redefine all fo the _syscallX() macros. 1251 * So, we just have to redefine all fo the _syscallX() macros.
1178 */ 1252 */
1179 #undef LSS_REG 1253 #undef LSS_REG
1180 #define LSS_REG(r,a) register long __r##r __asm__("r"#r) = (long)a 1254 #define LSS_REG(r,a) register long __r##r __asm__("r"#r) = (long)a
1181 1255
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 struct kernel_dirent*, d, int, c) 1864 struct kernel_dirent*, d, int, c)
1791 #ifdef __NR_getdents64 1865 #ifdef __NR_getdents64
1792 LSS_INLINE _syscall3(int, getdents64, int, f, 1866 LSS_INLINE _syscall3(int, getdents64, int, f,
1793 struct kernel_dirent64*, d, int, c) 1867 struct kernel_dirent64*, d, int, c)
1794 #endif 1868 #endif
1795 LSS_INLINE _syscall0(pid_t, getpid) 1869 LSS_INLINE _syscall0(pid_t, getpid)
1796 LSS_INLINE _syscall0(pid_t, getppid) 1870 LSS_INLINE _syscall0(pid_t, getppid)
1797 LSS_INLINE _syscall0(pid_t, _gettid) 1871 LSS_INLINE _syscall0(pid_t, _gettid)
1798 LSS_INLINE _syscall2(int, kill, pid_t, p, 1872 LSS_INLINE _syscall2(int, kill, pid_t, p,
1799 int, s) 1873 int, s)
1800 LSS_INLINE _syscall3(off_t, lseek, int, f, 1874 #if defined(__x86_64__)
1801 off_t, o, int, w) 1875 /* Need to make sure off_t isn't truncated to 32-bits under x32. */
1876 LSS_INLINE off_t LSS_NAME(lseek)(int f, off_t o, int w) {
1877 _LSS_BODY(3, off_t, lseek, off_t, LSS_SYSCALL_ARG(f), (uint64_t)(o),
1878 LSS_SYSCALL_ARG(w));
1879 }
1880 #else
1881 LSS_INLINE _syscall3(off_t, lseek, int, f,
1882 off_t, o, int, w)
1883 #endif
1802 LSS_INLINE _syscall2(int, munmap, void*, s, 1884 LSS_INLINE _syscall2(int, munmap, void*, s,
1803 size_t, l) 1885 size_t, l)
1804 LSS_INLINE _syscall5(void*, _mremap, void*, o, 1886 LSS_INLINE _syscall5(void*, _mremap, void*, o,
1805 size_t, os, size_t, ns, 1887 size_t, os, size_t, ns,
1806 unsigned long, f, void *, a) 1888 unsigned long, f, void *, a)
1807 LSS_INLINE _syscall3(int, open, const char*, p, 1889 LSS_INLINE _syscall3(int, open, const char*, p,
1808 int, f, int, m) 1890 int, f, int, m)
1809 LSS_INLINE _syscall2(int, prctl, int, o, 1891 LSS_INLINE _syscall2(int, prctl, int, o,
1810 long, a) 1892 long, a)
1811 LSS_INLINE _syscall4(long, ptrace, int, r, 1893 LSS_INLINE _syscall4(long, ptrace, int, r,
(...skipping 16 matching lines...) Expand all
1828 #if defined(__NR_getcpu) 1910 #if defined(__NR_getcpu)
1829 LSS_INLINE _syscall3(long, getcpu, unsigned *, cpu, 1911 LSS_INLINE _syscall3(long, getcpu, unsigned *, cpu,
1830 unsigned *, node, void *, unused); 1912 unsigned *, node, void *, unused);
1831 #endif 1913 #endif
1832 #if defined(__x86_64__) || \ 1914 #if defined(__x86_64__) || \
1833 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI32) 1915 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI32)
1834 LSS_INLINE _syscall3(int, socket, int, d, 1916 LSS_INLINE _syscall3(int, socket, int, d,
1835 int, t, int, p) 1917 int, t, int, p)
1836 #endif 1918 #endif
1837 #if defined(__x86_64__) 1919 #if defined(__x86_64__)
1838 LSS_INLINE _syscall6(void*, mmap, void*, s, 1920 /* Need to make sure __off64_t isn't truncated to 32-bits under x32. */
1839 size_t, l, int, p, 1921 LSS_INLINE void* LSS_NAME(mmap)(void *s, size_t l, int p, int f, int d,
1840 int, f, int, d, 1922 __off64_t o) {
1841 __off64_t, o) 1923 LSS_BODY(6, void*, mmap, LSS_SYSCALL_ARG(s), LSS_SYSCALL_ARG(l),
1924 LSS_SYSCALL_ARG(p), LSS_SYSCALL_ARG(f),
1925 LSS_SYSCALL_ARG(d), (uint64_t)(o));
1926 }
1842 1927
1843 LSS_INLINE int LSS_NAME(sigaction)(int signum, 1928 LSS_INLINE int LSS_NAME(sigaction)(int signum,
1844 const struct kernel_sigaction *act, 1929 const struct kernel_sigaction *act,
1845 struct kernel_sigaction *oldact) { 1930 struct kernel_sigaction *oldact) {
1846 /* On x86_64, the kernel requires us to always set our own 1931 /* On x86_64, the kernel requires us to always set our own
1847 * SA_RESTORER in order to be able to return from a signal handler. 1932 * SA_RESTORER in order to be able to return from a signal handler.
1848 * This function must have a "magic" signature that the "gdb" 1933 * This function must have a "magic" signature that the "gdb"
1849 * (and maybe the kernel?) can recognize. 1934 * (and maybe the kernel?) can recognize.
1850 */ 1935 */
1851 if (act != NULL && !(act->sa_flags & SA_RESTORER)) { 1936 if (act != NULL && !(act->sa_flags & SA_RESTORER)) {
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
2173 return rc; 2258 return rc;
2174 } 2259 }
2175 #endif 2260 #endif
2176 2261
2177 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) 2262 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS)
2178 } 2263 }
2179 #endif 2264 #endif
2180 2265
2181 #endif 2266 #endif
2182 #endif 2267 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698