Commit Graph

3445 Commits

Author SHA1 Message Date
Ariel Abreu
6eb5b25e1e
Don't race for kqueue when closing descriptors 2020-10-27 09:19:27 -04:00
Ariel Abreu
63f9a0e165
Remove libkqueue and use in-kernel kqueues
This commit pretty much just implements the bridge between userspace and kernel code for kqueues; for the real details of the change, check out the commit in the LKM.
2020-10-27 00:00:43 -04:00
Ariel Abreu
78afae595b
Update libdispatch and libkqueue 2020-10-07 12:50:49 -04:00
Ariel Abreu
93be7064ca
Update libkqueue and LKM 2020-10-06 08:39:26 -04:00
Ariel Abreu
c7ea2eaa4f
Support polling behavior on kevent_qos 2020-10-06 08:39:00 -04:00
Thomas A
755255813f Update libpthread and security 2020-10-04 18:53:48 -07:00
Thomas A
227f890ba5 Update submodules to use architecture abstraction code 2020-10-03 19:14:35 -07:00
Ariel Abreu
fdb80b9304
Implement PROC_PIDREGIONPATH
It's basically a lighter version of `PROC_PIDREGIONPATHINFO` with less information: region address, size, and owner path
2020-09-29 23:26:26 -04:00
Ariel Abreu
4e90a5c964
Remove QoS hack and add another one
See the commit in libdispatch for more information.
2020-09-29 23:22:41 -04:00
Ariel Abreu
2113c6a7bb
Update Security 2020-09-28 21:19:12 -04:00
Ariel Abreu
2ee1d4c6d1
workq_kernreturn: Extract initial flags and fix x86_64 assembly arguments
We need to initialize the flags in case we terminate as soon as we're created (because `_pthread_wqthread` requires valid flags).

This also fixes the x86_64 assembly to ensure that the 6th argument is actually passed (for some reason, the old code was causing the 6th argument to be a copy of the 5th). We don't need to specifically use `rbx`, so just use `r` and let the compiler decide what to use.
2020-09-28 18:00:55 -04:00
Ariel Abreu
01412206a1
ulock_wake: Correct return value on success
Callers expect `0` on success; we were returning Linux's return value (the number of callers awoken)
2020-09-28 13:54:27 -04:00
Ariel Abreu
329fee24bb
workq_kernreturn: Assign to variables when terminating
We were accidentally using NULL by forgetting to assign to `dthread` and `thread_self` when resuming the thread to kill it.
2020-09-28 13:53:35 -04:00
Ariel Abreu
538975f8fe
Update some module CMakeLists to compile again
`Security` will still need to be revised to abstract away architecture details.
2020-09-28 13:52:08 -04:00
Ariel Abreu
8cecb9a630
Add some more Mach port traps
These are for guarded ports. While I believe we don't currently deliver port guard violation exceptions, there are certain updated programs (like `notifyd`) that need to be able to create and destroy Mach ports using `mach_port_{construct,destruct}`. This commit therefore adds some of the necessary plumbing (which is enough to satisfy `notifyd`) and leaves it up to a future commit to add proper support for guarded ports and port guard violation exceptions.
2020-09-28 13:48:21 -04:00
Thomas A
03db084961 Abstract Architecture Detection/Assignment
The main goal of this commit is to make it more easy to add or update any architecture we want to support (such as ARM64). Any changes we want to make would be done in the architectures.cmake file.

The secondary goal of this commit is to encourage a more architecture generic nomenclature. We shouldn't use i368/x86_64 unless we are dealing with code that is specific to those architectures.
2020-09-27 18:54:06 -07:00
Ariel Abreu
2fe7f1ae07
Update libdispatch and libpthread 2020-09-27 21:49:42 -04:00
Ariel Abreu
10d7373f86
Update workq_kernreturn for some API changes
First, libpthread now expects `workq_kernreturn` not to return when called with `WQOPS_THREAD_RETURN`. We have to resume the thread and give it a special value for `nkevents` that tells it to kill itself.

Next, Apple has reworked the priority system into a "Quality of Service" (QoS) system. Unfortunately, since we're building libdispatch with a few different settings than Apple's configuration, it seems that they've forgotten to correctly set QoS in some cases, so we have to it for them so that libdispatch doesn't blow up.

Finally, `WQOPS_SETUP_DISPATCH` has been stubbed so libdispatch thinks everything is fine. In the future, we might want to do something with the values it passes in, but for now we have nothing to do with them.
2020-09-27 21:49:27 -04:00
Ariel Abreu
4cc0178c42
Fix workqueue thread support
I was accidentally clobbering the `stack_addr` arg which is actually the `flags` arg for workqueues.

