Dmitry Adamushko wrote: > Hello everybody, > > being inspired by successful results of tests conducted recently by Jan & > team, > I'm presenting the final (yep, yet another final :) combo-patch. > > The shirq support now is optional, so that > > CONFIG_XENO_OPT_SHIRQ_LEVEL - enables shirq for level-triggered > interrupts; > > CONFIG_XENO_OPT_SHIRQ_EDGE - -//- for edge-triggered ones. > > I addressed all the remarks and now, IMHO, it's (hopefully) ready for merge. >
Hmm, I still find XN_ISR_NOINT in the patch. Shouldn't we solve this before merging (i.e. make XN_ISR_HANDLED non-zero)? Moreover, I attached an add-on patch to overcome the name buffer in xnintr_t. Note that this patch is only compile-tested, I have no native interrupt test-case at hand. Jan
diff -u include/nucleus/intr.h include/nucleus/intr.h --- include/nucleus/intr.h (Arbeitskopie) +++ include/nucleus/intr.h (Arbeitskopie) @@ -54,7 +54,7 @@ xniack_t iack; /* !< Interrupt acknowledge routine. */ - char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */ + const char *name; /* !< Symbolic name. */ } xnintr_t; diff -u ksrc/skins/native/syscall.c ksrc/skins/native/syscall.c --- ksrc/skins/native/syscall.c (Arbeitskopie) +++ ksrc/skins/native/syscall.c (Arbeitskopie) @@ -2883,23 +2883,15 @@ char name[XNOBJECT_NAME_LEN]; RT_INTR_PLACEHOLDER ph; int err, mode; - RT_INTR *intr; + struct { + RT_INTR intr; + char name[XNOBJECT_NAME_LEN]; + } *intr_buf; unsigned irq; if (!__xn_access_ok(curr,VERIFY_WRITE,__xn_reg_arg1(regs),sizeof(ph))) return -EFAULT; - if (__xn_reg_arg2(regs)) - { - if (!__xn_access_ok(curr,VERIFY_READ,__xn_reg_arg2(regs),sizeof(name))) - return -EFAULT; - - __xn_strncpy_from_user(curr,name,(const char __user *)__xn_reg_arg2(regs),sizeof(name) - 1); - name[sizeof(name) - 1] = '\0'; - } - else - *name = '\0'; - /* Interrupt line number. */ irq = (unsigned)__xn_reg_arg3(regs); @@ -2909,23 +2901,41 @@ if (mode & ~(I_AUTOENA|I_PROPAGATE)) return -EINVAL; - intr = (RT_INTR *)xnmalloc(sizeof(*intr)); + intr_buf = (typeof(intr_buf))xnmalloc(sizeof(*intr_buf)); - if (!intr) + if (!intr_buf) return -ENOMEM; - err = rt_intr_create(intr,name,irq,&rt_intr_handler,NULL,0); + if (__xn_reg_arg2(regs)) + { + if (!__xn_access_ok(curr,VERIFY_READ,__xn_reg_arg2(regs),sizeof(name))) + { + xnfree(intr_buf); + return -EFAULT; + } + + __xn_strncpy_from_user(curr, + intr_buf->name, + (const char __user *)__xn_reg_arg2(regs), + sizeof(intr_buf->name) - 1); + intr_buf->name[sizeof(intr_buf->name) - 1] = '\0'; + } + else + intr_buf->name[0] = '\0'; + + + err = rt_intr_create(&intr_buf->intr,intr_buf->name,irq,&rt_intr_handler,NULL,0); if (err == 0) { - intr->mode = mode; - intr->cpid = curr->pid; + intr_buf->intr.mode = mode; + intr_buf->intr.cpid = curr->pid; /* Copy back the registry handle to the ph struct. */ - ph.opaque = intr->handle; + ph.opaque = intr_buf->intr.handle; __xn_copy_to_user(curr,(void __user *)__xn_reg_arg1(regs),&ph,sizeof(ph)); } else - xnfree(intr); + xnfree(intr_buf); return err; } diff -u ksrc/nucleus/intr.c ksrc/nucleus/intr.c --- ksrc/nucleus/intr.c (Arbeitskopie) +++ ksrc/nucleus/intr.c (Arbeitskopie) @@ -148,7 +148,7 @@ intr->cookie = NULL; intr->hits = 0; intr->flags = flags; - xnobject_copy_name(intr->name,name); + intr->name = name; #if defined(CONFIG_XENO_OPT_SHIRQ_LEVEL) || defined(CONFIG_XENO_OPT_SHIRQ_EDGE) intr->next = NULL; #endif /* CONFIG_XENO_OPT_SHIRQ_LEVEL || CONFIG_XENO_OPT_SHIRQ_EDGE */
signature.asc
Description: OpenPGP digital signature