this repo has no description
1
fork

Configure Feed

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

Add missing sys_sigwait(), setsockopt(SO_TIMESTAMP) + small fp fixes for sigexc

+58 -8
+1
src/kernel/emulation/linux/CMakeLists.txt
··· 147 147 signal/sig_restorer.S 148 148 signal/sigsuspend.c 149 149 signal/sigexc.c 150 + signal/sigwait.c 150 151 misc/ptrace.c 151 152 misc/getentropy.c 152 153 misc/syscall.c
+2
src/kernel/emulation/linux/network/getsockopt.c
··· 77 77 *optname = LINUX_SO_DONTROUTE; break; 78 78 case BSD_SO_BROADCAST: 79 79 *optname = LINUX_SO_BROADCAST; break; 80 + case BSD_SO_TIMESTAMP: 81 + *optname = LINUX_SO_TIMESTAMP; break; 80 82 case BSD_SO_USELOOPBACK: 81 83 return -ENOTSUP; 82 84 case BSD_SO_LINGER_TICKS:
+2
src/kernel/emulation/linux/network/getsockopt.h
··· 35 35 LINUX_SO_SNDLOWAT, 36 36 LINUX_SO_RCVTIMEO, 37 37 LINUX_SO_SNDTIMEO, 38 + LINUX_SO_TIMESTAMP, 38 39 LINUX_SO_ACCEPTCONN = 30, 39 40 LINUX_SO_SNDBUFFORCE = 32, 40 41 LINUX_SO_RCVBUFFORCE, ··· 52 53 BSD_SO_LINGER_TICKS = 0x80, 53 54 BSD_SO_OOBINLINE = 0x100, 54 55 BSD_SO_REUSEPORT = 0x200, 56 + BSD_SO_TIMESTAMP = 0x400, 55 57 BSD_SO_SNDBUF = 0x1001, 56 58 BSD_SO_RCVBUF, 57 59 BSD_SO_SNDLOWAT,
+8 -8
src/kernel/emulation/linux/signal/sigexc.c
··· 524 524 525 525 void mcontext_to_float_state(const linux_fpregset_t fx, x86_float_state64_t* s) 526 526 { 527 - *((uint32_t*)&s->__fpu_fcw) = fx->cwd; 528 - *((uint32_t*)&s->__fpu_fsw) = fx->swd; 527 + *((uint16_t*)&s->__fpu_fcw) = fx->cwd; 528 + *((uint16_t*)&s->__fpu_fsw) = fx->swd; 529 529 s->__fpu_ftw = fx->ftw; 530 530 s->__fpu_fop = fx->fop; 531 531 s->__fpu_ip = fx->rip; ··· 566 566 567 567 void float_state_to_mcontext(const x86_float_state64_t* s, linux_fpregset_t fx) 568 568 { 569 - fx->cwd = *((uint32_t*)&s->__fpu_fcw); 570 - fx->swd = *((uint32_t*)&s->__fpu_fsw); 569 + fx->cwd = *((uint16_t*)&s->__fpu_fcw); 570 + fx->swd = *((uint16_t*)&s->__fpu_fsw); 571 571 fx->ftw = s->__fpu_ftw; 572 572 fx->fop = s->__fpu_fop; 573 573 fx->rip = s->__fpu_ip; ··· 602 602 603 603 void mcontext_to_float_state(const linux_fpregset_t fx, x86_float_state32_t* s) 604 604 { 605 - *((uint32_t*)&s->__fpu_fcw) = fx->cw; 606 - *((uint32_t*)&s->__fpu_fsw) = fx->sw; 605 + *((uint16_t*)&s->__fpu_fcw) = fx->cw; 606 + *((uint16_t*)&s->__fpu_fsw) = fx->sw; 607 607 s->__fpu_ftw = fx->tag; 608 608 s->__fpu_fop = 0; 609 609 s->__fpu_ip = fx->ipoff; ··· 640 640 641 641 void float_state_to_mcontext(const x86_float_state32_t* s, linux_fpregset_t fx) 642 642 { 643 - fx->cw = *((uint32_t*)&s->__fpu_fcw); 644 - fx->sw = *((uint32_t*)&s->__fpu_fsw); 643 + fx->cw = *((uint16_t*)&s->__fpu_fcw); 644 + fx->sw = *((uint16_t*)&s->__fpu_fsw); 645 645 fx->tag = s->__fpu_ftw; 646 646 fx->ipoff = s->__fpu_ip; 647 647 fx->cssel = s->__fpu_cs;
+33
src/kernel/emulation/linux/signal/sigwait.c
··· 1 + #include "sigwait.h" 2 + #include "../base.h" 3 + #include "../errno.h" 4 + #include "duct_signals.h" 5 + #include <stddef.h> 6 + #include <linux-syscalls/linux.h> 7 + #include "../bsdthread/cancelable.h" 8 + #include "sigaction.h" 9 + 10 + long sys_sigwait(sigset_t set, int* sig) 11 + { 12 + CANCELATION_POINT(); 13 + return sys_sigwait_nocancel(set, sig); 14 + } 15 + 16 + long sys_sigwait_nocancel(sigset_t set, int* sig) 17 + { 18 + linux_sigset_t set_linux; 19 + int ret; 20 + struct linux_siginfo si; 21 + 22 + sigset_bsd_to_linux(&set, &set_linux); 23 + 24 + ret = LINUX_SYSCALL(__NR_rt_sigtimedwait, &set_linux, &si, NULL, 8); 25 + 26 + if (ret < 0) 27 + ret = errno_linux_to_bsd(ret); 28 + else if (sig) 29 + *sig = signum_linux_to_bsd(si.si_signo); 30 + 31 + return ret; 32 + } 33 +
+9
src/kernel/emulation/linux/signal/sigwait.h
··· 1 + #ifndef LINUX_SIGWAIT_H 2 + #define LINUX_SIGWAIT_H 3 + #include "duct_signals.h" 4 + 5 + long sys_sigwait(sigset_t set, int* signal); 6 + long sys_sigwait_nocancel(sigset_t set, int* signal); 7 + 8 + #endif 9 +
+3
src/kernel/emulation/linux/syscalls.c
··· 94 94 #include "signal/sigreturn.h" 95 95 #include "signal/sigprocmask.h" 96 96 #include "signal/sigsuspend.h" 97 + #include "signal/sigwait.h" 97 98 #include "process/vfork.h" 98 99 #include "process/wait4.h" 99 100 #include "process/waitid.h" ··· 368 369 [327] = sys_issetugid, 369 370 [328] = sys_pthread_kill, 370 371 [329] = sys_sigprocmask, // __pthread_sigmask 372 + [330] = sys_sigwait, 371 373 [331] = sys_disable_threadsignal, 372 374 [332] = sys_pthread_markcancel, 373 375 [333] = sys_pthread_canceled, ··· 420 422 [415] = sys_pwrite_nocancel, 421 423 [417] = sys_poll_nocancel, 422 424 [420] = sys_sem_wait_nocancel, 425 + [422] = sys_sigwait_nocancel, 423 426 [423] = sys_semwait_signal_nocancel, 424 427 [441] = sys_guarded_open_np, 425 428 [442] = sys_guarded_close_np,