diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-03-14 09:25:04 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-03-14 09:25:51 +0100 |
commit | a336c4630161a6e5a3742c1430564d5566cafa58 (patch) | |
tree | 63ac6466cc495b75468869fdb7e4894f0939c6c8 | |
parent | Fix heap corruption in UNIX domain socket connect (diff) | |
download | rtems-libbsd-a336c4630161a6e5a3742c1430564d5566cafa58.tar.bz2 |
Update due to Watchdog Handler changes
-rw-r--r-- | freebsd/sys/kern/subr_sleepqueue.c | 28 | ||||
-rw-r--r-- | freebsd/sys/kern/sys_generic.c | 2 | ||||
-rw-r--r-- | rtemsbsd/rtems/rtems-bsd-thread.c | 2 |
3 files changed, 19 insertions, 13 deletions
diff --git a/freebsd/sys/kern/subr_sleepqueue.c b/freebsd/sys/kern/subr_sleepqueue.c index 5ae475ab..df3882e1 100644 --- a/freebsd/sys/kern/subr_sleepqueue.c +++ b/freebsd/sys/kern/subr_sleepqueue.c @@ -88,6 +88,7 @@ __FBSDID("$FreeBSD$"); #endif #ifdef __rtems__ #include <machine/rtems-bsd-thread.h> +#undef ticks #include <rtems/score/threadimpl.h> #include <rtems/score/watchdogimpl.h> #endif /* __rtems__ */ @@ -176,7 +177,7 @@ static void sleepq_switch(void *wchan, int pri); #ifndef __rtems__ static void sleepq_timeout(void *arg); #else /* __rtems__ */ -static void sleepq_timeout(Objects_Id id, void *arg); +static void sleepq_timeout(Watchdog_Control *watchdog); #endif /* __rtems__ */ SDT_PROBE_DECLARE(sched, , , sleep); @@ -417,15 +418,16 @@ sleepq_set_timeout(void *wchan, int timo) MPASS(wchan != NULL); callout_reset_curcpu(&td->td_slpcallout, timo, sleepq_timeout, td); #else /* __rtems__ */ + Per_CPU_Control *cpu_self; Thread_Control *executing; - _Thread_Disable_dispatch(); - executing = _Thread_Executing; - BSD_ASSERT(executing->Timer.state == WATCHDOG_INACTIVE); - _Watchdog_Initialize(&executing->Timer, sleepq_timeout, - 0, executing); - _Watchdog_Insert_ticks(&executing->Timer, (Watchdog_Interval)timo); - _Thread_Enable_dispatch(); + cpu_self = _Thread_Dispatch_disable(); + executing = _Per_CPU_Get_executing(cpu_self); + BSD_ASSERT(_Watchdog_Get_state(&executing->Timer.Watchdog) == + WATCHDOG_INACTIVE); + _Thread_Timer_insert_relative(executing, cpu_self, sleepq_timeout, + (Watchdog_Interval)timo); + _Thread_Dispatch_enable(cpu_self); #endif /* __rtems__ */ } @@ -666,7 +668,7 @@ sleepq_switch(void *wchan, int pri) _Thread_Lock_release_default(executing, &lock_context); if (unblock) { - _Watchdog_Remove_ticks(&executing->Timer); + _Thread_Timer_remove(executing); _Thread_Clear_state(executing, STATES_WAITING_FOR_BSD_WAKEUP); } @@ -950,7 +952,7 @@ sleepq_resume_thread(struct sleepqueue *sq, struct thread *td, int pri) return (setrunnable(td)); } #else /* __rtems__ */ - unblock = _Watchdog_Is_active(&thread->Timer); + unblock = _Watchdog_Is_scheduled(&thread->Timer.Watchdog); switch (td->td_sq_state) { case TD_SQ_SLEEPING: unblock = true; @@ -971,7 +973,7 @@ sleepq_resume_thread(struct sleepqueue *sq, struct thread *td, int pri) cpu_self = _Thread_Dispatch_disable_critical(&lock_context); _Thread_Lock_release_default(thread, &lock_context); - _Watchdog_Remove_ticks(&thread->Timer); + _Thread_Timer_remove(thread); _Thread_Clear_state(thread, STATES_WAITING_FOR_BSD_WAKEUP); _Thread_Dispatch_enable(cpu_self); @@ -1166,14 +1168,14 @@ sleepq_timeout(void *arg) } #else /* __rtems__ */ static void -sleepq_timeout(Objects_Id id, void *arg) +sleepq_timeout(Watchdog_Control *watchdog) { Thread_Control *thread; struct thread *td; ISR_lock_Context lock_context; bool unblock; - thread = arg; + thread = RTEMS_CONTAINER_OF(watchdog, Thread_Control, Timer.Watchdog); td = rtems_bsd_get_thread(thread); BSD_ASSERT(td != NULL); diff --git a/freebsd/sys/kern/sys_generic.c b/freebsd/sys/kern/sys_generic.c index 7c8bdcd3..b6239a42 100644 --- a/freebsd/sys/kern/sys_generic.c +++ b/freebsd/sys/kern/sys_generic.c @@ -1898,6 +1898,8 @@ selectinit(void *dummy __unused) #ifdef __rtems__ #include <machine/rtems-bsd-thread.h> +#undef ticks + #include <rtems/score/objectimpl.h> #include <rtems/score/threadimpl.h> diff --git a/rtemsbsd/rtems/rtems-bsd-thread.c b/rtemsbsd/rtems/rtems-bsd-thread.c index d3d1ac22..fe213201 100644 --- a/rtemsbsd/rtems/rtems-bsd-thread.c +++ b/rtemsbsd/rtems/rtems-bsd-thread.c @@ -53,6 +53,8 @@ #include <rtems/bsd/bsd.h> +#undef ticks + #include <rtems/score/objectimpl.h> #include <rtems/score/statesimpl.h> #include <rtems/score/threaddispatch.h> |