this repo has no description
1
fork

Configure Feed

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

Implement `_os_cpu_number` on top of Linux `getcpu`

+23
+1
Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/darling/emulation/linux-arm64.h
··· 1 + ../../../../../../../../../../src/kernel/emulation/linux/linux-syscalls/linux-arm64.h
+1
Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/darling/emulation/linux-generic.h
··· 1 + ../../../../../../../../../../src/kernel/emulation/linux/linux-syscalls/linux-generic.h
+1
Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/darling/emulation/linux-syscalls.h
··· 1 + ../../../../../../../../../../src/kernel/emulation/linux/linux-syscalls/linux.h
+1
Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/darling/emulation/linux-x86.h
··· 1 + ../../../../../../../../../../src/kernel/emulation/linux/linux-syscalls/linux-x86.h
+1
Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/darling/emulation/linux-x86_64.h
··· 1 + ../../../../../../../../../../src/kernel/emulation/linux/linux-syscalls/linux-x86_64.h
+1
src/kernel/emulation/linux/base.c
··· 17 17 return -ENOSYS; 18 18 } 19 19 20 + VISIBLE 20 21 int __linux_syscall(int nr, long a1, long a2, long a3, long a4, long a5, long a6) 21 22 { 22 23 return linux_syscall(a1, a2, a3, a4, a5, a6, nr);
+17
src/kernel/libsyscall/os/tsd.h
··· 52 52 #include <arm/arch.h> 53 53 #endif 54 54 55 + #ifdef DARLING 56 + #include <darling/emulation/linux-syscalls.h> 57 + #endif 58 + 55 59 extern void _thread_set_tsd_base(void *tsd_base); 56 60 57 61 __attribute__((always_inline)) 58 62 static __inline__ unsigned int 59 63 _os_cpu_number(void) 60 64 { 65 + #ifdef DARLING 66 + extern int __linux_syscall(int nr, ...); 67 + 68 + unsigned int cpu_num = 0; 69 + int status = __linux_syscall(__NR_getcpu, &cpu_num, 0, 0, 0, 0, 0); 70 + // should we even check? i don't think it's possible for it to fail with these arguments 71 + if (status < 0) { 72 + return 0; // i guess? 73 + } 74 + 75 + return cpu_num; 76 + #else // !DARLING 61 77 #if defined(__arm__) 62 78 uintptr_t p; 63 79 __asm__("mrc p15, 0, %[p], c13, c0, 3" : [p] "=&r" (p)); ··· 73 89 #else 74 90 #error _os_cpu_number not implemented on this architecture 75 91 #endif 92 + #endif // !DARLING 76 93 } 77 94 78 95 #if defined(__i386__) || defined(__x86_64__)