Also, use `stack_addr` from `args` instead of `rdi` (which is the dthread pointer) because the user could have allocated a custom stack and libpthread passes that in.

Finally, workqueues have a separate flag to indicate that the TSD base has been set.
2020-09-27 21:41:49 -04:00
Ariel Abreu
7a07bbe6e5
Implement _os_cpu_number on top of Linux getcpu 2020-09-27 21:37:56 -04:00
Ariel Abreu
f5a965c8ac
Update LKM and IOKit 2020-09-25 15:26:31 -04:00
Ariel Abreu
62def59523
Additional vfork assembly fix
This fix allows the child to actually return correctly.

It was present in an older commit but it got removed in a commit from a few months ago, in what looks like an accidental change (not sure how this code was still working, though).
2020-09-24 16:57:56 -04:00
Ariel Abreu
e68bac6263
Fix vfork assembly
I had forgotten to add some Darling fixes from the old code (some were clearly labeled with `#ifdef DARLING`, some weren't)
2020-09-24 11:23:15 -04:00
Ariel Abreu
6e8fc61857
Add some new Mach port traps 2020-09-24 08:23:27 -04:00
Ariel Abreu
fe5c825b90
Update LKM and libpthread 2020-09-23 19:28:32 -04:00
Ariel Abreu
3bc12db4bc
Update pthread wrapper code to work with new libpthread 2020-09-23 19:28:02 -04:00
Ariel Abreu
b594131166
Update LKM and libobjc 2020-09-21 20:00:44 -04:00
Ariel Abreu
6f84e31a86
Update libplatform, libpthread, and lkm 2020-09-20 18:44:21 -04:00
Ariel Abreu
1e8a3ecbae
Implement strncmp for libsystem_kernel
I don't know why Apple felt the need to move those functions out, but we need to implement `strncmp` for ourselves because we use it before libplatform is initialized
2020-09-20 18:43:55 -04:00
Ariel Abreu
5af5695758
Allow "simple" libsystem_kernel functions to be used in C++ 2020-09-20 18:42:07 -04:00
Ariel Abreu
4f83e4cee7
Add back some Darling fixes I forgot about 2020-09-20 18:39:28 -04:00
Ariel Abreu
b4efc3265a
Fix a crash in dyld when handling libcache
We can't use an initializer in libraries that are part of libSystem
2020-09-20 18:34:21 -04:00
Ariel Abreu
61e930548a
Symlink some Darling headers into the SDK 2020-09-20 18:33:05 -04:00
Ariel Abreu
5383328564
Update LKM again 2020-09-18 15:33:01 -04:00
Ariel Abreu
a1311ac7d1
Update LKM 2020-09-18 09:40:16 -04:00
Ariel Abreu
24c06dff23
Fix the temporary LKM compilation fix
Forgot that, for DKMS, the LKM source resides in /usr/src/darling-mach-0.1/lkm
2020-09-17 16:28:31 -04:00
Ariel Abreu
715f6da002
Update a bunch of submodules 2020-09-17 13:34:21 -04:00
Ariel Abreu
8ce89d6044
xar: Fix install steps 2020-09-17 09:01:06 -04:00
Ariel Abreu
1ac17e037d
Temporary workaround to build with Clang
Like my last commit in the LKM, this is only temporary so I can build for testing
2020-09-17 07:28:50 -04:00
Ariel Abreu
3b9161f239
Update LKM 2020-09-17 07:27:46 -04:00
Ariel Abreu
9735d6fbd7
Fix InstallSymlink.cmake directory creation 2020-09-17 07:27:25 -04:00
Ariel Abreu
3d8c184d57
Update ruby (again) 2020-09-01 12:14:46 -04:00
Ariel Abreu
20e8ea393d
Update ruby 2020-09-01 11:42:55 -04:00
Ariel Abreu
f3ceb29b57
Update ruby 2020-09-01 11:40:58 -04:00
Ariel Abreu
2aa4ede0f5
Update JavaScriptCore 2020-09-01 11:18:47 -04:00
Ariel Abreu
b216e6f371
Update ruby 2020-09-01 11:10:54 -04:00
Ariel Abreu
0938576ed5
Update zsh 2020-09-01 10:47:17 -04:00
Ariel Abreu
2467bda513
Check-in netname.h
This is another one of those libsyscall headers that needs to be available ahead of time because of parallel builds
2020-09-01 10:14:32 -04:00
Ariel Abreu
37cae473ba
Update a few submodules 2020-09-01 10:07:18 -04:00
Ariel Abreu
59f2d81700
Update SDK symlinks 2020-09-01 10:06:44 -04:00