[Xenomai-git] Philippe Gerum : cobalt/sched: assoc policy identifier to sched class
Module: xenomai-3 Branch: next Commit: f15920c67d075cee304e673ad2b76610dda3b97d URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f15920c67d075cee304e673ad2b76610dda3b97d Author: Philippe Gerum r...@xenomai.org Date: Wed Oct 29 10:03:46 2014 +0100 cobalt/sched: assoc policy identifier to sched class --- include/cobalt/kernel/sched.h |1 + kernel/cobalt/posix/thread.c | 10 -- kernel/cobalt/posix/thread.h |3 --- kernel/cobalt/sched-idle.c |1 + kernel/cobalt/sched-quota.c|2 ++ kernel/cobalt/sched-rt.c |1 + kernel/cobalt/sched-sporadic.c |2 ++ kernel/cobalt/sched-tp.c |2 ++ kernel/cobalt/sched-weak.c |2 ++ 9 files changed, 15 insertions(+), 9 deletions(-) diff --git a/include/cobalt/kernel/sched.h b/include/cobalt/kernel/sched.h index 424538b..1ee2aa7 100644 --- a/include/cobalt/kernel/sched.h +++ b/include/cobalt/kernel/sched.h @@ -158,6 +158,7 @@ struct xnsched_class { int nthreads; struct xnsched_class *next; int weight; + int policy; const char *name; }; diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c index 27c824b..0786ad3 100644 --- a/kernel/cobalt/posix/thread.c +++ b/kernel/cobalt/posix/thread.c @@ -264,7 +264,6 @@ pthread_setschedparam_ex(struct cobalt_thread *thread, ret = -EINVAL; goto out; } - thread-sched_u_policy = policy; xnthread_set_slice(thread-threadbase, tslice); if (cobalt_call_extension(thread_setsched, thread-extref, ret, sched_class, param) ret) @@ -284,7 +283,6 @@ pthread_getschedparam_ex(struct cobalt_thread *thread, { struct xnsched_class *base_class; struct xnthread *base_thread; - int prio; spl_t s; xnlock_get_irqsave(nklock, s); @@ -297,9 +295,10 @@ pthread_getschedparam_ex(struct cobalt_thread *thread, base_thread = thread-threadbase; base_class = base_thread-base_class; - *policy_r = thread-sched_u_policy; - prio = xnthread_base_priority(base_thread); - param_ex-sched_priority = prio; + param_ex-sched_priority = xnthread_base_priority(base_thread); + *policy_r = base_class-policy; + if (param_ex-sched_priority == 0) /* SCHED_FIFO/SCHED_WEAK */ + *policy_r = SCHED_NORMAL; if (base_class == xnsched_class_rt) { if (xnthread_test_state(base_thread, XNRRB)) @@ -379,7 +378,6 @@ static inline int pthread_create(struct cobalt_thread **thread_p, return ret; } - thread-sched_u_policy = policy; thread-magic = COBALT_THREAD_MAGIC; xnsynch_init(thread-monitor_synch, XNSYNCH_FIFO, NULL); diff --git a/kernel/cobalt/posix/thread.h b/kernel/cobalt/posix/thread.h index d1bc034..34dc6cc 100644 --- a/kernel/cobalt/posix/thread.h +++ b/kernel/cobalt/posix/thread.h @@ -102,9 +102,6 @@ struct cobalt_thread { struct xnsynch sigwait; struct list_head signext; - /** Cached value for current policy (user side). */ - int sched_u_policy; - /** Monitor wait object and link holder. */ struct xnsynch monitor_synch; struct list_head monitor_link; diff --git a/kernel/cobalt/sched-idle.c b/kernel/cobalt/sched-idle.c index 5127798..8f59c0d 100644 --- a/kernel/cobalt/sched-idle.c +++ b/kernel/cobalt/sched-idle.c @@ -56,5 +56,6 @@ struct xnsched_class xnsched_class_idle = { .sched_getparam = xnsched_idle_getparam, .sched_trackprio= xnsched_idle_trackprio, .weight = XNSCHED_CLASS_WEIGHT(0), + .policy = SCHED_IDLE, .name = idle }; diff --git a/kernel/cobalt/sched-quota.c b/kernel/cobalt/sched-quota.c index 8a72819..71e2c36 100644 --- a/kernel/cobalt/sched-quota.c +++ b/kernel/cobalt/sched-quota.c @@ -19,6 +19,7 @@ #include linux/bitmap.h #include cobalt/kernel/sched.h #include cobalt/kernel/arith.h +#include cobalt/uapi/sched.h /* * With this policy, each per-CPU scheduler slot maintains a list of @@ -765,6 +766,7 @@ struct xnsched_class xnsched_class_quota = { .sched_cleanup_vfile= xnsched_quota_cleanup_vfile, #endif .weight = XNSCHED_CLASS_WEIGHT(3), + .policy = SCHED_QUOTA, .name = quota }; EXPORT_SYMBOL_GPL(xnsched_class_quota); diff --git a/kernel/cobalt/sched-rt.c b/kernel/cobalt/sched-rt.c index 44f90dd..3bd9308 100644 --- a/kernel/cobalt/sched-rt.c +++ b/kernel/cobalt/sched-rt.c @@ -246,6 +246,7 @@ struct xnsched_class xnsched_class_rt = { .sched_cleanup_vfile= xnsched_rt_cleanup_vfile, #endif .weight = XNSCHED_CLASS_WEIGHT(4), + .policy = SCHED_FIFO, .name = rt
[Xenomai-git] Philippe Gerum : cobalt/posix/compat: fix sys32 helpers
Module: xenomai-3 Branch: next Commit: d2e53792f75e9f5670bf557eb7fde408296c0bf6 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d2e53792f75e9f5670bf557eb7fde408296c0bf6 Author: Philippe Gerum r...@xenomai.org Date: Wed Oct 29 08:26:53 2014 +0100 cobalt/posix/compat: fix sys32 helpers --- kernel/cobalt/posix/sem.c |2 +- kernel/cobalt/posix/syscall32.c |9 + 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/kernel/cobalt/posix/sem.c b/kernel/cobalt/posix/sem.c index fb9f391..eca42e3 100644 --- a/kernel/cobalt/posix/sem.c +++ b/kernel/cobalt/posix/sem.c @@ -306,7 +306,7 @@ int __cobalt_sem_timedwait(struct cobalt_sem_shadow __user *u_sem, if (pull_ts) { atomic_inc(sem-state-value); xnlock_put_irqrestore(nklock, s); - ret = sem_fetch_timeout(ts, u_ts); + ret = fetch_timeout(ts, u_ts); xnlock_get_irqsave(nklock, s); if (ret) break; diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c index 87ea0b7..6620fdf 100644 --- a/kernel/cobalt/posix/syscall32.c +++ b/kernel/cobalt/posix/syscall32.c @@ -115,13 +115,6 @@ COBALT_SYSCALL32emu(sem_timedwait, primary, int, (struct cobalt_sem_shadow __user *u_sem, struct compat_timespec __user *u_ts)) { - struct timespec ts; - int ret; - - ret = sys32_get_timespec(ts, u_ts); - if (ret) - return ret; - return __cobalt_sem_timedwait(u_sem, u_ts, sys32_fetch_timeout); } @@ -136,7 +129,7 @@ COBALT_SYSCALL32emu(clock_getres, current, if (ret) return ret; - return sys32_put_timespec(u_ts, ts); + return u_ts ? sys32_put_timespec(u_ts, ts) : 0; } COBALT_SYSCALL32emu(clock_gettime, current, ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt: factor out compat helpers for common types
Module: xenomai-3 Branch: next Commit: 4572997e878f24625c8ddbfa5256b8f423679bf8 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=4572997e878f24625c8ddbfa5256b8f423679bf8 Author: Philippe Gerum r...@xenomai.org Date: Tue Oct 28 19:14:09 2014 +0100 cobalt: factor out compat helpers for common types --- .../posix = include/cobalt/kernel}/compat.h | 34 ++--- include/cobalt/kernel/rtdm/cobalt.h|1 - include/cobalt/kernel/rtdm/compat.h|3 +- kernel/cobalt/posix/compat.c | 44 +++- kernel/cobalt/posix/syscall32.c| 13 + kernel/cobalt/posix/syscall32.h|8 ++- kernel/drivers/ipc/rtipc.c | 53 +--- 7 files changed, 93 insertions(+), 63 deletions(-) diff --git a/kernel/cobalt/posix/compat.h b/include/cobalt/kernel/compat.h similarity index 86% rename from kernel/cobalt/posix/compat.h rename to include/cobalt/kernel/compat.h index 466ea43..6a2e838 100644 --- a/kernel/cobalt/posix/compat.h +++ b/include/cobalt/kernel/compat.h @@ -15,26 +15,16 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _COBALT_POSIX_COMPAT_H -#define _COBALT_POSIX_COMPAT_H +#ifndef _COBALT_KERNEL_COMPAT_H +#define _COBALT_KERNEL_COMPAT_H #ifdef CONFIG_COMPAT -#include rtdm/compat.h -/* CAUTION: rtdm/cobalt.h reads this header. */ -#include xenomai/posix/thread.h -#include xenomai/posix/mutex.h -#include xenomai/posix/cond.h -#include xenomai/posix/sem.h -#include xenomai/posix/sched.h -#include xenomai/posix/mqueue.h -#include xenomai/posix/clock.h -#include xenomai/posix/timer.h -#include xenomai/posix/timerfd.h -#include xenomai/posix/signal.h -#include xenomai/posix/monitor.h -#include xenomai/posix/event.h -#include xenomai/posix/io.h +#include linux/compat.h +#include net/compat.h +#include cobalt/uapi/sched.h + +struct mq_attr; struct __compat_sched_ss_param { int __sched_low_priority; @@ -150,6 +140,14 @@ int sys32_get_msghdr(struct msghdr *msg, int sys32_put_msghdr(struct compat_msghdr __user *u_cmsg, const struct msghdr *msg); +int sys32_get_iovec(struct iovec *iov, + const struct compat_iovec __user *ciov, + int ciovlen); + +int sys32_put_iovec(struct compat_iovec __user *u_ciov, + const struct iovec *iov, + int iovlen); + #endif /* CONFIG_COMPAT */ -#endif /* !_COBALT_POSIX_COMPAT_H */ +#endif /* !_COBALT_KERNEL_COMPAT_H */ diff --git a/include/cobalt/kernel/rtdm/cobalt.h b/include/cobalt/kernel/rtdm/cobalt.h index fc75430..2c38053 100644 --- a/include/cobalt/kernel/rtdm/cobalt.h +++ b/include/cobalt/kernel/rtdm/cobalt.h @@ -29,6 +29,5 @@ #include xenomai/posix/clock.h #include xenomai/posix/event.h #include xenomai/posix/monitor.h -#include xenomai/posix/compat.h #endif /* !_COBALT_RTDM_COBALT_H */ diff --git a/include/cobalt/kernel/rtdm/compat.h b/include/cobalt/kernel/rtdm/compat.h index 44b6884..974f9bd 100644 --- a/include/cobalt/kernel/rtdm/compat.h +++ b/include/cobalt/kernel/rtdm/compat.h @@ -20,8 +20,7 @@ #ifdef CONFIG_COMPAT -#include linux/compat.h -#include net/compat.h +#include cobalt/kernel/compat.h #include rtdm/rtdm.h struct compat_rtdm_getsockopt_args { diff --git a/kernel/cobalt/posix/compat.c b/kernel/cobalt/posix/compat.c index 948616c..5808371 100644 --- a/kernel/cobalt/posix/compat.c +++ b/kernel/cobalt/posix/compat.c @@ -17,7 +17,9 @@ */ #include linux/err.h #include linux/module.h -#include compat.h +#include cobalt/kernel/compat.h +#include asm/xenomai/syscall.h +#include xenomai/posix/mqueue.h int sys32_get_timespec(struct timespec *ts, const struct compat_timespec __user *cts) @@ -379,3 +381,43 @@ int sys32_put_msghdr(struct compat_msghdr __user *u_cmsg, return 0; } EXPORT_SYMBOL_GPL(sys32_put_msghdr); + +int sys32_get_iovec(struct iovec *iov, + const struct compat_iovec __user *u_ciov, + int ciovlen) +{ + const struct compat_iovec __user *p; + struct compat_iovec ciov; + int ret, n; + + for (n = 0, p = u_ciov; n ciovlen; n++, p++) { + ret = __xn_safe_copy_from_user(ciov, p, sizeof(ciov)); + if (ret) + return ret; + iov[n].iov_base = compat_ptr(ciov.iov_base); + iov[n].iov_len = ciov.iov_len; + } + + return 0; +} +EXPORT_SYMBOL_GPL(sys32_get_iovec); + +int sys32_put_iovec(struct compat_iovec __user *u_ciov, + const struct iovec *iov, + int iovlen) +{ + struct compat_iovec __user *p; + struct compat_iovec ciov; + int ret, n; + + for (n = 0, p = u_ciov; n iovlen; n++, p++) { + ciov.iov_base =
[Xenomai-git] Philippe Gerum : cobalt/posix/sched: switch set/ getconfig calls to conforming mode
Module: xenomai-3 Branch: next Commit: bab8db9977b72dbbe6fa35787d9a173e156b6815 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bab8db9977b72dbbe6fa35787d9a173e156b6815 Author: Philippe Gerum r...@xenomai.org Date: Wed Oct 29 12:38:13 2014 +0100 cobalt/posix/sched: switch set/getconfig calls to conforming mode --- kernel/cobalt/posix/sched.c |4 ++-- kernel/cobalt/posix/syscall.c |4 ++-- kernel/cobalt/posix/syscall32.c |4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/cobalt/posix/sched.c b/kernel/cobalt/posix/sched.c index 2dcdfcd..20221a4 100644 --- a/kernel/cobalt/posix/sched.c +++ b/kernel/cobalt/posix/sched.c @@ -631,7 +631,7 @@ int __cobalt_sched_setconfig_np(int cpu, int policy, return ret; } -COBALT_SYSCALL(sched_setconfig_np, current, +COBALT_SYSCALL(sched_setconfig_np, conforming, int, (int cpu, int policy, union sched_config __user *u_config, size_t len)) @@ -672,7 +672,7 @@ ssize_t __cobalt_sched_getconfig_np(int cpu, int policy, return ret; } -COBALT_SYSCALL(sched_getconfig_np, current, +COBALT_SYSCALL(sched_getconfig_np, conforming, ssize_t, (int cpu, int policy, union sched_config __user *u_config, size_t len)) diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c index 537defe..e327f7e 100644 --- a/kernel/cobalt/posix/syscall.c +++ b/kernel/cobalt/posix/syscall.c @@ -693,8 +693,8 @@ static const int cobalt_sysmodes[] = { __COBALT_MODE(event_wait, primary), __COBALT_MODE(event_sync, current), __COBALT_MODE(event_inquire, current), - __COBALT_MODE(sched_setconfig_np, current), - __COBALT_MODE(sched_getconfig_np, current), + __COBALT_MODE(sched_setconfig_np, conforming), + __COBALT_MODE(sched_getconfig_np, conforming), __COBALT_MODE(open, lostage), __COBALT_MODE(socket, lostage), __COBALT_MODE(close, lostage), diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c index 6620fdf..9bc852e 100644 --- a/kernel/cobalt/posix/syscall32.c +++ b/kernel/cobalt/posix/syscall32.c @@ -421,7 +421,7 @@ static ssize_t sys32_put_config(int policy, return ret ?: u_len; } -COBALT_SYSCALL32emu(sched_setconfig_np, current, +COBALT_SYSCALL32emu(sched_setconfig_np, conforming, int, (int cpu, int policy, union compat_sched_config __user *u_config, size_t len)) @@ -430,7 +430,7 @@ COBALT_SYSCALL32emu(sched_setconfig_np, current, sys32_fetch_config, sys32_ack_config); } -COBALT_SYSCALL32emu(sched_getconfig_np, current, +COBALT_SYSCALL32emu(sched_getconfig_np, conformin, ssize_t, (int cpu, int policy, union compat_sched_config __user *u_config, size_t len)) ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Jan Kiszka : arch/x86: Fix section mismatch warning for mach_x86_c1e_disable
Module: xenomai-jki Branch: for-forge Commit: 31e9c025940ce2ae617ec3c498b47aa725d7157b URL: http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=31e9c025940ce2ae617ec3c498b47aa725d7157b Author: Jan Kiszka jan.kis...@siemens.com Date: Wed Jul 9 17:50:30 2014 +0200 arch/x86: Fix section mismatch warning for mach_x86_c1e_disable mach_x86_c1e_disable is called from non-__init function mach_x86_init, thus can't be tagged as __init. mach_x86_init can't be converted as it is referenced by the persistent xnarch_machdesc structure. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- kernel/cobalt/arch/x86/c1e.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/cobalt/arch/x86/c1e.c b/kernel/cobalt/arch/x86/c1e.c index 9aa4c66..9bd4e92 100644 --- a/kernel/cobalt/arch/x86/c1e.c +++ b/kernel/cobalt/arch/x86/c1e.c @@ -56,7 +56,7 @@ static void c1e_promotion_disable(void *dummy) wrmsrl(MSR_IA32_POWER_CTL, msr_bits); } -void __init mach_x86_c1e_disable(void) +void mach_x86_c1e_disable(void) { const struct x86_cpu_id *id; ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Gilles Chanteperdrix : lib/cobalt: wrap time and gettimeofday calls
Module: xenomai-3 Branch: next Commit: 496b0b95d4eb780ce8c3ba769151697204606b60 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=496b0b95d4eb780ce8c3ba769151697204606b60 Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org Date: Sat Sep 20 23:06:02 2014 +0200 lib/cobalt: wrap time and gettimeofday calls --- include/cobalt/time.h |2 ++ lib/cobalt/assert_context.c |7 --- lib/cobalt/clock.c | 23 +++ lib/cobalt/cobalt.wrappers |1 + 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/include/cobalt/time.h b/include/cobalt/time.h index c5d7412..fed8957 100644 --- a/include/cobalt/time.h +++ b/include/cobalt/time.h @@ -44,6 +44,8 @@ COBALT_DECL(int, clock_nanosleep(clockid_t clock_id, const struct timespec *rqtp, struct timespec *rmtp)); +COBALT_DECL(time_t, time(time_t *t)); + COBALT_DECL(int, nanosleep(const struct timespec *rqtp, struct timespec *rmtp)); diff --git a/lib/cobalt/assert_context.c b/lib/cobalt/assert_context.c index 6b49f3d..48690dc 100644 --- a/lib/cobalt/assert_context.c +++ b/lib/cobalt/assert_context.c @@ -75,10 +75,3 @@ COBALT_IMPL(void, free, (void *ptr)) assert_nrt(); __STD(free(ptr)); } - -/* vsyscall-based services */ -COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) -{ - assert_nrt(); - return __STD(gettimeofday(tv, tz)); -} diff --git a/lib/cobalt/clock.c b/lib/cobalt/clock.c index b31517f..d17ea56 100644 --- a/lib/cobalt/clock.c +++ b/lib/cobalt/clock.c @@ -25,6 +25,7 @@ #include pthread.h #include unistd.h #include time.h +#include sys/time.h #include cobalt/uapi/time.h #include cobalt/ticks.h #include asm/xenomai/syscall.h @@ -356,4 +357,26 @@ COBALT_IMPL(unsigned int, sleep, (unsigned int seconds)) return 0; } +COBALT_IMPL(int, gettimeofday, (struct timeval *tv, struct timezone *tz)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, ts)); + if (ret == 0) { + tv-tv_sec = ts.tv_sec; + tv-tv_usec = ts.tv_nsec / 1000; + } + return ret; +} + +COBALT_IMPL(time_t, time, (time_t *t)) +{ + struct timespec ts; + int ret = __WRAP(clock_gettime(CLOCK_REALTIME, ts)); + if (ret) + return (time_t)-1; + + if (t) + *t = ts.tv_sec; + return ts.tv_sec; +} /** @} */ diff --git a/lib/cobalt/cobalt.wrappers b/lib/cobalt/cobalt.wrappers index 10cb36a..329ff3b 100644 --- a/lib/cobalt/cobalt.wrappers +++ b/lib/cobalt/cobalt.wrappers @@ -104,3 +104,4 @@ --wrap kill --wrap sleep --wrap mmap +--wrap time ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Gilles Chanteperdrix : cobalt/rtdm: add fcntl syscall
Module: xenomai-3 Branch: next Commit: 450290bb5c82f0007027776be9e9bd09136f41be URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=450290bb5c82f0007027776be9e9bd09136f41be Author: Gilles Chanteperdrix gilles.chanteperd...@xenomai.org Date: Sat Oct 25 21:11:16 2014 +0200 cobalt/rtdm: add fcntl syscall --- include/cobalt/fcntl.h|2 + include/cobalt/kernel/rtdm/fd.h |2 + include/cobalt/kernel/rtdm/rtdm.h |3 + include/cobalt/uapi/syscall.h | 133 +++-- kernel/cobalt/posix/io.c |6 ++ kernel/cobalt/posix/io.h |2 + kernel/cobalt/posix/syscall.c | 10 +-- kernel/cobalt/rtdm/fd.c | 42 +++- lib/cobalt/cobalt.wrappers|1 + lib/cobalt/rtdm.c | 18 + lib/cobalt/wrappers.c | 13 11 files changed, 159 insertions(+), 73 deletions(-) diff --git a/include/cobalt/fcntl.h b/include/cobalt/fcntl.h index ed96dd7..2a83a7a 100644 --- a/include/cobalt/fcntl.h +++ b/include/cobalt/fcntl.h @@ -29,6 +29,8 @@ extern C { COBALT_DECL(int, open(const char *path, int oflag, ...)); +COBALT_DECL(int, fcntl(int fd, int cmd, ...)); + #ifdef __cplusplus } #endif diff --git a/include/cobalt/kernel/rtdm/fd.h b/include/cobalt/kernel/rtdm/fd.h index ccf0332..5685b3a 100644 --- a/include/cobalt/kernel/rtdm/fd.h +++ b/include/cobalt/kernel/rtdm/fd.h @@ -353,6 +353,8 @@ void rtdm_fd_put(struct rtdm_fd *fd); void rtdm_fd_unlock(struct rtdm_fd *fd); +int rtdm_fd_fcntl(int ufd, int cmd, ...); + int rtdm_fd_ioctl(int ufd, unsigned int request, ...); ssize_t rtdm_fd_read(int ufd, void __user *buf, size_t size); diff --git a/include/cobalt/kernel/rtdm/rtdm.h b/include/cobalt/kernel/rtdm/rtdm.h index db1e270..2b1c8fd 100644 --- a/include/cobalt/kernel/rtdm/rtdm.h +++ b/include/cobalt/kernel/rtdm/rtdm.h @@ -50,6 +50,9 @@ int __rtdm_dev_socket(int protocol_family, #define rt_dev_close(fd) \ rtdm_fd_close(fd, RTDM_FD_MAGIC) +#define rt_dev_fcntl(fd, cmd, ...) \ + rtdm_fd_fcntl(fd,cmd, __VA_ARGS__) + #define rt_dev_ioctl(fd, request, ...) \ rtdm_fd_ioctl(fd, request, __VA_ARGS__) diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h index aa364a1..025d2ff 100644 --- a/include/cobalt/uapi/syscall.h +++ b/include/cobalt/uapi/syscall.h @@ -21,63 +21,63 @@ #include cobalt/uapi/asm-generic/syscall.h #define sc_cobalt_bind 0 -#define sc_cobalt_thread_create1 -#define sc_cobalt_thread_getpid2 -#define sc_cobalt_thread_setmode 3 -#define sc_cobalt_thread_setname 4 -#define sc_cobalt_thread_join 5 -#define sc_cobalt_thread_kill 6 +#define sc_cobalt_thread_create1 +#define sc_cobalt_thread_getpid2 +#define sc_cobalt_thread_setmode 3 +#define sc_cobalt_thread_setname 4 +#define sc_cobalt_thread_join 5 +#define sc_cobalt_thread_kill 6 #define sc_cobalt_thread_setschedparam_ex 7 #define sc_cobalt_thread_getschedparam_ex 8 -#define sc_cobalt_thread_getstat 9 +#define sc_cobalt_thread_getstat 9 /* 10 unimp */ -#define sc_cobalt_sem_init 11 -#define sc_cobalt_sem_destroy 12 -#define sc_cobalt_sem_post 13 -#define sc_cobalt_sem_wait 14 -#define sc_cobalt_sem_trywait 15 -#define sc_cobalt_sem_getvalue 16 -#define sc_cobalt_sem_open 17 -#define sc_cobalt_sem_close18 -#define sc_cobalt_sem_unlink 19 -#define sc_cobalt_sem_timedwait20 -#define sc_cobalt_sem_inquire 21 +#define sc_cobalt_sem_init 11 +#define sc_cobalt_sem_destroy 12 +#define sc_cobalt_sem_post 13 +#define sc_cobalt_sem_wait 14 +#define sc_cobalt_sem_trywait 15 +#define sc_cobalt_sem_getvalue 16 +#define sc_cobalt_sem_open 17 +#define sc_cobalt_sem_close18 +#define sc_cobalt_sem_unlink 19 +#define sc_cobalt_sem_timedwait20 +#define sc_cobalt_sem_inquire 21 /* 22 unimp */ -#define sc_cobalt_sem_broadcast_np 23 -#define sc_cobalt_clock_getres 24 -#define sc_cobalt_clock_gettime25 -#define sc_cobalt_clock_settime26 -#define sc_cobalt_clock_nanosleep 27 -#define sc_cobalt_mutex_init 28 -#define sc_cobalt_mutex_check_init 29 -#define sc_cobalt_mutex_destroy30 -#define sc_cobalt_mutex_lock
[Xenomai-git] Philippe Gerum : cobalt/x86: enable support for x32 ABI model
Module: xenomai-3 Branch: next Commit: 8876746e82af2d46af91eb93504f498b4d1f4b39 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8876746e82af2d46af91eb93504f498b4d1f4b39 Author: Philippe Gerum r...@xenomai.org Date: Wed Oct 29 15:41:33 2014 +0100 cobalt/x86: enable support for x32 ABI model --- .../arch/x86/include/asm/xenomai/syscall32-table.h | 16 + .../arch/x86/include/asm/xenomai/syscall32.h |7 +++- kernel/cobalt/posix/syscall32.c| 34 kernel/cobalt/posix/syscall32.h|6 4 files changed, 62 insertions(+), 1 deletion(-) diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h index 9f2f000..1dce4e7 100644 --- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h +++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32-table.h @@ -28,6 +28,7 @@ __COBALT_CALL32emu_THUNK(thread_create) __COBALT_CALL32emu_THUNK(thread_setschedparam_ex) __COBALT_CALL32emu_THUNK(thread_getschedparam_ex) __COBALT_CALL32emu_THUNK(sem_open) +__COBALT_CALL32x_THUNK(sem_open) __COBALT_CALL32emu_THUNK(sem_timedwait) __COBALT_CALL32emu_THUNK(clock_getres) __COBALT_CALL32emu_THUNK(clock_gettime) @@ -36,29 +37,44 @@ __COBALT_CALL32emu_THUNK(clock_nanosleep) __COBALT_CALL32emu_THUNK(mutex_timedlock) __COBALT_CALL32emu_THUNK(cond_wait_prologue) __COBALT_CALL32emu_THUNK(mq_open) +__COBALT_CALL32x_THUNK(mq_open) __COBALT_CALL32emu_THUNK(mq_getattr) +__COBALT_CALL32x_THUNK(mq_getattr) __COBALT_CALL32emu_THUNK(mq_timedsend) __COBALT_CALL32emu_THUNK(mq_timedreceive) +__COBALT_CALL32x_pure_THUNK(mq_timedreceive) __COBALT_CALL32emu_THUNK(mq_notify) +__COBALT_CALL32x_THUNK(mq_notify) __COBALT_CALL32emu_THUNK(sched_weightprio) __COBALT_CALL32emu_THUNK(sched_setconfig_np) __COBALT_CALL32emu_THUNK(sched_getconfig_np) __COBALT_CALL32emu_THUNK(timer_create) +__COBALT_CALL32x_THUNK(timer_create) __COBALT_CALL32emu_THUNK(timer_settime) __COBALT_CALL32emu_THUNK(timer_gettime) __COBALT_CALL32emu_THUNK(timerfd_settime) __COBALT_CALL32emu_THUNK(timerfd_gettime) __COBALT_CALL32emu_THUNK(sigwait) +__COBALT_CALL32x_THUNK(sigwait) __COBALT_CALL32emu_THUNK(sigtimedwait) +__COBALT_CALL32x_THUNK(sigtimedwait) __COBALT_CALL32emu_THUNK(sigwaitinfo) +__COBALT_CALL32x_THUNK(sigwaitinfo) __COBALT_CALL32emu_THUNK(sigpending) +__COBALT_CALL32x_THUNK(sigpending) __COBALT_CALL32emu_THUNK(sigqueue) +__COBALT_CALL32x_THUNK(sigqueue) __COBALT_CALL32emu_THUNK(monitor_wait) __COBALT_CALL32emu_THUNK(event_wait) __COBALT_CALL32emu_THUNK(select) +__COBALT_CALL32x_THUNK(select) __COBALT_CALL32emu_THUNK(recvmsg) +__COBALT_CALL32x_THUNK(recvmsg) __COBALT_CALL32emu_THUNK(sendmsg) +__COBALT_CALL32x_THUNK(sendmsg) __COBALT_CALL32emu_THUNK(mmap) +__COBALT_CALL32x_THUNK(mmap) __COBALT_CALL32emu_THUNK(backtrace) +__COBALT_CALL32x_THUNK(backtrace) #endif /* !_COBALT_X86_ASM_SYSCALL32_TABLE_H */ diff --git a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h index e4890a6..5604580 100644 --- a/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h +++ b/kernel/cobalt/arch/x86/include/asm/xenomai/syscall32.h @@ -55,9 +55,12 @@ , [sc_cobalt_ ## __name + __COBALT_X32_BASE] = __handler /* x32 thunk installation */ -#define __COBALT_CALL32x_THUNK(__name) \ +#define __COBALT_CALL32x_pure_THUNK(__name)\ __COBALT_CALL32x_ENTRY(__name, __syshand32x__(__name)) +#define __COBALT_CALL32x_THUNK(__name) \ + __COBALT_CALL32x_ENTRY(__name, __syshand32emu__(__name)) + /* x32 thunk implementation. */ #define COBALT_SYSCALL32x(__name, __mode, __type, __args) \ __typeof__(__type) cobalt32x_ ## __name __args @@ -80,6 +83,8 @@ #define __COBALT_CALL32x_ENTRY(__name, __handler) +#define __COBALT_CALL32x_pure_THUNK(__name) + #define __COBALT_CALL32x_THUNK(__name) #define COBALT_SYSCALL32x_DECL(__name, __type, __args) diff --git a/kernel/cobalt/posix/syscall32.c b/kernel/cobalt/posix/syscall32.c index 61c619f..17066bc 100644 --- a/kernel/cobalt/posix/syscall32.c +++ b/kernel/cobalt/posix/syscall32.c @@ -261,6 +261,14 @@ COBALT_SYSCALL32emu(mq_timedreceive, primary, return ret ?: __xn_safe_copy_to_user(u_len, clen, sizeof(*u_len)); } +static inline int mq_fetch_timeout(struct timespec *ts, + const void __user *u_ts) +{ + return u_ts == NULL ? -EFAULT : + __xn_safe_copy_from_user(ts, u_ts, sizeof(*ts)); + +} + COBALT_SYSCALL32emu(mq_notify, primary, int, (mqd_t fd, const struct compat_sigevent *__user u_cev)) { @@ -799,3 +807,29 @@ COBALT_SYSCALL32emu(backtrace, current, return 0; } + +#ifdef COBALT_SYSCALL32x + +COBALT_SYSCALL32x(mq_timedreceive, primary, + int, (mqd_t uqd, void __user *u_buf, + compat_ssize_t __user *u_len, +