Commit Graph

287 Commits

Author SHA1 Message Date
Chris Copeland 3ecb30c92a
only decrement semaphore values unconditionally in syscalls 2024-05-13 22:32:15 -07:00
Chris Copeland fb80a44d57
simplify rt_mutex_lock and rt_mutex_timedlock 2024-05-13 22:24:57 -07:00
Chris Copeland 0a3cf658e0
expand on comments about mutex priority donation 2024-05-13 00:28:48 -07:00
Chris Copeland 4af0fd555f
fix rt_mutex_unlock when used from an interrupt 2024-05-07 23:24:29 -07:00
Chris Copeland 57d472447b
fix rt_logf call in src/mutex.c 2024-04-29 09:22:46 -07:00
Chris Copeland 06cacd01ee
add thread-local storage support for arm 2024-04-27 01:23:37 -07:00
Chris Copeland b0426a0d68
add rt_tick_elapse and use it in cond.c and rwlock.c 2024-04-19 06:32:46 -07:00
Chris Copeland 6d981b2b79
avoid extra load and eliminate stack usage in rt_task_sleep_periodic 2024-04-18 21:12:16 -07:00
Chris Copeland 53c48701dd
fix rt_mutex_timedlock and rt_sem_timedwait with 0 timeout 2024-04-18 21:06:08 -07:00
Chris Copeland b9957f0957
remove rt_mutex_holder, avoid priority donation to an interrupt 2024-03-31 22:42:54 -07:00
Chris Copeland 5d9816bd4a
simplify LOCK and TIMEDLOCK syscalls to not also call wake_mutex_waiter
make interrupts use a specific holder value when acquiring a mutex
2024-03-31 18:36:20 -07:00
Chris Copeland 43f6125f17
fix RT_SYSCALL_EXIT after ready list refactor
previously exit implicitly made the task not runnable just by changing
its state, but now that active tasks remain in the ready list, an
exiting task must be explicitly removed
2024-03-22 10:36:48 -07:00
Chris Copeland 3cbea40dbd
refactor mpu.h some more and rename RT_MPU_ENABLE to RT_MPU_TASK_REGIONS_ENABLE 2024-03-17 02:45:13 -07:00
Chris Copeland bb0f25cf7f
add more comments to wake_mutex_waiter 2024-03-14 03:18:40 -07:00
Chris Copeland 13df16bf59
remove insert helper function from list.c 2024-03-08 07:28:49 -08:00
Chris Copeland 7d0353b1d7
pass synchronous syscall arguments in registers
rt_syscall_op -> rt_syscall

split the syscall enum between synchronous and asynchronous syscalls

add explicit YIELD syscall enum

split blocking states by sem vs. mutex to simplify donation and timeouts
2024-03-08 00:28:27 -08:00
Chris Copeland 4cfc55f40a
use first_task->name in rt_start_context 2024-03-07 23:57:53 -08:00
Chris Copeland bf6a52137c
fix ready list management on c28 2024-03-07 23:57:53 -08:00
Chris Copeland 82d9af898e
remove RT_SYSCALL_TASK_READY
have rust's task init add directly to ready lists, which themselves don't need a constructor anymore
2024-03-03 18:18:47 -08:00
Chris Copeland 8845d8d1b6
refactor ready list management and make lower priority numbers higher priority 2024-02-24 03:37:52 -08:00
Chris Copeland 75395d3301
explain more about priority donation on unlock 2024-02-23 02:31:39 -08:00
Chris Copeland 074fdc691a
add comment about the need for wake_mutex_waiter in the lock syscall handler 2024-02-23 02:31:39 -08:00
Chris Copeland 9be7eaa7e0
use acquire memory order in wake_sem_waiters 2024-02-22 07:46:07 -08:00
Chris Copeland dd5438f39c
split rt_syscall_run into rt_syscall_run and rt_syscall_run_pending
rt_syscall now triggers a single syscall synchronously, masking the
pending syscall handler

split the svc and syscall irq handlers on arch/arm/ar

split the svcall and pendsv handlers on arch/arm/m

add a user1 interrupt handler on arch/c28

invoke synchronous syscalls directly in the active thread in arch/pthread

