this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

32-bit Hello world working once again in Darling

+450 -80
+14 -1
platform-include/architecture/i386/asm_help.h
··· 317 317 1: ; \ 318 318 popl %edx ; \ 319 319 2: ; \ 320 - addl $_GLOBAL_OFFSET_TABLE_+(2b-1b),%edx 320 + addl $_GLOBAL_OFFSET_TABLE_+(2b-1b),%edx ; \ 321 + movl var@GOT(%edx), %edx 321 322 322 323 #endif // DARLING 323 324 #elif defined(__x86_64__) ··· 383 384 #endif 384 385 385 386 #if defined(__i386__) 387 + #ifndef DARLING 386 388 #define EXTERN_TO_REG(var, reg) \ 387 389 call 1f ; \ 388 390 1: ; \ 389 391 popl %edx ; \ 390 392 movl L ## var ##__non_lazy_ptr-1b(%edx),reg ; \ 391 393 NON_LAZY_STUB(var) 394 + #else // DARLING 395 + #define EXTERN_TO_REG(var, reg) \ 396 + call 1f ; \ 397 + 1: ; \ 398 + popl %edx ; \ 399 + 2: ; \ 400 + addl $_GLOBAL_OFFSET_TABLE_+(2b-1b),%edx ; \ 401 + movl var@GOT(%edx), %edx; \ 402 + movl (%edx), reg 403 + #endif 404 + 392 405 #elif defined(__x86_64__) 393 406 #define EXTERN_TO_REG(var, reg) \ 394 407 PICIFY(var) ; \
+4
src/duct/include/commpage.h
··· 50 50 #define _COMM_PAGE_APPROX_TIME_SUPPORTED (_COMM_PAGE_START_ADDRESS+0x080) 51 51 #define _COMM_PAGE_APPROX_TIME (_COMM_PAGE_START_ADDRESS+0x088) 52 52 53 + #define _COMM_TEXT_PFZ_ENQUEUE_OFFSET (_COMM_PAGE_START_ADDRESS+0xc00) 54 + #define _COMM_TEXT_PFZ_DEQUEUE_OFFSET (_COMM_PAGE_START_ADDRESS+0xc80) 55 + #define _COMM_TEXT_PFZ_MUTEX_LOCK_OFFSET (_COMM_PAGE_START_ADDRESS+0xd00) 56 + 53 57 #define _COMM_PAGE_END (_COMM_PAGE_START_ADDRESS+0xfff) /* end of common page */ 54 58 55 59 #define _COMM_PAGE_TEXT_START (_COMM_PAGE_START_ADDRESS+0x1000)
+2
src/kernel/emulation/linux/CMakeLists.txt
··· 45 45 unistd/getpid.c 46 46 unistd/lseek.c 47 47 unistd/ftruncate.c 48 + unistd/truncate.c 48 49 unistd/access.c 49 50 unistd/readlink.c 50 51 unistd/symlink.c ··· 54 55 unistd/mknod.c 55 56 unistd/chmod.c 56 57 unistd/chown.c 58 + unistd/lchown.c 57 59 unistd/umask.c 58 60 unistd/chroot.c 59 61 unistd/getgid.c
+32 -1
src/kernel/emulation/linux/base.c
··· 15 15 "ret"); 16 16 } 17 17 #elif defined(__i386__) 18 + __attribute__((naked)) 18 19 long linux_syscall(long a1, long a2, long a3, long a4, long a5, long a6, int nr) 19 20 { 20 - __asm__("sysenter\n" 21 + /* 22 + __asm__("push %%ecx\n" 23 + "push %%edx\n" 24 + "push %%ebp\n" 25 + "movl %%esp, %%ebp\n" 26 + "sysenter\n" 21 27 "ret\n" 22 28 :: "a"(nr), "b" (a1), "c"(a2), "d"(a3), 23 29 "S"(a4), "D"(a5), "ebp"(a6)); 30 + __builtin_unreachable(); 31 + */ 32 + __asm__("push %ebp\n" 33 + "call 1f\n" 34 + "1:\n" 35 + "pop %ebp\n" 36 + "addl $(2f-1b), %ebp\n" 37 + "push %ebp\n" 38 + "push %ecx\n" 39 + "push %edx\n" 40 + "movl 28+16(%esp), %eax\n" 41 + "movl 4+16(%esp), %ebx\n" 42 + "movl 8+16(%esp), %ecx\n" 43 + "movl 12+16(%esp), %edx\n" 44 + "movl 16+16(%esp), %esi\n" 45 + "movl 20+16(%esp), %edi\n" 46 + "push %ebp\n" 47 + "movl 24+16(%esp), %ebp\n" 48 + "movl %ebp, -4(%esp)\n" 49 + "movl %esp, %ebp\n" 50 + "sysenter\n" 51 + "2:\n" 52 + "pop %ebp\n" 53 + "ret" 54 + ); 24 55 } 25 56 #else 26 57 # error Unsupported platform!
+4
src/kernel/emulation/linux/fcntl/fcntl.c
··· 82 82 return -EINVAL; 83 83 } 84 84 85 + #ifdef __NR_fcntl64 86 + ret = LINUX_SYSCALL(__NR_fcntl64, fd, linux_cmd, arg); 87 + #else 85 88 ret = LINUX_SYSCALL(__NR_fcntl, fd, linux_cmd, arg); 89 + #endif 86 90 if (ret < 0) 87 91 { 88 92 ret = errno_linux_to_bsd(ret);
+1 -1
src/kernel/emulation/linux/network/accept.c
··· 16 16 struct sockaddr_fixup* fixed; 17 17 18 18 #ifdef __NR_socketcall 19 - ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_ACCEPT, fd, from, socklen); 19 + ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_ACCEPT, ((long[6]) { fd, from, socklen })); 20 20 #else 21 21 ret = LINUX_SYSCALL(__NR_accept, fd, from, socklen); 22 22 #endif
+1 -1
src/kernel/emulation/linux/network/connect.c
··· 28 28 fixed->linux_family = sfamily_bsd_to_linux(fixed->bsd_family); 29 29 30 30 #ifdef __NR_socketcall 31 - ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_CONNECT, fd, fixed, socklen); 31 + ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_CONNECT, ((long[6]) { fd, fixed, socklen })); 32 32 #else 33 33 ret = LINUX_SYSCALL(__NR_connect, fd, fixed, socklen); 34 34 #endif
+2 -1
src/kernel/emulation/linux/network/getpeername.c
··· 10 10 struct sockaddr_fixup* fixed; 11 11 12 12 #ifdef __NR_socketcall 13 - ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_GETPEERNAME, fd, asa, socklen); 13 + ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_GETPEERNAME, 14 + ((long[6]) { fd, asa, socklen })); 14 15 #else 15 16 ret = LINUX_SYSCALL(__NR_getpeername, fd, asa, socklen); 16 17 #endif
+2 -1
src/kernel/emulation/linux/network/getsockname.c
··· 10 10 struct sockaddr_fixup* fixed; 11 11 12 12 #ifdef __NR_socketcall 13 - ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_GETSOCKNAME, fd, asa, socklen); 13 + ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_GETSOCKNAME, 14 + ((long[6]) { fd, asa, socklen })); 14 15 #else 15 16 ret = LINUX_SYSCALL(__NR_getsockname, fd, asa, socklen); 16 17 #endif
+2 -2
src/kernel/emulation/linux/network/recvfrom.c
··· 22 22 linux_flags = msgflags_bsd_to_linux(flags); 23 23 24 24 #ifdef __NR_socketcall 25 - ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_RECVFROM, fd, buf, len, 26 - flags, from, socklen); 25 + ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_RECVFROM, ((long[6]) { fd, buf, len, 26 + flags, from, socklen })); 27 27 #else 28 28 ret = LINUX_SYSCALL(__NR_connect, fd, buf, len, flags, from, socklen); 29 29 #endif
+2 -1
src/kernel/emulation/linux/network/recvmsg.c
··· 42 42 linux_flags = msgflags_bsd_to_linux(flags); 43 43 44 44 #ifdef __NR_socketcall 45 - ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_RECVMSG, socket, &lmsg, linux_flags); 45 + ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_RECVMSG, 46 + ((long[6]) { socket, &lmsg, linux_flags })); 46 47 #else 47 48 ret = LINUX_SYSCALL(__NR_recvmsg, socket, &lmsg, linux_flags); 48 49 #endif
+2 -1
src/kernel/emulation/linux/network/sendmsg.c
··· 53 53 linux_flags = msgflags_bsd_to_linux(flags); 54 54 55 55 #ifdef __NR_socketcall 56 - ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_SENDMSG, socket, &lmsg, linux_flags); 56 + ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_SENDMSG, 57 + ((long[6]) { socket, &lmsg, linux_flags })); 57 58 #else 58 59 ret = LINUX_SYSCALL(__NR_recvmsg, socket, &lmsg, linux_flags); 59 60 #endif
+2 -1
src/kernel/emulation/linux/network/shutdown.c
··· 10 10 int ret; 11 11 12 12 #ifdef __NR_socketcall 13 - ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_SHUTDOWN, fd, how); 13 + ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_SHUTDOWN, 14 + ((long[6]) { fd, how })); 14 15 #else 15 16 ret = LINUX_SYSCALL(__NR_shutdown, fd, how); 16 17 #endif
+2 -1
src/kernel/emulation/linux/network/socket.c
··· 26 26 } 27 27 28 28 #ifdef __NR_socketcall 29 - ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_SOCKET, linux_domain, type, protocol); 29 + ret = LINUX_SYSCALL(__NR_socketcall, LINUX_SYS_SOCKET, 30 + ((long[6]) { linux_domain, type, protocol })); 30 31 #else 31 32 ret = LINUX_SYSCALL(__NR_socket, linux_domain, type, protocol); 32 33 #endif
+5
src/kernel/emulation/linux/select/select.c
··· 20 20 ltv.tv_usec = timeout->tv_usec; 21 21 } 22 22 23 + #ifdef __NR__newselect 24 + ret = LINUX_SYSCALL(__NR__newselect, nfds, rfds, wfds, efds, 25 + (timeout != NULL) ? &ltv : NULL); 26 + #else 23 27 ret = LINUX_SYSCALL(__NR_select, nfds, rfds, wfds, efds, 24 28 (timeout != NULL) ? &ltv : NULL); 29 + #endif 25 30 if (ret < 0) 26 31 ret = errno_linux_to_bsd(ret); 27 32
+27 -15
src/kernel/emulation/linux/syscalls-table.S
··· 16 16 17 17 #elif defined(__i386__) 18 18 19 + #define copy_arg(off) \ 20 + movl 8+off(%esp), %ecx ;\ 21 + movl %ecx, -24+off(%esp) 22 + 19 23 __darling_bsd_syscall: 20 - calll .L0$pb 24 + calll .L0$pb 21 25 .L0$pb: 22 - popl %ecx 26 + popl %ecx 23 27 .Ltmp0: 24 - addl $_GLOBAL_OFFSET_TABLE_+(.Ltmp0-.L0$pb), %ecx 25 - movl __bsd_syscall_table@GOT(%eax), %eax 26 - movl (%eax), %eax 27 - movl 8(%esp), %ecx 28 - movl (%eax,%ecx,4), %eax 29 - test %eax, %eax 30 - jz .no_sys 31 - call *%eax 32 - ret 28 + addl $_GLOBAL_OFFSET_TABLE_+(.Ltmp0-.L0$pb), %ecx 29 + movl __bsd_syscall_table@GOT(%ecx), %ecx 30 + andl $0xffff, %eax // Because there is some extra stuff in upper bytes we don't need 31 + movl (%ecx,%eax,4), %eax 32 + test %eax, %eax 33 + jz .no_sys 34 + // Copy arguments 35 + copy_arg(0) 36 + copy_arg(4) 37 + copy_arg(8) 38 + copy_arg(12) 39 + copy_arg(16) 40 + copy_arg(20) 41 + subl $24, %esp 42 + call *%eax 43 + addl $24, %esp 44 + ret 33 45 .no_sys: 34 - pushl %ecx 35 - call __unknown_syscall@PLT 36 - addl $4, %esp 37 - ret 46 + pushl %ecx 47 + call __unknown_syscall@PLT 48 + addl $4, %esp 49 + ret 38 50 39 51 #else 40 52 # error Missing assembly
+4
src/kernel/emulation/linux/syscalls.c
··· 26 26 #include "unistd/getpid.h" 27 27 #include "unistd/access.h" 28 28 #include "unistd/lseek.h" 29 + #include "unistd/truncate.h" 29 30 #include "unistd/ftruncate.h" 30 31 #include "unistd/readlink.h" 31 32 #include "unistd/readv.h" ··· 40 41 #include "unistd/mknod.h" 41 42 #include "unistd/chmod.h" 42 43 #include "unistd/chown.h" 44 + #include "unistd/lchown.h" 43 45 #include "unistd/getgid.h" 44 46 #include "unistd/getppid.h" 45 47 #include "unistd/rename.h" ··· 204 206 [196] = sys_getdirentries, 205 207 [197] = sys_mmap, 206 208 [199] = sys_lseek, 209 + [200] = sys_truncate, 207 210 [201] = sys_ftruncate, 208 211 [202] = sys_sysctl, 209 212 [216] = sys_mkcomplex, ··· 245 248 [347] = sys_getfsstat64, 246 249 [360] = sys_bsdthread_create, 247 250 [361] = sys_bsdthread_terminate, 251 + [364] = sys_lchown, 248 252 [366] = sys_bsdthread_register, 249 253 [367] = sys_workq_open, 250 254 [368] = sys_workq_kernreturn,
+4 -1
src/kernel/emulation/linux/unistd/chown.c
··· 8 8 int ret; 9 9 10 10 // TODO: case translation 11 - 11 + #ifdef __NR_chown32 12 + ret = LINUX_SYSCALL(__NR_chown32, path, uid, gid); 13 + #else 12 14 ret = LINUX_SYSCALL(__NR_chown, path, uid, gid); 15 + #endif 13 16 if (ret < 0) 14 17 ret = errno_linux_to_bsd(ret); 15 18
+4
src/kernel/emulation/linux/unistd/fchown.c
··· 7 7 { 8 8 int ret; 9 9 10 + #ifdef __NR_fchown32 11 + ret = LINUX_SYSCALL3(__NR_fchown32, fd, uid, gid); 12 + #else 10 13 ret = LINUX_SYSCALL3(__NR_fchown, fd, uid, gid); 14 + #endif 11 15 if (ret < 0) 12 16 ret = errno_linux_to_bsd(ret); 13 17
+4
src/kernel/emulation/linux/unistd/ftruncate.c
··· 7 7 { 8 8 int ret; 9 9 10 + #ifdef __NR_ftruncate64 11 + ret = LINUX_SYSCALL(__NR_ftruncate64, fd, LL_ARG(length)); 12 + #else 10 13 ret = LINUX_SYSCALL(__NR_ftruncate, fd, LL_ARG(length)); 14 + #endif 11 15 if (ret < 0) 12 16 ret = errno_linux_to_bsd(ret); 13 17
+4
src/kernel/emulation/linux/unistd/getegid.c
··· 7 7 { 8 8 int ret; 9 9 10 + #ifdef __NR_getegid32 11 + ret = LINUX_SYSCALL0(__NR_getegid32); 12 + #else 10 13 ret = LINUX_SYSCALL0(__NR_getegid); 14 + #endif 11 15 if (ret < 0) 12 16 ret = errno_linux_to_bsd(ret); 13 17
+4
src/kernel/emulation/linux/unistd/geteuid.c
··· 7 7 { 8 8 int ret; 9 9 10 + #ifdef __NR_geteuid32 11 + ret = LINUX_SYSCALL0(__NR_geteuid32); 12 + #else 10 13 ret = LINUX_SYSCALL0(__NR_geteuid); 14 + #endif 11 15 if (ret < 0) 12 16 ret = errno_linux_to_bsd(ret); 13 17
+4
src/kernel/emulation/linux/unistd/getgid.c
··· 7 7 { 8 8 int ret; 9 9 10 + #ifdef __NR_getgid32 11 + ret = LINUX_SYSCALL0(__NR_getgid32); 12 + #else 10 13 ret = LINUX_SYSCALL0(__NR_getgid); 14 + #endif 11 15 if (ret < 0) 12 16 ret = errno_linux_to_bsd(ret); 13 17
+4
src/kernel/emulation/linux/unistd/getgroups.c
··· 7 7 { 8 8 int ret; 9 9 10 + #ifdef __NR_getgroups32 11 + ret = LINUX_SYSCALL(__NR_getgroups32, size, gidset); 12 + #else 10 13 ret = LINUX_SYSCALL(__NR_getgroups, size, gidset); 14 + #endif 11 15 if (ret < 0) 12 16 ret = errno_linux_to_bsd(ret); 13 17
+4
src/kernel/emulation/linux/unistd/getuid.c
··· 7 7 { 8 8 int ret; 9 9 10 + #ifdef __NR_getuid32 11 + ret = LINUX_SYSCALL0(__NR_getuid32); 12 + #else 10 13 ret = LINUX_SYSCALL0(__NR_getuid); 14 + #endif 11 15 if (ret < 0) 12 16 ret = errno_linux_to_bsd(ret); 13 17
+21
src/kernel/emulation/linux/unistd/lchown.c
··· 1 + #include "lchown.h" 2 + #include "../base.h" 3 + #include "../errno.h" 4 + #include <asm/unistd.h> 5 + 6 + long sys_lchown(const char* path, int uid, int gid) 7 + { 8 + int ret; 9 + 10 + // TODO: case translation 11 + #ifdef __NR_chown32 12 + ret = LINUX_SYSCALL(__NR_lchown32, path, uid, gid); 13 + #else 14 + ret = LINUX_SYSCALL(__NR_lchown, path, uid, gid); 15 + #endif 16 + if (ret < 0) 17 + ret = errno_linux_to_bsd(ret); 18 + 19 + return ret; 20 + } 21 +
+7
src/kernel/emulation/linux/unistd/lchown.h
··· 1 + #ifndef LINUX_LCHOWN_H 2 + #define LINUX_LCHOWN_H 3 + 4 + long sys_lchown(const char* path, int uid, int gid); 5 + 6 + #endif 7 +
+4
src/kernel/emulation/linux/unistd/setgid.c
··· 7 7 { 8 8 int ret; 9 9 10 + #ifdef __NR_setgid32 11 + ret = LINUX_SYSCALL1(__NR_setgid32, gid); 12 + #else 10 13 ret = LINUX_SYSCALL1(__NR_setgid, gid); 14 + #endif 11 15 if (ret < 0) 12 16 ret = errno_linux_to_bsd(ret); 13 17
+4
src/kernel/emulation/linux/unistd/setgroups.c
··· 7 7 { 8 8 int ret; 9 9 10 + #ifdef __NR_setgroups32 11 + ret = LINUX_SYSCALL(__NR_setgroups32, size, gidset); 12 + #else 10 13 ret = LINUX_SYSCALL(__NR_setgroups, size, gidset); 14 + #endif 11 15 if (ret < 0) 12 16 ret = errno_linux_to_bsd(ret); 13 17
+4
src/kernel/emulation/linux/unistd/setuid.c
··· 7 7 { 8 8 int ret; 9 9 10 + #ifdef __NR_setuid32 11 + ret = LINUX_SYSCALL1(__NR_setuid32, uid); 12 + #else 10 13 ret = LINUX_SYSCALL1(__NR_setuid, uid); 14 + #endif 11 15 if (ret < 0) 12 16 ret = errno_linux_to_bsd(ret); 13 17
+22
src/kernel/emulation/linux/unistd/truncate.c
··· 1 + #include "truncate.h" 2 + #include "../base.h" 3 + #include "../errno.h" 4 + #include <asm/unistd.h> 5 + 6 + long sys_truncate(const char* path, long long length) 7 + { 8 + int ret; 9 + 10 + // TODO: translate path 11 + 12 + #ifdef __NR_truncate64 13 + ret = LINUX_SYSCALL(__NR_truncate64, path, LL_ARG(length)); 14 + #else 15 + ret = LINUX_SYSCALL(__NR_truncate, path, LL_ARG(length)); 16 + #endif 17 + if (ret < 0) 18 + ret = errno_linux_to_bsd(ret); 19 + 20 + return ret; 21 + } 22 +
+7
src/kernel/emulation/linux/unistd/truncate.h
··· 1 + #ifndef LINUX_TRUNCATE_H 2 + #define LINUX_TRUNCATE_H 3 + 4 + long sys_truncate(const char* path, long long length); 5 + 6 + #endif 7 +
+1
src/kernel/libsyscall/CMakeLists.txt
··· 550 550 sys_x86-64/writev.S 551 551 ) 552 552 elseif(BITS EQUAL 32) 553 + 553 554 set (syscall_sources ${syscall_sources} 554 555 sys_i386/__accept_nocancel.S 555 556 sys_i386/__accept.S
+22 -15
src/kernel/libsyscall/sys_i386/SYS.h
··· 72 72 #ifndef DARLING 73 73 #define UNIX_SYSCALL_SYSENTER call __sysenter_trap 74 74 #else 75 - #define UNIX_SYSCALL_SYSENTER call __darling_bsd_syscall@PLT 75 + #define UNIX_SYSCALL_SYSENTER call __darling_bsd_syscall 76 76 #endif 77 77 78 78 #define UNIX_SYSCALL(name, nargs) \ ··· 80 80 LEAF(_##name, 0) ;\ 81 81 movl $ SYS_##name, %eax ;\ 82 82 UNIX_SYSCALL_SYSENTER ;\ 83 - jnb 2f ;\ 83 + cmpl $-4095, %eax ;\ 84 + jb 3f ;\ 84 85 BRANCH_EXTERN(tramp_cerror) ;\ 85 - 2: 86 + 3: 86 87 87 88 #define UNIX_SYSCALL_INT(name, nargs) \ 88 89 .globl tramp_cerror ;\ 89 90 LEAF(_##name, 0) ;\ 90 91 movl $ SYS_##name, %eax ;\ 91 92 UNIX_SYSCALL_TRAP ;\ 92 - jnb 2f ;\ 93 + cmpl $-4095, %eax ;\ 94 + jb 3f ;\ 93 95 BRANCH_EXTERN(tramp_cerror) ;\ 94 - 2: 96 + 3: 95 97 96 98 #if defined(__SYSCALL_32BIT_ARG_BYTES) && ((__SYSCALL_32BIT_ARG_BYTES >= 4) && (__SYSCALL_32BIT_ARG_BYTES <= 20)) 97 99 #define UNIX_SYSCALL_NONAME(name, nargs, cerror) \ 98 100 movl $(SYS_##name | (__SYSCALL_32BIT_ARG_BYTES << I386_SYSCALL_ARG_BYTES_SHIFT)), %eax ;\ 99 101 UNIX_SYSCALL_SYSENTER ;\ 100 - jnb 2f ;\ 102 + cmpl $-4095, %eax ;\ 103 + jb 3f ;\ 101 104 BRANCH_EXTERN(tramp_##cerror) ;\ 102 - 2: 105 + 3: 103 106 #else /* __SYSCALL_32BIT_ARG_BYTES < 4 || > 20 */ 104 107 #define UNIX_SYSCALL_NONAME(name, nargs, cerror) \ 105 108 movl $ SYS_##name, %eax ;\ 106 109 UNIX_SYSCALL_SYSENTER ;\ 107 - jnb 2f ;\ 110 + cmpl $-4095, %eax ;\ 111 + jb 3f ;\ 108 112 BRANCH_EXTERN(tramp_##cerror) ;\ 109 - 2: 113 + 3: 110 114 #endif 111 115 112 116 #define UNIX_SYSCALL_INT_NONAME(name, nargs) \ 113 117 .globl tramp_cerror_nocancel ;\ 114 118 movl $ SYS_##name, %eax ;\ 115 119 UNIX_SYSCALL_TRAP ;\ 116 - jnb 2f ;\ 120 + cmpl $-4095, %eax ;\ 121 + jb 3f ;\ 117 122 BRANCH_EXTERN(tramp_cerror_nocancel) ;\ 118 - 2: 123 + 3: 119 124 120 125 #define PSEUDO(pseudo, name, nargs, cerror) \ 121 126 LEAF(pseudo, 0) ;\ ··· 149 154 LEAF(name, 0) ;\ 150 155 movl $ SYS_##name, %eax ;\ 151 156 call __darling_bsd_syscall@PLT ;\ 152 - jnb 2f ;\ 157 + cmpl $-4095, %eax ;\ 158 + jb 3f ;\ 153 159 movq %rax, %rdi ;\ 154 160 BRANCH_EXTERN(cerror) ;\ 155 - 2: 161 + 3: 156 162 157 163 #define UNIX_SYSCALL_NONAME(name, nargs, cerror) \ 158 164 .globl cerror ;\ 159 165 movl $ SYS_##name, %eax ;\ 160 166 call __darling_bsd_syscall@PLT ;\ 161 - jnb 2f ;\ 167 + cmpl $-4095, %eax ;\ 168 + jb 3f ;\ 162 169 movq %rax, %rdi ;\ 163 170 BRANCH_EXTERN(cerror) ;\ 164 - 2: 171 + 3: 165 172 166 173 167 174 #else
+11 -11
src/kernel/libsyscall/sys_i386/__vfork.S
··· 49 49 #define GET_CURRENT_PID PICIFY(__current_pid) 50 50 51 51 NON_LAZY_STUB(__current_pid) 52 - #define __current_pid (%edx) 52 + #define __current_pid_var (%edx) 53 53 #else 54 54 #define GET_CURRENT_PID 55 55 #endif 56 56 57 57 /* 58 - * If __current_pid >= 0, we want to put a -1 in there 58 + * If __current_pid_var >= 0, we want to put a -1 in there 59 59 * otherwise we just decrement it 60 60 */ 61 61 62 62 LEAF(___vfork, 0) 63 63 GET_CURRENT_PID 64 - movl __current_pid, %eax 64 + movl __current_pid_var, %eax 65 65 0: 66 66 xorl %ecx, %ecx 67 67 testl %eax, %eax 68 68 cmovs %eax, %ecx 69 69 decl %ecx 70 70 lock 71 - cmpxchgl %ecx, __current_pid 71 + cmpxchgl %ecx, __current_pid_var 72 72 jne 0b 73 73 popl %ecx 74 74 movl $(SYS_vfork), %eax // code for vfork -> eax ··· 76 76 jnb L1 // jump if CF==0 77 77 GET_CURRENT_PID 78 78 lock 79 - incl __current_pid 79 + incl __current_pid_var 80 80 pushl %ecx 81 81 BRANCH_EXTERN(tramp_cerror) 82 82 ··· 89 89 L2: 90 90 GET_CURRENT_PID 91 91 lock 92 - incl __current_pid 92 + incl __current_pid_var 93 93 jmp *%ecx 94 94 95 95 #elif defined(__x86_64__) 96 96 97 97 /* 98 - * If __current_pid >= 0, we want to put a -1 in there 98 + * If __current_pid_var >= 0, we want to put a -1 in there 99 99 * otherwise we just decrement it 100 100 */ 101 101 102 102 LEAF(___vfork, 0) 103 - movq __current_pid@GOTPCREL(%rip), %rax 103 + movq __current_pid_var@GOTPCREL(%rip), %rax 104 104 movl (%rax), %eax 105 105 0: 106 106 xorl %ecx, %ecx 107 107 testl %eax, %eax 108 108 cmovs %eax, %ecx 109 109 subl $1, %ecx 110 - movq __current_pid@GOTPCREL(%rip), %rdx 110 + movq __current_pid_var@GOTPCREL(%rip), %rdx 111 111 lock 112 112 cmpxchgl %ecx, (%rdx) 113 113 jne 0b ··· 116 116 UNIX_SYSCALL_TRAP // do the system call 117 117 jnb L1 // jump if CF==0 118 118 pushq %rdi // put return address back on stack for cerror 119 - movq __current_pid@GOTPCREL(%rip), %rcx 119 + movq __current_pid_var@GOTPCREL(%rip), %rcx 120 120 lock 121 121 addq $1, (%rcx) 122 122 movq %rax, %rdi ··· 129 129 jmp *%rdi 130 130 131 131 L2: 132 - movq __current_pid@GOTPCREL(%rip), %rdx 132 + movq __current_pid_var@GOTPCREL(%rip), %rdx 133 133 lock 134 134 addq $1, (%rdx) 135 135 jmp *%rdi
+9
src/kernel/libsyscall/sys_i386/aio_suspend.S
··· 1 1 #define __SYSCALL_32BIT_ARG_BYTES 12 2 2 #include "SYS.h" 3 3 4 + #ifndef SYS_aio_suspend 5 + #error "SYS_aio_suspend not defined. The header files libsyscall is building against do not match syscalls.master." 6 + #endif 7 + 8 + #if defined(__i386__) 9 + __SYSCALL2(__aio_suspend, aio_suspend, 1, cerror) 10 + #endif 11 + 12 + 4 13 #if defined(__i386__) 5 14 .globl aio_suspend$UNIX2003 6 15 aio_suspend$UNIX2003 = __aio_suspend
+8
src/kernel/libsyscall/sys_i386/close.S
··· 1 1 #define __SYSCALL_32BIT_ARG_BYTES 4 2 2 #include "SYS.h" 3 3 4 + #ifndef SYS_close 5 + #error "SYS_close not defined. The header files libsyscall is building against do not match syscalls.master." 6 + #endif 7 + 8 + #if defined(__i386__) 9 + __SYSCALL2(__close, close, 1, cerror) 10 + #endif 11 + 4 12 #if defined(__i386__) 5 13 .globl close$UNIX2003 6 14 close$UNIX2003 = __close
+9
src/kernel/libsyscall/sys_i386/fsync.S
··· 1 1 #define __SYSCALL_32BIT_ARG_BYTES 4 2 2 #include "SYS.h" 3 3 4 + #ifndef SYS_fsync 5 + #error "SYS_fsync not defined. The header files libsyscall is building against do not match syscalls.master." 6 + #endif 7 + 8 + #if defined(__i386__) 9 + __SYSCALL2(__fsync, fsync, 1, cerror) 10 + #endif 11 + 12 + 4 13 #if defined(__i386__) 5 14 .globl fsync$UNIX2003 6 15 fsync$UNIX2003 = __fsync
+9
src/kernel/libsyscall/sys_i386/msgrcv.S
··· 1 1 #define __SYSCALL_32BIT_ARG_BYTES 20 2 2 #include "SYS.h" 3 3 4 + #ifndef SYS_msgrcv 5 + #error "SYS_msgrcv not defined. The header files libsyscall is building against do not match syscalls.master." 6 + #endif 7 + 8 + #if defined(__i386__) 9 + __SYSCALL2(__msgrcv, msgrcv, 1, cerror) 10 + #endif 11 + 12 + 4 13 #if defined(__i386__) 5 14 .globl msgrcv$UNIX2003 6 15 msgrcv$UNIX2003 = __msgrcv
+9
src/kernel/libsyscall/sys_i386/msgsnd.S
··· 1 1 #define __SYSCALL_32BIT_ARG_BYTES 16 2 2 #include "SYS.h" 3 3 4 + #ifndef SYS_msgsnd 5 + #error "SYS_msgsnd not defined. The header files libsyscall is building against do not match syscalls.master." 6 + #endif 7 + 8 + #if defined(__i386__) 9 + __SYSCALL2(__msgsnd, msgsnd, 1, cerror) 10 + #endif 11 + 12 + 4 13 #if defined(__i386__) 5 14 .globl msgsnd$UNIX2003 6 15 msgsnd$UNIX2003 = __msgsnd
+9
src/kernel/libsyscall/sys_i386/poll.S
··· 1 1 #define __SYSCALL_32BIT_ARG_BYTES 12 2 2 #include "SYS.h" 3 3 4 + #ifndef SYS_poll 5 + #error "SYS_poll not defined. The header files libsyscall is building against do not match syscalls.master." 6 + #endif 7 + 8 + #if defined(__i386__) 9 + __SYSCALL2(__poll, poll, 1, cerror) 10 + #endif 11 + 12 + 4 13 #if defined(__i386__) 5 14 .globl poll$UNIX2003 6 15 poll$UNIX2003 = __poll
+9
src/kernel/libsyscall/sys_i386/pread.S
··· 1 1 #define __SYSCALL_32BIT_ARG_BYTES 20 2 2 #include "SYS.h" 3 3 4 + #ifndef SYS_pread 5 + #error "SYS_pread not defined. The header files libsyscall is building against do not match syscalls.master." 6 + #endif 7 + 8 + #if defined(__i386__) 9 + __SYSCALL2(__pread, pread, 1, cerror) 10 + #endif 11 + 12 + 4 13 #if defined(__i386__) 5 14 .globl pread$UNIX2003 6 15 pread$UNIX2003 = __pread
+9
src/kernel/libsyscall/sys_i386/pwrite.S
··· 1 1 #define __SYSCALL_32BIT_ARG_BYTES 20 2 2 #include "SYS.h" 3 3 4 + #ifndef SYS_pwrite 5 + #error "SYS_pwrite not defined. The header files libsyscall is building against do not match syscalls.master." 6 + #endif 7 + 8 + #if defined(__i386__) 9 + __SYSCALL2(__pwrite, pwrite, 1, cerror) 10 + #endif 11 + 12 + 4 13 #if defined(__i386__) 5 14 .globl pwrite$UNIX2003 6 15 pwrite$UNIX2003 = __pwrite
+9
src/kernel/libsyscall/sys_i386/read.S
··· 1 1 #define __SYSCALL_32BIT_ARG_BYTES 12 2 2 #include "SYS.h" 3 3 4 + #ifndef SYS_read 5 + #error "SYS_read not defined. The header files libsyscall is building against do not match syscalls.master." 6 + #endif 7 + 8 + #if defined(__i386__) 9 + __SYSCALL2(__read, read, 1, cerror) 10 + #endif 11 + 12 + 4 13 #if defined(__i386__) 5 14 .globl read$UNIX2003 6 15 read$UNIX2003 = __read
+9
src/kernel/libsyscall/sys_i386/readv.S
··· 1 1 #define __SYSCALL_32BIT_ARG_BYTES 12 2 2 #include "SYS.h" 3 3 4 + #ifndef SYS_readv 5 + #error "SYS_readv not defined. The header files libsyscall is building against do not match syscalls.master." 6 + #endif 7 + 8 + #if defined(__i386__) 9 + __SYSCALL2(__readv, readv, 1, cerror) 10 + #endif 11 + 12 + 4 13 #if defined(__i386__) 5 14 .globl readv$UNIX2003 6 15 readv$UNIX2003 = __readv
+9
src/kernel/libsyscall/sys_i386/sem_wait.S
··· 1 1 #define __SYSCALL_32BIT_ARG_BYTES 4 2 2 #include "SYS.h" 3 3 4 + #ifndef SYS_sem_wait 5 + #error "SYS_sem_wait not defined. The header files libsyscall is building against do not match syscalls.master." 6 + #endif 7 + 8 + #if defined(__i386__) 9 + __SYSCALL2(__sem_wait, sem_wait, 1, cerror) 10 + #endif 11 + 12 + 4 13 #if defined(__i386__) 5 14 .globl sem_wait$UNIX2003 6 15 sem_wait$UNIX2003 = __sem_wait
+9
src/kernel/libsyscall/sys_i386/waitid.S
··· 1 1 #define __SYSCALL_32BIT_ARG_BYTES 16 2 2 #include "SYS.h" 3 3 4 + #ifndef SYS_waitid 5 + #error "SYS_waitid not defined. The header files libsyscall is building against do not match syscalls.master." 6 + #endif 7 + 8 + #if defined(__i386__) 9 + __SYSCALL2(__waitid, waitid, 1, cerror) 10 + #endif 11 + 12 + 4 13 #if defined(__i386__) 5 14 .globl waitid$UNIX2003 6 15 waitid$UNIX2003 = __waitid
+9
src/kernel/libsyscall/sys_i386/write.S
··· 1 1 #define __SYSCALL_32BIT_ARG_BYTES 12 2 2 #include "SYS.h" 3 3 4 + #ifndef SYS_write 5 + #error "SYS_write not defined. The header files libsyscall is building against do not match syscalls.master." 6 + #endif 7 + 8 + #if defined(__i386__) 9 + __SYSCALL2(__write, write, 1, cerror) 10 + #endif 11 + 12 + 4 13 #if defined(__i386__) 5 14 .globl write$UNIX2003 6 15 write$UNIX2003 = __write
+9
src/kernel/libsyscall/sys_i386/writev.S
··· 1 1 #define __SYSCALL_32BIT_ARG_BYTES 12 2 2 #include "SYS.h" 3 3 4 + #ifndef SYS_writev 5 + #error "SYS_writev not defined. The header files libsyscall is building against do not match syscalls.master." 6 + #endif 7 + 8 + #if defined(__i386__) 9 + __SYSCALL2(__writev, writev, 1, cerror) 10 + #endif 11 + 12 + 4 13 #if defined(__i386__) 5 14 .globl writev$UNIX2003 6 15 writev$UNIX2003 = __writev
+1
src/libc/gen/utmpx-darwin.h
··· 26 26 #include <stdlib.h> 27 27 #include <string.h> 28 28 #include <sys/param.h> 29 + #include <sys/_types/_timeval32.h> 29 30 30 31 #ifdef UTMP_COMPAT 31 32 #define UTMP_COMPAT_UTMP0 0x01
+6 -6
src/libc/i386/CMakeLists.txt
··· 9 9 10 10 set(i386_sources 11 11 gen/getmcontext.c 12 - #gen/makecontext.c 13 - #gen/setcontext.c 12 + gen/makecontext.c 13 + gen/setcontext.c 14 14 gen/setjmperr.c 15 - #gen/swapcontext.c 15 + gen/swapcontext.c 16 16 gen/cpu_number.S 17 17 gen/icacheinval.S 18 18 gen/mcount.S 19 19 gen/_ctx_start.S 20 - #gen/getcontext.S 20 + gen/getcontext.S 21 21 gen/_setcontext.S 22 22 23 23 # sys/i386_gettimeofday_asm.S ··· 55 55 string/memcpy.c 56 56 string/memmove.c 57 57 58 - # pthreads/preempt.S 58 + pthreads/preempt.S 59 59 pthreads/pthread_getspecific.S 60 60 pthreads/pthread_mutex_lock.S 61 61 pthreads/pthread_self.S 62 - pthreads/pthread_set_self.S 62 + #pthreads/pthread_set_self.S 63 63 pthreads/start_wqthread.S 64 64 pthreads/thread_start.S 65 65 pthreads/init_cpu_capabilities.c
+1
src/libc/i386/gen/cpu_number.S
··· 50 50 .align 4 51 51 #ifdef DARLING 52 52 .hidden _cpu_number 53 + .globl _cpu_number 53 54 #else 54 55 .private_extern _cpu_number 55 56 #endif
+5
src/libc/i386/gen/mcount.S
··· 1 + // Modified by Lubos Dolezel for Darling 1 2 /* 2 3 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 4 * ··· 21 22 * @APPLE_LICENSE_HEADER_END@ 22 23 */ 23 24 #import <architecture/i386/asm_help.h> 25 + 26 + #ifdef DARLING 27 + # define _moncount moncount 28 + #endif 24 29 25 30 .text 26 31 .globl mcount
+10
src/libc/i386/pthreads/preempt.S
··· 38 38 * Destroys %eax, %ecx, and %edx. 39 39 */ 40 40 .align 4 41 + #ifndef DARLING 41 42 .private_extern _preempt 43 + #else 44 + .globl _preempt 45 + .hidden _preempt 46 + #endif 42 47 _preempt: 43 48 popl %edx // get return address 44 49 movl %esp,%ecx // save stack ptr here ··· 56 61 */ 57 62 58 63 .align 4 64 + #ifndef DARLING 59 65 .private_extern _backoff 66 + #else 67 + .globl _backoff 68 + .hidden _backoff 69 + #endif 60 70 _backoff: 61 71 testl %ebx,%ebx // does kernel want to preempt us? 62 72 jz 1f // no
+7 -1
src/libc/i386/pthreads/pthread_mutex_lock.S
··· 1 + // Modified by Lubos Dolezel for Darling 1 2 /* 2 3 * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. 3 4 * ··· 24 25 #include <machine/cpu_capabilities.h> 25 26 #include <architecture/i386/asm_help.h> 26 27 28 + #ifdef DARLING 29 + # define _preempt preempt 30 + # define _commpage_pfz_base commpage_pfz_base 31 + #endif 32 + 27 33 .text 28 - .align 2 34 + .align (1<<2) 29 35 .globl __commpage_pthread_mutex_lock 30 36 __commpage_pthread_mutex_lock: 31 37 pushl %ebp // set up frame for backtrace
+2 -2
src/libc/i386/pthreads/thread_start.S
··· 26 26 27 27 #ifdef DARLING 28 28 # define _thread_start thread_start 29 - # definie __pthread_start _pthread_start@PLT 29 + # define __pthread_start _pthread_start 30 30 #endif 31 31 32 32 .text 33 - .align 2, 0x90 33 + .align (1<<2), 0x90 34 34 .globl _thread_start 35 35 _thread_start: 36 36 // This routine is never called directly by user code, jumped from kernel
+1
src/libc/i386/string/__bzero.S
··· 1 1 #ifdef DARLING 2 2 # define ___bzero __bzero 3 + # define _bzero bzero 3 4 #endif 4 5 5 6 .globl ___bzero
+5
src/libc/i386/string/bcopy_sse3x.S
··· 1 + // Modified by Lubos Dolezel for Darling 1 2 /* 2 3 * Copyright (c) 2006 Apple Computer, Inc. All rights reserved. 3 4 * ··· 28 29 29 30 #include <machine/cpu_capabilities.h> 30 31 #include <platfunc.h> 32 + 33 + #ifdef DARLING 34 + # define _longcopy longcopy 35 + #endif 31 36 32 37 /* 33 38 * The bcopy/memcpy loops, tuned for Pentium-M class processors with
+1
src/libc/i386/string/longcopy_sse3x.S
··· 64 64 #ifndef DARLING 65 65 .private_extern _longcopy 66 66 #else 67 + .globl _longcopy 67 68 .hidden _longcopy 68 69 #endif 69 70
+1
src/libc/i386/string/memset.S
··· 51 51 # define _memset_pattern4 memset_pattern4 52 52 # define _memset_pattern8 memset_pattern8 53 53 # define _memset_pattern16 memset_pattern16 54 + # define _bzero bzero 54 55 #endif 55 56 56 57 .text
+1
src/libc/i386/string/memset_pattern_sse2.S
··· 64 64 #ifndef DARLING 65 65 .private_extern _memset_pattern 66 66 #else 67 + .globl _memset_pattern 67 68 .hidden _memset_pattern 68 69 #endif 69 70 _memset_pattern:
+1
src/libc/i386/string/strncpy.S
··· 27 27 28 28 #ifdef DARLING 29 29 #define _strncpy strncpy 30 + #define _bzero bzero 30 31 #endif 31 32 32 33 // *****************
+2
src/libc/i386/sys/OSAtomic.S
··· 35 35 #ifdef DARLING 36 36 # define _OSAtomicFifoEnqueue OSAtomicFifoEnqueue 37 37 # define _OSAtomicFifoDequeue OSAtomicFifoDequeue 38 + # define _preempt preempt 39 + # define _commpage_pfz_base commpage_pfz_base 38 40 #endif 39 41 40 42 #ifndef DARLING
+1 -1
src/libc/i386/sys/atomic.c
··· 40 40 return find_platform_function((const platfunc_descriptor**) symbol ## _platfunc_descriptors); \ 41 41 } 42 42 #else // ELF doesn't support symbol resolvers 43 - #define RESOLVER_UP_MP(symbol) __asm__(".globl " #symbol); __asm__(#symbol ": jmp " #symbol "$VARIANT$mp@PLT"); 43 + #define RESOLVER_UP_MP(symbol) __asm__(".globl " #symbol); __asm__(#symbol ": jmp " #symbol "$VARIANT$mp"); 44 44 #endif 45 45 46 46 RESOLVER_UP_MP(OSAtomicAnd32)
+1 -1
src/libc/i386/sys/setjmp.S
··· 39 39 # define _siglongjmp siglongjmp 40 40 # define x_longjmp longjmp 41 41 # define x__longjmp _longjmp 42 - # define __sigunalstack _sigunaltstack 42 + # define __sigunaltstack _sigunaltstack 43 43 #else 44 44 # define x_longjmp _longjmp 45 45 # define x__longjmp __longjmp
+1 -1
src/libc/i386/sys/spinlocks.c
··· 40 40 return find_platform_function((const platfunc_descriptor**) symbol ## _platfunc_descriptors); \ 41 41 } 42 42 #else // ELF doesn't support symbol resolvers 43 - #define RESOLVER_UP_MP(symbol) __asm__(".globl " #symbol); __asm__(#symbol ": jmp " #symbol "$VARIANT$mp@PLT"); 43 + #define RESOLVER_UP_MP(symbol) __asm__(".globl " #symbol); __asm__(#symbol ": jmp " #symbol "$VARIANT$mp"); 44 44 #endif 45 45 46 46 RESOLVER_UP_MP(OSSpinLockTry)
+2 -2
src/libc/i386/sys/spinlocks_asm.S
··· 127 127 128 128 .align 2, 0x90 129 129 .globl _OSSpinLockUnlock 130 - .globl _spin_unlock 131 - .globl __spin_unlock 130 + .globl x_spin_unlock 131 + .globl x__spin_unlock 132 132 _OSSpinLockUnlock: 133 133 x_spin_unlock: 134 134 x__spin_unlock:
+3 -3
src/libc/sys/CMakeLists.txt
··· 30 30 OpenBSD/stack_protector.c 31 31 ) 32 32 33 - if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686") 34 - set(sys_sources ${sys_sources} context-stubs.c) 35 - endif() 33 + #if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686") 34 + # set(sys_sources ${sys_sources} context-stubs.c) 35 + #endif() 36 36 37 37 SET_SOURCE_FILES_PROPERTIES(semctl.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DLIBC_ALIAS_SEMCTL -DKERNEL -U__DARWIN_UNIX03 -D__DARWIN_UNIX03=0") 38 38 SET_SOURCE_FILES_PROPERTIES(shmctl.c PROPERTIES COMPILE_FLAGS "${CMAKE_C_FLAGS} -DLIBC_ALIAS_SEMCTL -DKERNEL -U__DARWIN_UNIX03 -D__DARWIN_UNIX03=0")
+2 -2
src/libdyld/CMakeLists.txt
··· 39 39 threads.cpp 40 40 ) 41 41 42 - if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86") 42 + #if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686") 43 43 set(dyld_SRCS ${dyld_SRCS} 44 44 UndefinedFunction.cpp 45 45 Trampoline.cpp ··· 55 55 add_definitions(-DHAS_DEBUG_HELPERS) 56 56 add_definitions(-DHAS_TLS_SUPPORT) 57 57 58 - endif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86") 58 + #endif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86") 59 59 60 60 SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib${SUFFIX}/darling") 61 61 #SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-new-dtags")
+1 -1
src/libdyld/i386/trampoline_helper.S
··· 37 37 pushl %edx 38 38 pushl %esi 39 39 pushl %edi 40 - subl 8, %esp 40 + subl $8, %esp 41 41 fstpl (%esp) 42 42 43 43 jmpl *%eax
+8 -2
src/libffi/x86/x86-darwin.S
··· 33 33 # define _ffi_prep_args ffi_prep_args 34 34 # define _ffi_call_SYSV ffi_call_SYSV 35 35 # define _ffi_closure_SYSV ffi_closure_SYSV 36 + # define _ffi_closure_SYSV_inner ffi_closure_SYSV_inner 36 37 # define _ffi_closure_raw_SYSV ffi_closure_raw_SYSV 37 38 #endif 38 39 ··· 307 308 jmp Lrcls_epilogue 308 309 LFE3: 309 310 #endif 310 - 311 + #ifndef DARLING 311 312 .section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5 312 313 L_ffi_closure_SYSV_inner$stub: 313 314 .indirect_symbol _ffi_closure_SYSV_inner 314 315 hlt ; hlt ; hlt ; hlt ; hlt 315 - 316 + #else 317 + L_ffi_closure_SYSV_inner$stub: 318 + jmp _ffi_closure_SYSV_inner 319 + #endif 316 320 321 + #ifndef DARLING 317 322 .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support 323 + #endif 318 324 EH_frame1: 319 325 .set L$set$0,LECIE1-LSCIE1 320 326 .long L$set$0
+12 -2
src/lkm/api.h
··· 65 65 66 66 struct mach_msg_overwrite_args 67 67 { 68 - union { void* msg; uint64_t pad; }; 68 + #ifdef __i386__ 69 + void* msg; 70 + uint32_t pad1; 71 + #else 72 + void* msg; 73 + #endif 69 74 unsigned int option; 70 75 unsigned int send_size; 71 76 unsigned int recv_size; 72 77 unsigned int rcv_name; 73 78 unsigned int timeout; 74 79 unsigned int notify; 75 - union { void* rcv_msg; uint64_t pad2; }; 80 + #ifdef __i386__ 81 + void* rcv_msg; 82 + uint32_t pad2; 83 + #else 84 + void* rcv_msg; 85 + #endif 76 86 unsigned int rcv_limit; 77 87 }; 78 88
+7 -2
src/lkm/traps.c
··· 491 491 debug_msg("mach_msg_overwrite_trap()"); 492 492 493 493 if (copy_from_user(&args, in_args, sizeof(args))) 494 + { 495 + debug_msg("!!! Cannot copy %d bytes from %p\n", 496 + sizeof(args), in_args); 494 497 return KERN_INVALID_ADDRESS; 498 + } 495 499 496 500 if (args.option & MACH_SEND_MSG) 497 501 { ··· 514 518 515 519 if (copy_from_user(msg, args.msg, args.send_size)) 516 520 { 521 + debug_msg("!!! Cannot copy %d bytes from %p\n", 522 + args.send_size, args.msg); 517 523 kfree(msg); 518 524 return KERN_INVALID_ADDRESS; 519 525 } ··· 782 788 if (PORT_IS_VALID(sem->port)) 783 789 mach_semaphore_signal(sem->port); 784 790 else 785 - debug_msg("Invalid semaphore %d!\n", args.signal); 791 + debug_msg("Invalid semaphore %d in bsdthread_terminate_trap()!\n", args.signal); 786 792 787 793 // Deallocate stack 788 - debug_msg("unmap %p, 0x%x bytes\n", args.stackaddr, args.freesize); 789 794 vm_munmap(args.stackaddr, args.freesize); 790 795 791 796 // Deregister thread