Emanuele and mugurc
86cdfb8647
feat(libkernel): thread-local storage for Mach-O guests
...
FreeBSD code reaches its thread pointer through %fs and macOS cannot set
the fs base. The macOS relinker turns each %fs access of a guest image
into a stub that reads the thread pointer from a pthread key and calls
Aps5GuestTlsAllocate on a thread's first access, registers the TLS
descriptor of an image with Aps5GuestTlsRegister, and routes
__tls_get_addr to Aps5GuestTlsGetAddr. No library provided them, so a
relinked executable could not start.
- Aps5GuestTlsRegister validates the descriptor the relinker wrote and
creates the key; its destructor frees the block of a thread.
- Aps5GuestTlsAllocateThreadPointer allocates the block (the TLS template
followed by zeros, then a 0x100-byte thread control block whose first
word points at itself, as on FreeBSD) and stores the thread pointer
under the key.
- Aps5GuestTlsAllocate is the entry the stubs call: rax holds the
descriptor and returns the thread pointer, every other register is
preserved, the upper halves of the ymm registers only where AVX exists.
- Aps5GuestTlsGetAddr returns the block of the thread plus the offset.
Co-authored-by: mugurc <[email protected] >
2026-10-27 08:42:04 +01:00
..
2026-10-27 08:29:28 +01:00
2026-10-27 02:49:54 -03:00
2026-10-27 08:42:04 +01:00
2026-10-25 14:16:45 +01:00
2026-10-21 21:52:39 +03:00
2026-10-27 04:51:45 +01:00
2026-10-27 06:10:48 +01:00
2026-10-23 04:17:52 +01:00
2026-10-27 04:49:59 +01:00
2026-10-25 18:10:39 +01:00
2026-10-21 21:52:56 +03:00
2026-10-24 23:29:15 -05:00
2026-10-21 21:38:15 -03:00
2026-10-24 20:16:40 +02:00
2026-10-21 21:53:27 +03:00
2026-10-26 16:17:50 +01:00
2026-10-27 14:05:56 +13:00
2026-10-25 12:53:43 +00:00
2026-10-21 21:53:55 +03:00
2026-10-22 15:14:29 +02:00
2026-10-25 07:44:02 +00:00
2026-10-25 07:44:02 +00:00
2026-10-24 23:14:25 +00:00
2026-10-26 19:49:12 +01:00
2026-10-21 21:53:28 +03:00
2026-10-21 21:53:28 +03:00
2026-10-26 16:11:50 +00:00
2026-10-22 09:24:22 +01:00
2026-10-24 23:50:25 +03:00
2026-10-25 14:16:45 +01:00
2026-10-27 07:59:18 +01:00
2026-10-25 12:53:43 +00:00
2026-10-25 12:53:43 +00:00
2026-10-25 02:17:21 +01:00
2026-10-26 14:35:14 +01:00
2026-10-23 21:25:45 +05:30
2026-10-24 13:21:05 +05:30
2026-10-23 13:04:32 +03:00
2026-10-27 07:59:02 +01:00
2026-10-21 21:44:31 +00:00
2026-10-25 19:44:44 +01:00
2026-10-26 03:21:51 +00:00
2026-10-25 23:43:52 +00:00
2026-10-25 14:16:45 +01:00
2026-10-23 01:18:59 -03:00
2026-10-26 16:17:50 +01:00
2026-10-26 06:09:52 +13:00
2026-10-25 02:52:26 +13:00
2026-10-23 12:48:07 +02:00
2026-10-22 08:19:34 -07:00
2026-10-26 20:10:35 +01:00
2026-10-26 05:16:02 -07:00
2026-10-26 10:25:20 +13:00
2026-10-25 19:28:38 +02:00
2026-10-26 16:44:29 +01:00
2026-10-25 14:09:10 +07:00
2026-10-24 23:17:49 +03:00
2026-10-23 06:43:01 +01:00
2026-10-22 09:09:06 +01:00
2026-10-24 23:16:09 -03:00
2026-10-23 11:27:03 +02:00
2026-10-23 10:02:43 +02:00
2026-10-24 15:23:36 +13:00
2026-10-26 13:34:58 +01:00
2026-10-25 23:08:02 +01:00
2026-10-25 13:57:18 +01:00
2026-10-27 10:57:14 +13:00
2026-10-27 08:38:38 +01:00
2026-10-21 21:54:18 +03:00
2026-10-21 21:52:33 +03:00
2026-10-21 21:53:22 +03:00
2026-10-21 21:52:57 +03:00
2026-10-25 14:55:32 +05:30
2026-10-21 21:53:21 +03:00
2026-10-24 22:11:32 -04:00
2026-10-27 05:38:46 +01:00
2026-10-27 08:38:33 +01:00
2026-10-24 10:45:41 +02:00
2026-10-21 21:54:20 +03:00
2026-10-23 10:50:00 +06:00
2026-10-27 10:55:08 +13:00
2026-10-21 21:53:59 +03:00
2026-10-22 22:15:40 +01:00
2026-10-25 04:17:49 +00:00
2026-10-23 10:02:45 +02:00
2026-10-21 21:54:00 +03:00
2026-10-23 13:12:44 +05:30
2026-10-25 00:10:14 +01:00
2026-10-27 10:28:47 +13:00
2026-10-25 09:40:31 +00:00
2026-10-26 06:19:12 +00:00
2026-10-27 18:19:42 +13:00
2026-10-26 13:15:02 +00:00
2026-10-25 13:07:35 +02:00
2026-10-23 09:18:29 +01:00
2026-10-26 13:15:02 +00:00
2026-10-26 17:29:50 +01:00
2026-10-24 23:16:38 +00:00
2026-10-22 09:27:23 +02:00
2026-10-23 01:18:59 -03:00
2026-10-25 17:24:43 +01:00
2026-10-26 13:15:02 +00:00
2026-10-25 13:05:49 +02:00
2026-10-27 07:47:28 +01:00
2026-10-27 00:58:28 +13:00
2026-10-25 01:51:04 +01:00
2026-10-25 17:40:59 +01:00
2026-10-25 12:06:39 +13:00
2026-10-26 16:40:34 +05:30
2026-10-25 12:06:39 +13:00
2026-10-26 16:40:34 +05:30
2026-10-26 15:19:42 +01:00
2026-10-21 21:53:58 +03:00
2026-10-21 18:26:40 -04:00
2026-10-21 21:53:58 +03:00
2026-10-25 14:16:45 +01:00
2026-10-26 14:17:59 +13:00
2026-10-21 21:52:28 +03:00
2026-10-27 09:13:12 +13:00
2026-10-26 00:58:27 +05:30
2026-10-26 04:34:43 +05:30
2026-10-26 17:41:34 -03:00
2026-10-26 00:25:54 +08:00
2026-10-21 21:50:39 +03:00
2026-10-27 04:51:08 +01:00
2026-10-25 14:16:52 +01:00
2026-10-21 21:54:03 +03:00
2026-10-25 13:07:35 +02:00
2026-10-21 21:50:40 +03:00
2026-10-25 17:52:10 +01:00
2026-10-24 22:27:26 +02:00
2026-10-24 21:42:57 +13:00
2026-10-26 11:30:18 -03:00
2026-10-21 21:52:42 +03:00
2026-10-27 06:07:36 +01:00
2026-10-26 22:06:56 +08:00
2026-10-25 01:50:33 +02:00
2026-10-27 00:01:56 +01:00
2026-10-21 21:54:02 +03:00
2026-10-26 16:39:48 +01:00
2026-10-25 11:41:09 +05:30
2026-10-27 10:56:04 +13:00
2026-10-22 14:32:24 +01:00
2026-10-27 04:50:25 +01:00
2026-10-25 17:28:05 +01:00
2026-10-25 14:16:45 +01:00
2026-10-24 23:08:22 +00:00
2026-10-25 09:38:49 +00:00
2026-10-22 09:51:31 +05:00
2026-10-21 21:54:55 +03:00
2026-10-25 20:40:44 +13:00
2026-10-22 15:52:14 +03:00
2026-10-26 16:17:50 +01:00
2026-10-24 10:38:35 +13:00
2026-10-27 07:59:13 +01:00
2026-10-27 08:28:15 +01:00