move rt_pending_syscalls to privileged .bss now that tasks don't need
to modify it

add alignment attribute to arm/ar interrupt handler macros

provide CPACR_FPU_ENABLE to assembler and initialize task's cpacr to the
processor's default, fpu-disabled, value rather than 0

don't yield for empty rt_pending_syscalls (yield is synchronous only)

add missing sigemptyset to block_all_signals

update arch/arm/README.md
2024-02-21 00:39:55 -08:00
Chris Copeland 6207eee9e4
split next_ready_task into a check and a get to avoid redundant NULL check in sched 2024-01-22 01:22:46 -08:00
Chris Copeland 947d61bcc5
add const to local in sched 2024-01-17 01:54:47 -08:00
Chris Copeland a746c3cf6d
add const to locals in mutex_priority_greater_than 2024-01-17 01:36:18 -08:00
Chris Copeland 3df912ca2c
remove a compound conditional from sched by adding one to the next task's priority when yielding 2024-01-17 01:28:40 -08:00
Chris Copeland b277bd976b
MAX_PRIORITY -> PRIORITY_MAX, add PRIORITY_MIN 2024-01-04 00:39:14 -08:00
Chris Copeland 8e38fc67e7
remove rt_list_for_each 2023-12-18 01:39:36 -08:00
Chris Copeland 2ba14d5f11
remove lock+unlock in rdunlock now that cond semaphores have a maximum of 1 2023-12-17 00:57:50 -08:00
Chris Copeland fe61771778
use a normal binary semaphore for cond to allow a signal that happens before a cond_wait but after a condition check to be received 2023-12-10 22:28:29 -08:00
Chris Copeland 74f76b300e
arch/c28 2023-11-05 22:46:40 -08:00
Chris Copeland 28eb29e099
add src/assert.c, fix rt_atomic macro and use it for pointers also 2023-11-02 07:00:32 -07:00
Chris Copeland a771ce3e43
add more includes that were previously implicit 2023-10-31 23:03:34 -07:00
Chris Copeland 2321d43661
move rt_once_call to once.c and remove rt_once_call_slow 2023-10-31 23:03:34 -07:00
Chris Copeland 7c691e5423
fix up includes 2023-10-31 23:03:34 -07:00
Chris Copeland 42783dfbb1
clear WRITE_PENDING_MASK on successful wrlock 2023-10-30 23:55:17 -07:00
Chris Copeland ac741228c5
only have the last reader signal in rdunlock, add more comments 2023-10-30 00:43:11 -07:00
Chris Copeland 313bda2380
rework rwlock and add {try,timed}{rd,wr}lock add {rd,wr}unlock 2023-10-29 07:04:51 -07:00
Chris Copeland 4192c24579
rwlock.m -> rwlock.mutex 2023-10-28 12:30:10 -07:00
Chris Copeland 6bba1579dd
ticks_waited -> wait_ticks 2023-10-24 00:54:02 -07:00
Chris Copeland 65f051ca3b
add rt_mutex_holder function 2023-10-24 00:53:37 -07:00
Chris Copeland 78904add84
only initialize required fields of each rt_syscall_record 2023-10-22 11:55:43 -07:00
Chris Copeland 812117ff49
add recursive mutexes 2023-10-17 23:03:54 -07:00
Chris Copeland d8182e4f1c
clean up comments, use #pragma once everywhere 2023-10-14 13:50:37 -07:00
Chris Copeland b7625f8227
use rt_trap instead of infinite loop at end of rt_task_exit 2023-10-11 23:31:34 -07:00
Chris Copeland c4abb96de1
refactor MPU interface, simplify start and unify creation of idle task 2023-10-10 23:09:58 -07:00
Chris Copeland 778399d0d3
refactor rt_syscall and rt_syscall_pend
make rt_syscall_pend work from interrupts and rt_syscall work from tasks
remove old rt_syscall_pend that works from both

rename enum rt_syscall to enum rt_syscall_op
2023-09-19 23:19:33 -07:00
Chris Copeland 1241b04575
use rt_syscall_pend_from_task in rt_mutex_unlock in the has-waiters path 2023-09-19 06:13:11 -07:00