Jan Kiszka wrote: > ... > I also submit a new version of the required Xenomai extension. > Hopefully, I managed to integrate it more cleanly this time. >
I did not meet this goal as I found out on my own. So here is revision 3 of the Xenomai kgdb patch, now no longer breaking uvm or the simulator. Jan
Index: include/asm-uvm/system.h =================================================================== --- include/asm-uvm/system.h (Revision 1142) +++ include/asm-uvm/system.h (Arbeitskopie) @@ -787,4 +787,9 @@ static inline void xnarch_sysfree (void /* Ipipe-tracer */ #define ipipe_trace_panic_freeze() +/* kgdb hooks */ +#define xnarch_hook_safe_current(handler) do { } while (0) +#define xnarch_release_safe_current() do { } while (0) +#define XNARCH_DECLARE_SAFE_CURRENT(handler) + #endif /* !_XENO_ASM_UVM_SYSTEM_H */ Index: include/asm-generic/hal.h =================================================================== --- include/asm-generic/hal.h (Revision 1142) +++ include/asm-generic/hal.h (Arbeitskopie) @@ -573,6 +573,25 @@ struct proc_dir_entry *__rthal_add_proc_ struct proc_dir_entry *parent); #endif /* CONFIG_PROC_FS */ +#ifdef CONFIG_KGDB +#include <linux/kgdb.h> + +#define rthal_hook_safe_current(handler) \ + ipipe_safe_current = handler +#define rthal_release_safe_current() \ + ipipe_safe_current = ipipe_default_current + +#define RTHAL_DECLARE_SAFE_CURRENT(handler) \ +static struct task_struct *handler(void) \ +{ \ + return do_##handler(); \ +} +#else /* !CONFIG_KGDB */ +#define rthal_hook_safe_current(handler) do { } while (0) +#define rthal_release_safe_current() do { } while (0) +#define RTHAL_DECLARE_SAFE_CURRENT(handler) +#endif /* CONFIG_KGDB */ + #ifdef __cplusplus } #endif /* __cplusplus */ Index: include/asm-generic/system.h =================================================================== --- include/asm-generic/system.h (Revision 1142) +++ include/asm-generic/system.h (Arbeitskopie) @@ -669,4 +669,10 @@ static inline void xnarch_init_heapcb (x #define xnarch_post_graph(obj,state) #define xnarch_post_graph_if(obj,state,cond) +/* kgdb hooks */ +#define xnarch_hook_safe_current(handler) rthal_hook_safe_current(handler) +#define xnarch_release_safe_current rthal_release_safe_current +#define XNARCH_DECLARE_SAFE_CURRENT(handler) \ + RTHAL_DECLARE_SAFE_CURRENT(handler) + #endif /* !_XENO_ASM_GENERIC_SYSTEM_H */ Index: include/asm-sim/system.h =================================================================== --- include/asm-sim/system.h (Revision 1142) +++ include/asm-sim/system.h (Arbeitskopie) @@ -765,6 +765,11 @@ while(0) /* Ipipe-tracer */ #define ipipe_trace_panic_freeze() +/* kgdb hooks */ +#define xnarch_hook_safe_current(handler) do { } while (0) +#define xnarch_release_safe_current() do { } while (0) +#define XNARCH_DECLARE_SAFE_CURRENT(handler) + #ifndef PAGE_SIZE #define PAGE_SIZE sysconf(_SC_PAGESIZE) #endif /* !PAGE_SIZE */ Index: ksrc/nucleus/pod.c =================================================================== --- ksrc/nucleus/pod.c (Revision 1142) +++ ksrc/nucleus/pod.c (Arbeitskopie) @@ -234,6 +234,13 @@ static void xnpod_flush_heap(xnheap_t * xnarch_sysfree(extaddr, extsize); } +#define do_safe_current() \ +({ \ + xnpod_userspace_p() ? current : &init_task; \ +}} + +XNARCH_DECLARE_SAFE_CURRENT(safe_current); + /*! * \fn int xnpod_init(xnpod_t *pod,int minpri,int maxpri,xnflags_t flags) * \brief Initialize a new pod. @@ -373,6 +380,7 @@ int xnpod_init(xnpod_t *pod, int minpri, the remaining operations. */ nkpod = pod; + xnarch_hook_safe_current(safe_current); /* No direct handler here since the host timer processing is postponed to xnintr_irq_handler(), as part of the interrupt @@ -477,6 +485,7 @@ int xnpod_init(xnpod_t *pod, int minpri, if (err) { fail: + xnarch_release_safe_current(); nkpod = NULL; return err; } @@ -607,6 +616,7 @@ void xnpod_shutdown(int xtype) xnheap_destroy(&kheap, &xnpod_flush_heap, NULL); + xnarch_release_safe_current(); nkpod = NULL; unlock_and_exit:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Xenomai-core mailing list Xenomai-core@gna.org https://mail.gna.org/listinfo/xenomai-core