Module: xenomai-2.5
Branch: master
Commit: 6306a9c66f92ff6378c0baa1afcf21e7c5477934
URL:    
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=6306a9c66f92ff6378c0baa1afcf21e7c5477934

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Sep 21 17:05:32 2010 +0200

psos: introduce t_setreg/t_getreg syscalls

---

 include/psos+/syscall.h    |    2 +
 ksrc/skins/psos+/syscall.c |   55 ++++++++++++++++++++++++++++++++++++++++++++
 src/skins/psos+/task.c     |   12 +++++++++
 3 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/include/psos+/syscall.h b/include/psos+/syscall.h
index 86cc998..a3507d0 100644
--- a/include/psos+/syscall.h
+++ b/include/psos+/syscall.h
@@ -75,6 +75,8 @@
 #define __psos_tm_getc      46
 /* Xenomai internal: get hidden pthread_t identifier. */
 #define __psos_t_getpth     47
+#define __psos_t_setreg     48
+#define __psos_t_getreg     49
 
 struct psos_arg_bulk {
     u_long a1;
diff --git a/ksrc/skins/psos+/syscall.c b/ksrc/skins/psos+/syscall.c
index 3ce53cc..2990fef 100644
--- a/ksrc/skins/psos+/syscall.c
+++ b/ksrc/skins/psos+/syscall.c
@@ -320,6 +320,59 @@ static int __t_setpri(struct pt_regs *regs)
 }
 
 /*
+ * int __t_setreg(u_long tid, u_long regnum, u_long regval)
+ */
+
+static int __t_setreg(struct pt_regs *regs)
+{
+       xnhandle_t handle = __xn_reg_arg1(regs);
+       u_long regnum, regval;
+       psostask_t *task;
+
+       if (handle)
+               task = __psos_task_lookup(handle);
+       else
+               task = __psos_task_current(current);
+
+       if (task == NULL)
+               return ERR_OBJID;
+
+       regnum = __xn_reg_arg2(regs);
+       regval = __xn_reg_arg3(regs);
+
+       return t_setreg((u_long)task, regnum, regval);
+}
+
+/*
+ * int __t_getreg(u_long tid, u_long regnum, u_long *regvalp)
+ */
+
+static int __t_getreg(struct pt_regs *regs)
+{
+       xnhandle_t handle = __xn_reg_arg1(regs);
+       u_long err, regnum, regval;
+       psostask_t *task;
+
+       if (handle)
+               task = __psos_task_lookup(handle);
+       else
+               task = __psos_task_current(current);
+
+       if (task == NULL)
+               return ERR_OBJID;
+
+       regnum = __xn_reg_arg2(regs);
+
+       err = t_getreg((u_long)task, regnum, &regval);
+       if (err == SUCCESS &&
+           __xn_safe_copy_to_user((void __user *)__xn_reg_arg3(regs), &regval,
+                                  sizeof(regval)))
+               return -EFAULT;
+
+       return err;
+}
+
+/*
  * int __ev_send(u_long tid, u_long events)
  */
 
@@ -1425,6 +1478,8 @@ static xnsysent_t __systab[] = {
        [__psos_t_ident] = {&__t_ident, __xn_exec_primary},
        [__psos_t_mode] = {&__t_mode, __xn_exec_primary},
        [__psos_t_setpri] = {&__t_setpri, __xn_exec_conforming},
+       [__psos_t_setreg] = {&__t_setreg, __xn_exec_any},
+       [__psos_t_getreg] = {&__t_getreg, __xn_exec_any},
        [__psos_ev_send] = {&__ev_send, __xn_exec_any},
        [__psos_ev_receive] = {&__ev_receive, __xn_exec_primary},
        [__psos_q_create] = {&__q_create, __xn_exec_any},
diff --git a/src/skins/psos+/task.c b/src/skins/psos+/task.c
index 89871cb..98d16f6 100644
--- a/src/skins/psos+/task.c
+++ b/src/skins/psos+/task.c
@@ -246,6 +246,18 @@ u_long t_resume(u_long tid)
        return XENOMAI_SKINCALL1(__psos_muxid, __psos_t_resume, tid);
 }
 
+u_long t_setreg(u_long tid, u_long regnum, u_long regvalue)
+{
+       return XENOMAI_SKINCALL3(__psos_muxid, __psos_t_setreg,
+                                tid, regnum, regvalue);
+}
+
+u_long t_getreg(u_long tid, u_long regnum, u_long *regvalue_r)
+{
+       return XENOMAI_SKINCALL3(__psos_muxid, __psos_t_getreg,
+                                tid, regnum, regvalue_r);
+}
+
 u_long t_ident(const char *name, u_long nodeno, u_long *tid_r)
 {
        return XENOMAI_SKINCALL2(__psos_muxid, __psos_t_ident, name, tid_r);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to