Commit Graph

49 Commits

Author SHA1 Message Date
Colin Davidson 0a102bd757 shuffle to Kern_Return 2025-07-29 11:52:58 -07:00
Colin Davidson fe2b48dec4 enum pass 2025-07-29 11:48:58 -07:00
Colin Davidson b88f9194d0 Merge remote-tracking branch 'live/master' into macharena 2025-07-28 14:24:46 -07:00
Harold Brenes 219b0fe535 Replace system:System.framework imports with system:System
This makes the linker work for both macOS and iOS targets
2025-07-13 15:45:21 -04:00
Colin Davidson 2dae1d8a41 fix tabbing 2025-07-07 14:36:31 -07:00
Colin Davidson b1ed22d84f fix frequency grab 2025-06-08 16:16:34 -07:00
Colin Davidson d60fb5a44e update to master 2024-11-20 15:51:08 -08:00
Beau McCartney e240c034de aliases to enum members are other enum members, not constants 2024-10-12 20:11:46 -06:00
Beau McCartney 77cf4373a8 sync policy enum 2024-10-10 11:24:55 -06:00
Beau McCartney 4fffd1b271 kern return: doc comments above enum members 2024-10-10 11:12:42 -06:00
Beau McCartney 66c902406d align by space instead of colon 2024-10-10 11:09:06 -06:00
Beau McCartney 3aae1740c7 proc ( -> proc( 2024-10-10 11:03:55 -06:00
Beau McCartney b0ff41e673 indent with tabs not spaces 2024-10-08 19:08:13 -06:00
Beau McCartney 41c717de3f vm_flags as a bitset 2024-10-08 19:08:13 -06:00
Beau McCartney fee99c0800 move doc comment to right spot 2024-10-08 13:41:13 -06:00
Beau McCartney 58745bc7ae use b32 for boolean_t 2024-10-08 13:39:53 -06:00
Beau McCartney 27753ff7a8 VM_INHERIT_* as an enum 2024-10-08 12:51:18 -06:00
Beau McCartney 9004441e43 VM_PROT_* flags as a bitset 2024-10-08 12:51:12 -06:00
Beau McCartney 2695b269a4 kern return as an enum 2024-10-08 12:44:49 -06:00
Beau McCartney 67252ff415 make some types and procs match the c apis
procs:
| type          | old  | new (matching c api)|
| ---           | ---- | ------------------- |
| kern_return_t | u64  | c.int               |
| thread_t      | u64  | mach_port_t         |
| task_t        | u64  | mach_port_t         |
| semaphore_t   | u64  | mach_port_t         |

for mach_task_self(), return mach_port_t instead of task_t

for semaphore_signal_thread(), accept a thread_t instead of a thread_act_t
2024-10-08 12:12:21 -06:00
Beau McCartney db8950922c add mach_port_deallocate - frees the port from mach_make_memory_entry() 2024-10-07 15:48:24 -06:00
Beau McCartney 7b1086b489 make aliases of vm types not distinct
I think they're meant to be used interchangeably, just typedefed to have more
clear names for certain contexts
2024-10-07 14:24:38 -06:00
Beau McCartney f858374ef2 small cleanup 2024-10-07 11:45:45 -06:00
Beau McCartney eaafe92402 remove vm_flags_t - not in the original sdk 2024-10-07 11:45:24 -06:00
Beau McCartney 15d70390e5 add missing trailing comma 2024-10-06 23:29:34 -06:00
Beau McCartney 75c5cf3e80 indent with tabs, not spaces 2024-10-06 23:02:36 -06:00
Beau McCartney 609eb00335 remove note comments 2024-10-06 22:47:46 -06:00
Beau McCartney 2fc04f29c8 make extra types distinct to fit existing types 2024-10-06 22:47:20 -06:00
Beau McCartney 5c0c1287dc put function parameters on the same line where possible to fit style 2024-10-06 22:45:10 -06:00
Beau McCartney ac4f4e883a group type definitions 2024-10-06 22:41:42 -06:00
Beau McCartney 80c390e851 add mach procedures and vm_page_size
- vm_allocate()
- vm_deallocate()
- vm_map()
- mach_make_memory_entry()
2024-10-06 22:08:23 -06:00
Beau McCartney a205bcd0da add VM_INHERIT constants 2024-10-05 11:19:10 -06:00
Beau McCartney 27daebf46c add vm_prot_t constants 2024-10-05 11:18:32 -06:00
Beau McCartney 04ddcc5e64 add VM_FLAGS constants 2024-10-05 11:17:37 -06:00
Beau McCartney 7eabb1d744 add KERN_RETURN constants 2024-10-05 11:15:29 -06:00
Beau McCartney 3c2efb24b7 some mach types 2024-10-05 11:11:42 -06:00
Beau McCartney 2181a42bbf rename mach import cause its not just for threads now 2024-10-05 11:09:58 -06:00
Colin Davidson 99938c7d4f spawn tweaks 2024-09-24 02:31:44 -07:00
Colin Davidson 2119062a5a add more dyld support 2024-08-29 17:00:02 -07:00
Colin Davidson 06bc3b2a36 oops, duplicate const 2024-08-29 13:41:53 -07:00
Colin Davidson cc6e1bdcd6 add more dyld info collect 2024-08-29 12:02:54 -07:00
Colin Davidson d026ac2df2 add thread-info and memmap-info 2024-08-29 11:41:36 -07:00
Colin Davidson 0e344ae2d6 add ARM thread state 2024-08-29 01:54:09 -07:00
Colin Davidson 3209b319e8 more useful pieces 2024-08-28 23:50:17 -07:00
Colin Davidson b396280df7 add stuff needed for process control 2024-08-25 03:57:59 -07:00
gingerBill 9a16bc5fc5 Remove core:os dependency for base:runtime 2024-01-28 22:40:46 +00:00
gingerBill ca33cb990b Strip semicolons in core which were missing 2021-09-08 13:12:38 +01:00
Platin21 a71cbd4087 Changed foreign imports to now use the System Framework 2020-09-27 21:57:27 +03:00
Tetralux 99121d6ff2 Implement core:thread and core:sync on Unix using pthreads
Also do some cleanup and refactoring of the thread, sync and time APIs.

- remove 'semaphore_release' because 'post' and 'wait' is easier to understand

- change 'semaphore_wait' to '*_wait_for' to match Condition

- pthreads can be given a stack, but doing so requires the user to set up the guard
  pages manually. BE WARNED. The alignment requirements of the stack are also
  platform-dependant; it may need to be page size aligned on some systems.
  Unclear which systems, however. See 'os.get_page_size', and 'mem.make_aligned'.
  HOWEVER: I was unable to get custom stacks with guard pages working reliably,
  so while you can do it, the API does not support it.

- add 'os.get_page_size', 'mem.make_aligned', and 'mem.new_aligned'.

- removed thread return values because windows and linux are not consistent; windows returns 'i32'
  and pthreads return 'void*'; besides which, if you really wanted to communicate how the
  thread exited, you probably wouldn't do it with the thread's exit code.

- fixed 'thread.is_done' on Windows; it didn't report true immediately after calling 'thread.join'.

- moved time related stuff out of 'core:os' to 'core:time'.

- add 'mem.align_backward'

- fixed default allocator alignment
  The heap on Windows, and calloc on Linux, both have no facility to request alignment.
  It's a bit of hack, but the heap_allocator now overallocates; `size + alignment` bytes,
  and aligns things to at least 2.
  It does both of these things to ensure that there is at least two bytes before the payload,
  which it uses to store how much padding it needed to insert in order to fulfil the alignment
  requested.

- make conditions more sane by matching the Windows behaviour.
  The fact that they were signalled now lingers until a thread tries to wait,
  causing them to just pass by uninterrupted, without sleeping or locking the
  underlying mutex, as it would otherwise need to do.
  This means that a thread no longer has to be waiting in order to be signalled, which
  avoids timing bugs that causes deadlocks that are hard to debug and fix.
  See the comment on the `sync.Condition.flag` field.

- add thread priority: `thread.create(worker_proc, .High)`
2019-12-01 00:46:23 +00:00