[Xenomai-git] Gilles Chanteperdrix : nucleus: allocate u_mode in process private heap
Module: xenomai-gch Branch: u_mode Commit: 95e5b6d403feacae87ae313dc2e102d51bb767c4 URL: http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=95e5b6d403feacae87ae313dc2e102d51bb767c4 Author: Gilles Chanteperdrix Date: Sat Jun 18 19:05:51 2011 +0200 nucleus: allocate u_mode in process private heap --- include/asm-generic/bits/current.h | 23 + include/asm-generic/syscall.h |3 +- include/nucleus/shadow.h |2 +- include/nucleus/thread.h |2 +- include/nucleus/vdso.h |7 +-- ksrc/nucleus/shadow.c | 74 ++--- ksrc/skins/native/syscall.c|2 +- ksrc/skins/posix/syscall.c | 20 ksrc/skins/psos+/syscall.c |2 +- ksrc/skins/uitron/syscall.c|7 ++- ksrc/skins/vrtx/syscall.c |2 +- ksrc/skins/vxworks/syscall.c |2 +- src/skins/common/current.c | 92 +++- src/skins/common/sem_heap.c|2 - src/skins/native/task.c| 13 ++--- src/skins/posix/thread.c | 62 ++-- src/skins/psos+/task.c | 11 +++- src/skins/uitron/task.c| 11 +--- src/skins/vrtx/task.c |4 +- src/skins/vxworks/taskLib.c|4 +- 20 files changed, 117 insertions(+), 228 deletions(-) diff --git a/include/asm-generic/bits/current.h b/include/asm-generic/bits/current.h index 79123e8..0574c55 100644 --- a/include/asm-generic/bits/current.h +++ b/include/asm-generic/bits/current.h @@ -11,9 +11,10 @@ unsigned long xeno_slow_get_current_mode(void); void xeno_current_warn_old(void); #ifdef HAVE___THREAD -extern __thread xnhandle_t xeno_current __attribute__ ((tls_model ("initial-exec"))); -extern __thread unsigned long -xeno_current_mode __attribute__ ((tls_model ("initial-exec"))); +extern __thread __attribute__ ((tls_model ("initial-exec"))) +xnhandle_t xeno_current; +extern __thread __attribute__ ((tls_model ("initial-exec"))) +unsigned long *xeno_current_mode; static inline xnhandle_t xeno_get_current(void) { @@ -24,9 +25,7 @@ static inline xnhandle_t xeno_get_current(void) static inline unsigned long xeno_get_current_mode(void) { - unsigned long mode = xeno_current_mode; - - return mode == -1 ? xeno_slow_get_current_mode() : mode; + return *xeno_current_mode; } #else /* ! HAVE___THREAD */ @@ -53,17 +52,19 @@ static inline xnhandle_t xeno_get_current_fast(void) static inline unsigned long xeno_get_current_mode(void) { - unsigned long *mode = pthread_getspecific(xeno_current_mode_key); + unsigned long *mode; + + mode = pthread_getspecific(xeno_current_mode_key); - return mode ? (*mode) : xeno_slow_get_current_mode(); + return *mode; } #endif /* ! HAVE___THREAD */ -void xeno_set_current(void); +void xeno_init_current_keys(void); -unsigned long *xeno_init_current_mode(void); +void xeno_set_current(void); -void xeno_init_current_keys(void); +void xeno_set_current_mode(unsigned long offset); #endif /* _XENO_ASM_GENERIC_CURRENT_H */ diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h index 89d148e..4154b46 100644 --- a/include/asm-generic/syscall.h +++ b/include/asm-generic/syscall.h @@ -35,8 +35,7 @@ #define __xn_sys_sem_heap 7 #define __xn_sys_current 8 /* threadh = xnthread_handle(cur) */ #define __xn_sys_current_info 9 /* r = xnshadow_current_info(&info) */ -#define __xn_sys_drop_u_mode 10 /* stop updating thread->u_mode */ -#define __xn_sys_mayday11 /* request mayday fixup */ +#define __xn_sys_mayday10 /* request mayday fixup */ #define XENOMAI_LINUX_DOMAIN 0 #define XENOMAI_XENO_DOMAIN 1 diff --git a/include/nucleus/shadow.h b/include/nucleus/shadow.h index ad93058..9c8784c 100644 --- a/include/nucleus/shadow.h +++ b/include/nucleus/shadow.h @@ -63,7 +63,7 @@ void xnshadow_release_events(void); int xnshadow_map(struct xnthread *thread, xncompletion_t __user *u_completion, -unsigned long __user *u_mode); +unsigned long __user *u_mode_offset); void xnshadow_unmap(struct xnthread *thread); diff --git a/include/nucleus/thread.h b/include/nucleus/thread.h index 853a305..d5dc531 100644 --- a/include/nucleus/thread.h +++ b/include/nucleus/thread.h @@ -329,7 +329,7 @@ typedef struct xnthread { void *cookie; /* Cookie to pass to the entry routine */ #ifdef CONFIG_XENO_OPT_PERVASIVE - unsigned long __user *u_mode; /* Thread mode variable in userland. */ + unsigned long *u_mode; /* Thread mode variable shared with userland. */ #endif /* CONFIG_XENO_OPT_PERVASIVE */ XNARCH_DECL_DISPLAY_CONTEXT(); diff --git a/include/nucleus/vdso.h b/include/nucleus/vdso.h index 279574b..42d2263 100644 --- a/include/nucleus/vdso.h +++ b/include/nucleus/vdso.h @@ -51,12 +51,11 @@ s
[Xenomai-git] Gilles Chanteperdrix : nucleus: allocate u_mode in process private heap
Module: xenomai-gch Branch: u_mode Commit: 0d3a0ab7574ed337bf551cdca678d899747c4479 URL: http://git.xenomai.org/?p=xenomai-gch.git;a=commit;h=0d3a0ab7574ed337bf551cdca678d899747c4479 Author: Gilles Chanteperdrix Date: Sat Jun 18 19:05:51 2011 +0200 nucleus: allocate u_mode in process private heap --- include/asm-generic/bits/current.h | 23 + include/asm-generic/syscall.h |3 +- include/nucleus/shadow.h |2 +- include/nucleus/thread.h |2 +- include/nucleus/vdso.h |7 +-- ksrc/nucleus/shadow.c | 74 ++--- ksrc/skins/native/syscall.c|2 +- ksrc/skins/posix/syscall.c | 20 ksrc/skins/psos+/syscall.c |2 +- ksrc/skins/uitron/syscall.c|7 ++- ksrc/skins/vrtx/syscall.c |2 +- ksrc/skins/vxworks/syscall.c |2 +- src/skins/common/current.c | 92 +++- src/skins/common/sem_heap.c|2 - src/skins/native/task.c| 13 ++--- src/skins/posix/thread.c | 62 ++-- src/skins/psos+/task.c | 11 +++- src/skins/uitron/task.c| 11 +--- src/skins/vrtx/task.c |4 +- src/skins/vxworks/taskLib.c|4 +- 20 files changed, 117 insertions(+), 228 deletions(-) diff --git a/include/asm-generic/bits/current.h b/include/asm-generic/bits/current.h index 79123e8..2f04c3e 100644 --- a/include/asm-generic/bits/current.h +++ b/include/asm-generic/bits/current.h @@ -11,9 +11,10 @@ unsigned long xeno_slow_get_current_mode(void); void xeno_current_warn_old(void); #ifdef HAVE___THREAD -extern __thread xnhandle_t xeno_current __attribute__ ((tls_model ("initial-exec"))); -extern __thread unsigned long -xeno_current_mode __attribute__ ((tls_model ("initial-exec"))); +extern __thread __attribute__ ((tls_model ("initial-exec"))) +xnhandle_t xeno_current; +extern __thread __attribute__ ((tls_model ("initial-exec"))) +unsigned long *xeno_current_mode; static inline xnhandle_t xeno_get_current(void) { @@ -24,9 +25,7 @@ static inline xnhandle_t xeno_get_current(void) static inline unsigned long xeno_get_current_mode(void) { - unsigned long mode = xeno_current_mode; - - return mode == -1 ? xeno_slow_get_current_mode() : mode; + return xeno_current_mode ? *xeno_current_mode : XNRELAX; } #else /* ! HAVE___THREAD */ @@ -53,17 +52,19 @@ static inline xnhandle_t xeno_get_current_fast(void) static inline unsigned long xeno_get_current_mode(void) { - unsigned long *mode = pthread_getspecific(xeno_current_mode_key); + unsigned long *mode; + + mode = pthread_getspecific(xeno_current_mode_key); - return mode ? (*mode) : xeno_slow_get_current_mode(); + return mode ? *mode : XNRELAX; } #endif /* ! HAVE___THREAD */ -void xeno_set_current(void); +void xeno_init_current_keys(void); -unsigned long *xeno_init_current_mode(void); +void xeno_set_current(void); -void xeno_init_current_keys(void); +void xeno_set_current_mode(unsigned long offset); #endif /* _XENO_ASM_GENERIC_CURRENT_H */ diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h index 89d148e..4154b46 100644 --- a/include/asm-generic/syscall.h +++ b/include/asm-generic/syscall.h @@ -35,8 +35,7 @@ #define __xn_sys_sem_heap 7 #define __xn_sys_current 8 /* threadh = xnthread_handle(cur) */ #define __xn_sys_current_info 9 /* r = xnshadow_current_info(&info) */ -#define __xn_sys_drop_u_mode 10 /* stop updating thread->u_mode */ -#define __xn_sys_mayday11 /* request mayday fixup */ +#define __xn_sys_mayday10 /* request mayday fixup */ #define XENOMAI_LINUX_DOMAIN 0 #define XENOMAI_XENO_DOMAIN 1 diff --git a/include/nucleus/shadow.h b/include/nucleus/shadow.h index ad93058..9c8784c 100644 --- a/include/nucleus/shadow.h +++ b/include/nucleus/shadow.h @@ -63,7 +63,7 @@ void xnshadow_release_events(void); int xnshadow_map(struct xnthread *thread, xncompletion_t __user *u_completion, -unsigned long __user *u_mode); +unsigned long __user *u_mode_offset); void xnshadow_unmap(struct xnthread *thread); diff --git a/include/nucleus/thread.h b/include/nucleus/thread.h index 853a305..d5dc531 100644 --- a/include/nucleus/thread.h +++ b/include/nucleus/thread.h @@ -329,7 +329,7 @@ typedef struct xnthread { void *cookie; /* Cookie to pass to the entry routine */ #ifdef CONFIG_XENO_OPT_PERVASIVE - unsigned long __user *u_mode; /* Thread mode variable in userland. */ + unsigned long *u_mode; /* Thread mode variable shared with userland. */ #endif /* CONFIG_XENO_OPT_PERVASIVE */ XNARCH_DECL_DISPLAY_CONTEXT(); diff --git a/include/nucleus/vdso.h b/include/nucleus/vdso.h index 279574b..42d2263 100644 --- a/include/nucleus/vdso.h +++
[Xenomai-git] Gilles Chanteperdrix : nucleus: allocate u_mode in process private heap
Module: xenomai-head Branch: master Commit: e5d539dc5bd3dc1d4a872624b1a2df1d0f35f0dd URL: http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=e5d539dc5bd3dc1d4a872624b1a2df1d0f35f0dd Author: Gilles Chanteperdrix Date: Sat Jun 18 19:05:51 2011 +0200 nucleus: allocate u_mode in process private heap --- include/asm-generic/bits/current.h | 23 + include/asm-generic/syscall.h |3 +- include/nucleus/shadow.h |2 +- include/nucleus/thread.h |2 +- include/nucleus/vdso.h |7 +-- ksrc/nucleus/shadow.c | 74 ++--- ksrc/skins/native/syscall.c|2 +- ksrc/skins/posix/syscall.c | 20 ksrc/skins/psos+/syscall.c |2 +- ksrc/skins/uitron/syscall.c|7 ++- ksrc/skins/vrtx/syscall.c |2 +- ksrc/skins/vxworks/syscall.c |2 +- src/skins/common/current.c | 92 +++- src/skins/common/sem_heap.c|2 - src/skins/native/task.c| 13 ++--- src/skins/posix/thread.c | 62 ++-- src/skins/psos+/task.c | 11 +++- src/skins/uitron/task.c| 11 +--- src/skins/vrtx/task.c |4 +- src/skins/vxworks/taskLib.c|4 +- 20 files changed, 117 insertions(+), 228 deletions(-) diff --git a/include/asm-generic/bits/current.h b/include/asm-generic/bits/current.h index 79123e8..2f04c3e 100644 --- a/include/asm-generic/bits/current.h +++ b/include/asm-generic/bits/current.h @@ -11,9 +11,10 @@ unsigned long xeno_slow_get_current_mode(void); void xeno_current_warn_old(void); #ifdef HAVE___THREAD -extern __thread xnhandle_t xeno_current __attribute__ ((tls_model ("initial-exec"))); -extern __thread unsigned long -xeno_current_mode __attribute__ ((tls_model ("initial-exec"))); +extern __thread __attribute__ ((tls_model ("initial-exec"))) +xnhandle_t xeno_current; +extern __thread __attribute__ ((tls_model ("initial-exec"))) +unsigned long *xeno_current_mode; static inline xnhandle_t xeno_get_current(void) { @@ -24,9 +25,7 @@ static inline xnhandle_t xeno_get_current(void) static inline unsigned long xeno_get_current_mode(void) { - unsigned long mode = xeno_current_mode; - - return mode == -1 ? xeno_slow_get_current_mode() : mode; + return xeno_current_mode ? *xeno_current_mode : XNRELAX; } #else /* ! HAVE___THREAD */ @@ -53,17 +52,19 @@ static inline xnhandle_t xeno_get_current_fast(void) static inline unsigned long xeno_get_current_mode(void) { - unsigned long *mode = pthread_getspecific(xeno_current_mode_key); + unsigned long *mode; + + mode = pthread_getspecific(xeno_current_mode_key); - return mode ? (*mode) : xeno_slow_get_current_mode(); + return mode ? *mode : XNRELAX; } #endif /* ! HAVE___THREAD */ -void xeno_set_current(void); +void xeno_init_current_keys(void); -unsigned long *xeno_init_current_mode(void); +void xeno_set_current(void); -void xeno_init_current_keys(void); +void xeno_set_current_mode(unsigned long offset); #endif /* _XENO_ASM_GENERIC_CURRENT_H */ diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h index 89d148e..4154b46 100644 --- a/include/asm-generic/syscall.h +++ b/include/asm-generic/syscall.h @@ -35,8 +35,7 @@ #define __xn_sys_sem_heap 7 #define __xn_sys_current 8 /* threadh = xnthread_handle(cur) */ #define __xn_sys_current_info 9 /* r = xnshadow_current_info(&info) */ -#define __xn_sys_drop_u_mode 10 /* stop updating thread->u_mode */ -#define __xn_sys_mayday11 /* request mayday fixup */ +#define __xn_sys_mayday10 /* request mayday fixup */ #define XENOMAI_LINUX_DOMAIN 0 #define XENOMAI_XENO_DOMAIN 1 diff --git a/include/nucleus/shadow.h b/include/nucleus/shadow.h index ad93058..9c8784c 100644 --- a/include/nucleus/shadow.h +++ b/include/nucleus/shadow.h @@ -63,7 +63,7 @@ void xnshadow_release_events(void); int xnshadow_map(struct xnthread *thread, xncompletion_t __user *u_completion, -unsigned long __user *u_mode); +unsigned long __user *u_mode_offset); void xnshadow_unmap(struct xnthread *thread); diff --git a/include/nucleus/thread.h b/include/nucleus/thread.h index 853a305..d5dc531 100644 --- a/include/nucleus/thread.h +++ b/include/nucleus/thread.h @@ -329,7 +329,7 @@ typedef struct xnthread { void *cookie; /* Cookie to pass to the entry routine */ #ifdef CONFIG_XENO_OPT_PERVASIVE - unsigned long __user *u_mode; /* Thread mode variable in userland. */ + unsigned long *u_mode; /* Thread mode variable shared with userland. */ #endif /* CONFIG_XENO_OPT_PERVASIVE */ XNARCH_DECL_DISPLAY_CONTEXT(); diff --git a/include/nucleus/vdso.h b/include/nucleus/vdso.h index 279574b..42d2263 100644 --- a/include/nucleus/vdso.h +