this repo has no description
1
fork

Configure Feed

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

Merge branch 'master' into patch-29

authored by

Luboš Doležel and committed by
GitHub
61b89ef1 cdc3e448

+167 -29
+6
.gitmodules
··· 319 319 [submodule "src/external/libffi"] 320 320 path = src/external/libffi 321 321 url = ../darling-libffi.git 322 + [submodule "src/external/dbuskit"] 323 + path = src/external/dbuskit 324 + url = ../darling-dbuskit.git 325 + [submodule "src/external/IOKitTools"] 326 + path = src/external/IOKitTools 327 + url = ../darling-IOKitTools.git
+1 -1
debian/control
··· 3 3 Section: misc 4 4 Priority: optional 5 5 Standards-Version: 4.4.0 6 - Build-Depends: cmake, clang, bison, flex, libfuse-dev, libudev-dev, pkg-config, libc6-dev-i386, linux-headers-amd64|linux-headers-generic, gcc-multilib, libcairo2-dev, libgl1-mesa-dev, libtiff5-dev, libfreetype6-dev, libelf-dev, libxml2-dev, libegl1-mesa-dev, libfontconfig1-dev, libbsd-dev, debhelper, ninja-build, python, libxrandr-dev, libxcursor-dev, libgif-dev, libavcodec-dev, libavformat-dev, libavresample-dev, libavutil-dev, libpulse-dev, libavformat-dev, libavcodec-dev, libavresample-dev 6 + Build-Depends: cmake, clang, bison, flex, libfuse-dev, libudev-dev, pkg-config, libc6-dev-i386, linux-headers-amd64|linux-headers-generic, gcc-multilib, libcairo2-dev, libgl1-mesa-dev, libtiff5-dev, libfreetype6-dev, libelf-dev, libxml2-dev, libegl1-mesa-dev, libfontconfig1-dev, libbsd-dev, debhelper, ninja-build, python, libxrandr-dev, libxcursor-dev, libgif-dev, libavcodec-dev, libavformat-dev, libavresample-dev, libavutil-dev, libpulse-dev, libavformat-dev, libavcodec-dev, libavresample-dev, libdbus-1-dev 7 7 8 8 Package: darling 9 9 Architecture: amd64
+14 -10
src/CMakeLists.txt
··· 257 257 add_subdirectory(external/libtelnet) 258 258 add_subdirectory(external/remote_cmds) 259 259 add_subdirectory(external/IOKitUser) 260 + add_subdirectory(external/IOKitTools) 260 261 add_subdirectory(CoreAudio) 261 262 #add_subdirectory(external/OpenAL) 262 263 add_subdirectory(external/python_modules) ··· 381 382 add_subdirectory(private-frameworks) 382 383 add_subdirectory(external/usertemplate) 383 384 385 + add_subdirectory(external/lkm) 386 + 387 + add_subdirectory(external/cocotron/Onyx2D) 388 + add_subdirectory(external/cocotron/AppKit) 389 + add_subdirectory(external/cocotron/CoreText) 390 + add_subdirectory(external/cocotron/Cocoa) 391 + add_subdirectory(external/cocotron/CoreData) 392 + add_subdirectory(external/cocotron/QuartzCore) 393 + add_subdirectory(pboard) 394 + 395 + add_subdirectory(external/dbuskit) 396 + 397 + 384 398 # /Applications 385 399 #add_subdirectory(external/TextEdit) 386 400 ··· 412 426 add_subdirectory(external/WTF) 413 427 add_subdirectory(external/bmalloc) 414 428 add_subdirectory(external/dtrace) 415 - 416 - add_subdirectory(external/lkm) 417 - 418 - add_subdirectory(external/cocotron/Onyx2D) 419 - add_subdirectory(external/cocotron/AppKit) 420 - add_subdirectory(external/cocotron/CoreText) 421 - add_subdirectory(external/cocotron/Cocoa) 422 - add_subdirectory(external/cocotron/CoreData) 423 - add_subdirectory(external/cocotron/QuartzCore) 424 - add_subdirectory(pboard) 425 429 426 430 if(FULL_BUILD) 427 431 add_subdirectory(external/JavaScriptCore)
+1 -1
src/CoreVideo/src/CVDisplayLink.mm
··· 1 1 #include <CoreVideo/CVDisplayLink.h> 2 + #include <memory> 2 3 #import <AppKit/NSApplication.h> 3 4 #import <AppKit/NSWindow.h> 4 5 #import <AppKit/NSScreen.h> 5 6 #import <Foundation/NSDictionary.h> 6 7 #include <CoreGraphics/CGWindow.h> 7 8 #include <CoreGraphics/CGDirectDisplay.h> 8 - #include <memory> 9 9 10 10 static const NSString* kDirectDisplayArray = @"CGDirectDisplay"; 11 11
+1
src/OpenGL/include/OpenGL/glext.h
··· 1 + #include <GL/glext.h>
+1
src/kernel/emulation/linux/CMakeLists.txt
··· 175 175 misc/csops.c 176 176 misc/fileport_makeport.c 177 177 misc/fileport_makefd.c 178 + misc/csrctl.c 178 179 fcntl/open.c 179 180 fcntl/openat.c 180 181 fcntl/fcntl.c
+20
src/kernel/emulation/linux/misc/csrctl.c
··· 1 + #include "csrctl.h" 2 + #include "../duct_errno.h" 3 + #define PRIVATE 4 + #include <sys/csr.h> 5 + 6 + long sys_csrctl(uint32_t op, void* useraddr, size_t usersize) { 7 + switch (op) { 8 + case CSR_SYSCALL_CHECK: { 9 + // allow everything 10 + return 0; 11 + } break; 12 + case CSR_SYSCALL_GET_ACTIVE_CONFIG: { 13 + // set everything to "allowed" 14 + *(uint32_t*)useraddr = CSR_VALID_FLAGS; 15 + return 0; 16 + } break; 17 + default: 18 + return ENOSYS; 19 + } 20 + };
+9
src/kernel/emulation/linux/misc/csrctl.h
··· 1 + #ifndef LINUX_CSRCTL_H 2 + #define LINUX_CSRCTL_H 3 + 4 + #include <stdint.h> 5 + #include <stddef.h> 6 + 7 + long sys_csrctl(uint32_t op, void* useraddr, size_t usersize); 8 + 9 + #endif // LINUX_CSRCTL_H
+36
src/kernel/emulation/linux/misc/sysctl_kern.c
··· 1 1 #include "sysctl_kern.h" 2 + #include "sysctl_proc.h" 2 3 #include "getrlimit.h" 3 4 #include "../ext/sysinfo.h" 4 5 #include "../ext/syslog.h" ··· 33 34 static sysctl_handler(handle_maxproc); 34 35 static sysctl_handler(handle_netboot); 35 36 static sysctl_handler(handle_safeboot); 37 + static sysctl_handler(handle_usrstack32); 38 + static sysctl_handler(handle_usrstack64); 36 39 static sysctl_handler(handle_sysv_semmns); 37 40 38 41 extern int _sysctl_proc(int what, int flag, struct kinfo_proc* out, unsigned long* buflen); ··· 60 63 { .oid = KERN_OSRELEASE, .type = CTLTYPE_STRING, .exttype = "S", .name = "osrelease", .handler = handle_osrelease }, 61 64 { .oid = KERN_VERSION, .type = CTLTYPE_STRING, .exttype = "S", .name = "version", .handler = handle_version }, 62 65 { .oid = KERN_OSVERSION, .type = CTLTYPE_STRING, .exttype = "S", .name = "osversion", .handler = handle_osversion }, 66 + { .oid = KERN_USRSTACK32, .type = CTLTYPE_INT, .exttype = "I", .name = "usrstack", .handler = handle_usrstack32 }, 67 + { .oid = KERN_USRSTACK64, .type = CTLTYPE_QUAD, .exttype = "Q", .name = "usrstack64", .handler = handle_usrstack64 }, 63 68 { .oid = KERN_SYSV, .type = CTLTYPE_NODE, .exttype = "", .name = "sysv", .subctls = sysctls_kern_sysv }, 64 69 { .oid = -1 } 65 70 }; ··· 287 292 return 0; 288 293 } 289 294 295 + static void* mystack(void) 296 + { 297 + char buf[400]; 298 + char* ptr = buf; 299 + 300 + if (!read_string("/proc/self/stat", buf, sizeof(buf))) 301 + return NULL; 302 + 303 + skip_stat_elems(&ptr, 27); 304 + 305 + const char* stack = next_stat_elem(&ptr); 306 + return (void*) __simple_atoi(stack, NULL); 307 + } 308 + 309 + sysctl_handler(handle_usrstack32) 310 + { 311 + unsigned int* ovalue = (unsigned int*) old; 312 + if (ovalue) 313 + *ovalue = mystack(); 314 + *oldlen = sizeof(*ovalue); 315 + return 0; 316 + } 317 + 318 + sysctl_handler(handle_usrstack64) 319 + { 320 + unsigned long long* ovalue = (unsigned long long*) old; 321 + if (ovalue) 322 + *ovalue = mystack(); 323 + *oldlen = sizeof(*ovalue); 324 + return 0; 325 + }
+33 -3
src/kernel/emulation/linux/signal/sigaction.c
··· 117 117 copyreg(r11); copyreg(r12); copyreg(r13); copyreg(r14); copyreg(r15); copyreg(rip); 118 118 copyreg(cs); copyreg(fs); copyreg(gs); 119 119 bm->ss.rflags = lc->uc_mcontext.gregs.efl; 120 - #else 120 + 121 + #elif defined(__i386__) 121 122 copyreg(eax); copyreg(ebx); copyreg(ecx); copyreg(edx); copyreg(edi); copyreg(esi); 122 123 copyreg(ebp); copyreg(esp); 123 124 copyreg(eip); copyreg(cs); copyreg(ds); copyreg(es); copyreg(fs); copyreg(gs); 124 125 bm->ss.eflags = lc->uc_mcontext.gregs.efl; 125 126 bm->ss.ss = 0; 127 + #else 128 + # warning Missing code for current arch 126 129 #endif 127 130 128 131 #undef copyreg 129 132 } 130 133 134 + static void mcontext_bsd_to_linux(const struct bsd_mcontext* bm, struct linux_mcontext* lm) 135 + { 136 + #define copyreg(__name) lm->gregs.__name = bm->ss.__name 137 + 138 + #ifdef __x86_64__ 139 + copyreg(rax); copyreg(rbx); copyreg(rcx); copyreg(rdx); copyreg(rdi); copyreg(rsi); 140 + copyreg(rbp); copyreg(rsp); copyreg(r8); copyreg(r9); copyreg(r10); 141 + copyreg(r11); copyreg(r12); copyreg(r13); copyreg(r14); copyreg(r15); copyreg(rip); 142 + copyreg(cs); copyreg(fs); copyreg(gs); 143 + lm->gregs.efl = bm->ss.rflags; 144 + #elif defined(__i386__) 145 + copyreg(eax); copyreg(ebx); copyreg(ecx); copyreg(edx); copyreg(edi); copyreg(esi); 146 + copyreg(ebp); copyreg(esp); 147 + copyreg(eip); copyreg(cs); copyreg(ds); copyreg(es); copyreg(fs); copyreg(gs); 148 + lm->gregs.efl = bm->ss.eflags; 149 + #else 150 + # warning Missing code for current arch 151 + #endif 152 + 153 + } 154 + 131 155 void handler_linux_to_bsd(int linux_signum, struct linux_siginfo* info, void* ctxt) 132 156 { 133 157 int bsd_signum; ··· 145 169 binfo.si_code = info->si_code; 146 170 binfo.si_pid = info->si_pid; 147 171 binfo.si_uid = info->si_uid; 172 + binfo.si_addr = info->si_addr; 173 + binfo.si_val_ptr = (void*) info->si_value; 148 174 149 - // TODO: The following 3 exist on Linux, but it's a mess to extract them 175 + // TODO: The following exist on Linux, but it's a mess to extract them 150 176 binfo.si_status = 0; 151 - binfo.si_addr = 0; 152 177 binfo.si_band = 0; 153 178 } 154 179 ··· 169 194 // __simple_printf("Handling signal %d\n", linux_signum); 170 195 171 196 sig_handlers[linux_signum](bsd_signum, info ? &binfo : NULL, (lc != NULL) ? &bc : NULL); 197 + 198 + if (lc != NULL) 199 + { 200 + mcontext_bsd_to_linux(bc.uc_mcontext, &lc->uc_mcontext); 201 + } 172 202 173 203 // __simple_printf("Signal handled\n"); 174 204 }
+1 -1
src/kernel/emulation/linux/signal/sigaltstack.h
··· 4 4 struct bsd_stack 5 5 { 6 6 void* ss_sp; 7 - int ss_size; 7 + unsigned long ss_size; 8 8 int ss_flags; 9 9 }; 10 10
+2
src/kernel/emulation/linux/syscalls.c
··· 121 121 #include "misc/csops.h" 122 122 #include "misc/fileport_makeport.h" 123 123 #include "misc/fileport_makefd.h" 124 + #include "misc/csrctl.h" 124 125 #include "synch/semwait_signal.h" 125 126 #include "fcntl/open.h" 126 127 #include "fcntl/openat.h" ··· 463 464 [474] = sys_symlinkat, 464 465 [475] = sys_mkdirat, 465 466 [476] = sys_getattrlistat, 467 + [483] = sys_csrctl, 466 468 [500] = sys_getentropy, 467 469 [515] = sys_ulock_wait, 468 470 [516] = sys_ulock_wake,
+1
src/native/CMakeLists.txt
··· 14 14 wrap_elf(cairo libcairo.so) 15 15 wrap_elf(EGL libEGL.so) 16 16 wrap_elf(fontconfig libfontconfig.so) 17 + wrap_elf(dbus libdbus-1.so) 17 18 wrap_elf(GL libGL.so "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries")
+1 -1
src/xtrace/CMakeLists.txt
··· 2 2 3 3 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti -std=c++11") 4 4 5 - add_definitions(-nostdinc) 5 + add_definitions(-nostdinc -fvisibility=hidden) 6 6 7 7 include_directories( 8 8 ${CMAKE_CURRENT_SOURCE_DIR}/include
+2 -6
src/xtrace/bsd_trace.cpp
··· 7 7 #include "xtracelib.h" 8 8 #include "bsd_trace.h" 9 9 10 - _Thread_local int bsd_call_nr = -1; 11 - 12 10 static void print_errno(char* buf, int nr, uintptr_t rv); 13 11 static void print_errno_num(char* buf, int nr, uintptr_t rv); 14 12 static void print_errno_ptr(char* buf, int nr, uintptr_t rv); ··· 1022 1020 extern "C" 1023 1021 void darling_bsd_syscall_entry_print(int nr, void* args[]) 1024 1022 { 1025 - bsd_call_nr = nr; 1026 - handle_generic_entry(bsd_defs, "bsd", bsd_call_nr, args); 1023 + handle_generic_entry(bsd_defs, "bsd", nr, args); 1027 1024 1028 1025 if (nr == 1 || nr == 59) 1029 1026 { ··· 1036 1033 extern "C" 1037 1034 void darling_bsd_syscall_exit_print(uintptr_t retval) 1038 1035 { 1039 - handle_generic_exit(bsd_defs, "bsd", bsd_call_nr, retval, 0); 1040 - bsd_call_nr = -1; 1036 + handle_generic_exit(bsd_defs, "bsd", retval, 0); 1041 1037 } 1042 1038 1043 1039 const char* error_strings[128] = {
+1 -1
src/xtrace/mach_trace.cpp
··· 217 217 void darling_mach_syscall_exit_print(uintptr_t retval) 218 218 { 219 219 int is_msg = mach_call_nr == 31 || mach_call_nr == 32; 220 - handle_generic_exit(mach_defs, "mach", mach_call_nr, retval, is_msg); 220 + handle_generic_exit(mach_defs, "mach", retval, is_msg); 221 221 if (retval == KERN_SUCCESS && is_msg) 222 222 print_mach_msg_exit(); 223 223 mach_call_nr = -1;
+1 -1
src/xtrace/simple.c
··· 1 1 #include "simple.h" 2 2 #include <stdarg.h> 3 3 #include <stddef.h> 4 + #include <string.h> 4 5 5 6 int __simple_vsprintf(char* buf, const char* format, va_list vl); 6 - extern char* memchr(char* buf, int c, __SIZE_TYPE__ n); 7 7 8 8 // We cannot call standard write(), because it would loop back to xtrace 9 9 extern int __write_for_xtrace(int fd, const void* mem, __SIZE_TYPE__ count);
+35 -3
src/xtrace/xtracelib.c
··· 151 151 // Leaves gray color on! 152 152 } 153 153 154 + 155 + _Thread_local struct { 156 + // We're inside this many calls. In other words, we have printed this many 157 + // call entries without matching exits. 158 + int current_level; 159 + // What that value was the last time. if we've just handled an entry or an 160 + // exit, this will be greater/less than current_level. 161 + int previous_level; 162 + // Call numbers, indexed by current level. 163 + int nrs[64]; 164 + } nested_call; 165 + 154 166 void handle_generic_entry(const struct calldef* defs, const char* type, int nr, void* args[]) 155 167 { 156 168 if (xtrace_ignore) 157 169 return; 158 170 159 - print_call(defs, type, nr, 0, 0); 171 + if (nested_call.previous_level < nested_call.current_level && !xtrace_split_entry_and_exit) 172 + { 173 + // We are after an earlier entry without an exit. 174 + __simple_printf("\n"); 175 + } 176 + 177 + int indent = 4 * nested_call.current_level; 178 + nested_call.nrs[nested_call.current_level] = nr; 179 + 180 + print_call(defs, type, nr, indent, 0); 160 181 161 182 if (defs[nr].name != NULL) 162 183 { ··· 172 193 173 194 if (xtrace_split_entry_and_exit) 174 195 __simple_printf("\n"); 196 + 197 + nested_call.previous_level = nested_call.current_level++; 175 198 } 176 199 177 200 178 - void handle_generic_exit(const struct calldef* defs, const char* type, int nr, uintptr_t retval, int force_split) 201 + void handle_generic_exit(const struct calldef* defs, const char* type, uintptr_t retval, int force_split) 179 202 { 180 203 if (xtrace_ignore) 181 204 return; 182 205 206 + if (nested_call.previous_level > nested_call.current_level) 207 + { 208 + // We are after an exit, so our call has been split up. 209 + force_split = 1; 210 + } 211 + nested_call.previous_level = nested_call.current_level--; 212 + int nr = nested_call.nrs[nested_call.current_level]; 213 + 183 214 if (xtrace_split_entry_and_exit || force_split) 184 215 { 185 - print_call(defs, type, nr, 4, 1); 216 + int indent = 4 * nested_call.current_level; 217 + print_call(defs, type, nr, indent, 1); 186 218 __simple_printf("()"); 187 219 } 188 220
+1 -1
src/xtrace/xtracelib.h
··· 14 14 #endif 15 15 16 16 void handle_generic_entry(const struct calldef* defs, const char* type, int nr, void* args[]); 17 - void handle_generic_exit(const struct calldef* defs, const char* type, int nr, uintptr_t retval, int force_split); 17 + void handle_generic_exit(const struct calldef* defs, const char* type, uintptr_t retval, int force_split); 18 18 19 19 extern int xtrace_no_color; 20 20 void xtrace_set_gray_color(void);