All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] [PATCH] kgdb-ipipe for 2.6.16
Date: Thu, 01 Jun 2006 10:00:30 +0200	[thread overview]
Message-ID: <447E9E9E.6070301@domain.hid> (raw)
In-Reply-To: <44720BD1.805@domain.hid>


[-- Attachment #1.1: Type: text/plain, Size: 316 bytes --]

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: xeno-kgdb-v3.patch --]
[-- Type: text/x-patch; name="xeno-kgdb-v3.patch", Size: 4028 bytes --]

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:

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 249 bytes --]

  reply	other threads:[~2006-06-01  8:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-22 19:06 [Xenomai-core] [PATCH] kgdb-ipipe for 2.6.16 Jan Kiszka
2006-06-01  8:00 ` Jan Kiszka [this message]
2006-06-07 16:19   ` [Xenomai-core] [PATCH] kgdb/x86 over I-pipe Philippe Gerum
2006-06-07 16:50     ` [Xenomai-core] " Jan Kiszka
2006-06-08  8:24       ` Philippe Gerum
2006-06-10 22:19         ` Jan Kiszka
2006-06-12  8:27           ` Philippe Gerum
2006-06-12  8:40             ` Jan Kiszka
2006-06-12  9:27               ` Philippe Gerum
2006-06-15 12:42                 ` Jan Kiszka
2006-06-15 14:24                   ` Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=447E9E9E.6070301@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.