mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 02:16:53 +08:00
Bugfix:hrt is used before it is initalized.
sched_note_{suspend|resume} were calling hrt_absolute_time before
it hrt_init is called. This can lead to register access before
clocking is enabled. The result is a hardfault.
This commit is contained in:
committed by
Lorenz Meier
parent
6c6cfd4f65
commit
0754e8f8bc
@@ -145,9 +145,10 @@ void sched_note_stop(FAR struct tcb_s *tcb)
|
|||||||
|
|
||||||
void sched_note_suspend(FAR struct tcb_s *tcb)
|
void sched_note_suspend(FAR struct tcb_s *tcb)
|
||||||
{
|
{
|
||||||
uint64_t new_time = hrt_absolute_time();
|
|
||||||
|
|
||||||
if (system_load.initialized) {
|
if (system_load.initialized) {
|
||||||
|
uint64_t new_time = hrt_absolute_time();
|
||||||
|
|
||||||
for (int i = 0; i < CONFIG_MAX_TASKS; i++) {
|
for (int i = 0; i < CONFIG_MAX_TASKS; i++) {
|
||||||
/* Task ending its current scheduling run */
|
/* Task ending its current scheduling run */
|
||||||
if (system_load.tasks[i].valid && system_load.tasks[i].tcb != 0 && system_load.tasks[i].tcb->pid == tcb->pid) {
|
if (system_load.tasks[i].valid && system_load.tasks[i].tcb != 0 && system_load.tasks[i].tcb->pid == tcb->pid) {
|
||||||
@@ -160,9 +161,10 @@ void sched_note_suspend(FAR struct tcb_s *tcb)
|
|||||||
|
|
||||||
void sched_note_resume(FAR struct tcb_s *tcb)
|
void sched_note_resume(FAR struct tcb_s *tcb)
|
||||||
{
|
{
|
||||||
uint64_t new_time = hrt_absolute_time();
|
|
||||||
|
|
||||||
if (system_load.initialized) {
|
if (system_load.initialized) {
|
||||||
|
uint64_t new_time = hrt_absolute_time();
|
||||||
|
|
||||||
for (int i = 0; i < CONFIG_MAX_TASKS; i++) {
|
for (int i = 0; i < CONFIG_MAX_TASKS; i++) {
|
||||||
if (system_load.tasks[i].valid && system_load.tasks[i].tcb->pid == tcb->pid) {
|
if (system_load.tasks[i].valid && system_load.tasks[i].tcb->pid == tcb->pid) {
|
||||||
system_load.tasks[i].curr_start_time = new_time;
|
system_load.tasks[i].curr_start_time = new_time;
|
||||||
|
|||||||
Reference in New Issue
Block a user