[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2017-07-27 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: b353f5263a788704386abbff4dad5ff97c4e7e78
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=b353f5263a788704386abbff4dad5ff97c4e7e78

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 0aeff28..25d21ea 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2017-06-03 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 131699aac2efe3f147919033a9c405d6648e9074
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=131699aac2efe3f147919033a9c405d6648e9074

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 0aeff28..25d21ea 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2017-05-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 234d22265fb592c2fe05892d222631ce9a5b4352
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=234d22265fb592c2fe05892d222631ce9a5b4352

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 0aeff28..25d21ea 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2017-05-15 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 79870655d9be4cdefdc86be4026a7791bcef6f52
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=79870655d9be4cdefdc86be4026a7791bcef6f52

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 0aeff28..25d21ea 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2017-05-14 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 792d5370989d8214a2387c5346c4c916481fe5ff
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=792d5370989d8214a2387c5346c4c916481fe5ff

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 0aeff28..25d21ea 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2017-05-13 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: d8be8a603ad7eaffc91905c211f40e2a8a7e2169
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d8be8a603ad7eaffc91905c211f40e2a8a7e2169

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 0aeff28..25d21ea 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2017-04-17 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 05c08f55bd12141beaf149f2329afd6437c1fbdd
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=05c08f55bd12141beaf149f2329afd6437c1fbdd

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 0aeff28..25d21ea 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2017-03-15 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 5162199d4e80b7730e6aef412c4d87e3cd17124d
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5162199d4e80b7730e6aef412c4d87e3cd17124d

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 0aeff28..25d21ea 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2017-03-13 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 64dede0cecac64da6e85381898d2db72d2643464
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=64dede0cecac64da6e85381898d2db72d2643464

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 0aeff28..25d21ea 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2017-03-05 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 57e3cbd4f9eed09ce420692ccc2c23efe50aae86
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=57e3cbd4f9eed09ce420692ccc2c23efe50aae86

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 0aeff28..25d21ea 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2017-02-15 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: e533a7f0e4716dc2440f47a047668bb27b282797
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e533a7f0e4716dc2440f47a047668bb27b282797

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 0aeff28..25d21ea 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2017-01-26 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 931ba88ab98597f387f7c73d56ae1758d315a2a3
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=931ba88ab98597f387f7c73d56ae1758d315a2a3

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 0aeff28..25d21ea 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2016-12-09 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 5d70bda811d9da9d513d920490808cea142dec8b
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=5d70bda811d9da9d513d920490808cea142dec8b

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index b9efa05..6282cc4 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2016-11-28 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: ad1de75e73c95e2ab56a192ac449e82679c7ab36
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=ad1de75e73c95e2ab56a192ac449e82679c7ab36

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index b9efa05..6282cc4 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2016-11-21 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: f9f23a74c6ad1cf2895da1f106d2047e29d75d94
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f9f23a74c6ad1cf2895da1f106d2047e29d75d94

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index b9efa05..6282cc4 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2016-11-15 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: f4ad47a7e65fb383c1af090dadd460aae1bfc8d4
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f4ad47a7e65fb383c1af090dadd460aae1bfc8d4

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index b9efa05..6282cc4 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2016-10-17 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 74ffe0a81116ca48a78e39ff81bfca846bddeb35
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=74ffe0a81116ca48a78e39ff81bfca846bddeb35

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index b9efa05..6282cc4 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2016-09-29 Thread git repository hosting
Module: xenomai-3
Branch: wip/drivers
Commit: 62b824afef9bd3085bc37b0d7d7bc39e7788a2e8
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=62b824afef9bd3085bc37b0d7d7bc39e7788a2e8

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 include/cobalt/uapi/kernel/thread.h |1 +
 kernel/cobalt/posix/syscall.c   |   68 ---
 2 files changed, 40 insertions(+), 29 deletions(-)

diff --git a/include/cobalt/uapi/kernel/thread.h 
b/include/cobalt/uapi/kernel/thread.h
index 89853e8..100ccee 100644
--- a/include/cobalt/uapi/kernel/thread.h
+++ b/include/cobalt/uapi/kernel/thread.h
@@ -76,6 +76,7 @@
 
 #define XNMOVED   0x0001 /**< CPU migration in primary mode occurred */
 #define XNLBALERT 0x0002 /**< Scheduler lock break alert (SIGDEBUG sent) */
+#define XNDESCENT 0x0004 /**< Adaptive transitioning to secondary mode */
 
 /** @} */
 
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index f7cde92..857f4f7 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -70,8 +70,10 @@
 #define __xn_exec_downup(__xn_exec_lostage|__xn_exec_switchback)
 /* Shorthand for non-restartable primary syscall. */
 #define __xn_exec_nonrestartable (__xn_exec_primary|__xn_exec_norestart)
-/* Shorthand for domain probing syscall */
+/* Domain probing syscall starting in conforming mode. */
 #define __xn_exec_probing   (__xn_exec_conforming|__xn_exec_adaptive)
+/* Hand over mode selection to syscall.  */
+#define __xn_exec_handover  (__xn_exec_current|__xn_exec_adaptive)
 
 typedef long (*cobalt_syshand)(unsigned long arg1, unsigned long arg2,
   unsigned long arg3, unsigned long arg4,
@@ -473,7 +475,7 @@ static inline int allowed_syscall(struct cobalt_process 
*process,
if (process == NULL)
return 0;
 
-   if (thread == NULL && (sysflags & __xn_exec_shadow) != 0)
+   if (thread == NULL && (sysflags & __xn_exec_shadow))
return 0;
 
return cap_raised(current_cap(), CAP_SYS_NICE);
@@ -546,12 +548,13 @@ static int handle_head_syscall(struct ipipe_domain *ipd, 
struct pt_regs *regs)
 * o Whether the caller currently runs in the Linux or Xenomai
 * domain.
 */
-   switched = 0;
 restart:
/*
 * Process adaptive syscalls by restarting them in the
-* opposite domain.
+* opposite domain upon receiving -ENOSYS from the syscall
+* handler.
 */
+   switched = 0;
if (sysflags & __xn_exec_lostage) {
/*
 * The syscall must run from the Linux domain.
@@ -585,15 +588,22 @@ restart:
return KEVENT_PROPAGATE;
}
 
+   /*
+* 'thread' has to be valid from that point: all syscalls
+* regular threads may call have been pipelined to the root
+* handler (lostage ones), or rejected by allowed_syscall().
+*/
+
ret = handler(__xn_reg_arglist(regs));
-   if (ret == -ENOSYS && (sysflags & __xn_exec_adaptive) != 0) {
+   if (ret == -ENOSYS && (sysflags & __xn_exec_adaptive)) {
if (switched) {
-   switched = 0;
ret = xnthread_harden();
-   if (ret)
+   if (ret) {
+   switched = 0;
goto done;
-   }
-
+   }
+   } else /* Mark the primary -> secondary transition. */
+   xnthread_set_localinfo(thread, XNDESCENT);
sysflags ^=
(__xn_exec_lostage | __xn_exec_histage |
 __xn_exec_adaptive);
@@ -616,12 +626,14 @@ done:
xnthread_relax(0, 0);
}
}
-   if (!sigs && (sysflags & __xn_exec_switchback) != 0 && switched)
-   xnthread_harden(); /* -EPERM will be trapped later if needed. */
+   if (!sigs && (sysflags & __xn_exec_switchback) && switched)
+   /* -EPERM will be trapped later if needed. */
+   xnthread_harden();
 
 ret_handled:
/* Update the stats and userland-visible state. */
if (thread) {
+   xnthread_clear_localinfo(thread, XNDESCENT);
xnstat_counter_inc(&thread

[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2016-09-22 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: dcd288fb92031589ac8faebd10cd44cc393bded6
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=dcd288fb92031589ac8faebd10cd44cc393bded6

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 kernel/cobalt/posix/syscall.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index b9efa05..6282cc4 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -737,7 +737,6 @@ restart:
 * domain. This is a slow path, so proceed with any
 * pending schedparam update on the fly.
 */
-   switched = 0;
if (thread)
xnthread_propagate_schedparam(thread);
}


___
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git


[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2016-07-16 Thread git repository hosting
Module: xenomai-3
Branch: wip/dovetail
Commit: 79c3ba8f3432cf20f40741b2d3ace0a6180f94f8
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=79c3ba8f3432cf20f40741b2d3ace0a6180f94f8

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 include/cobalt/uapi/kernel/thread.h |1 +
 kernel/cobalt/posix/syscall.c   |   63 +--
 2 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/include/cobalt/uapi/kernel/thread.h 
b/include/cobalt/uapi/kernel/thread.h
index 8d26f16..e534471 100644
--- a/include/cobalt/uapi/kernel/thread.h
+++ b/include/cobalt/uapi/kernel/thread.h
@@ -77,6 +77,7 @@
 
 #define XNMOVED   0x0001 /**< CPU migration in primary mode occurred */
 #define XNLBALERT 0x0002 /**< Scheduler lock break alert (SIGDEBUG sent) */
+#define XNDESCENT 0x0004 /**< Adaptive transitioning to secondary mode */
 
 /** @} */
 
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 9893b30..6282cc4 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -70,8 +70,10 @@
 #define __xn_exec_downup(__xn_exec_lostage|__xn_exec_switchback)
 /* Shorthand for non-restartable primary syscall. */
 #define __xn_exec_nonrestartable (__xn_exec_primary|__xn_exec_norestart)
-/* Shorthand for domain probing syscall */
+/* Domain probing syscall starting in conforming mode. */
 #define __xn_exec_probing   (__xn_exec_conforming|__xn_exec_adaptive)
+/* Hand over mode selection to syscall.  */
+#define __xn_exec_handover  (__xn_exec_current|__xn_exec_adaptive)
 
 typedef long (*cobalt_syshand)(unsigned long arg1, unsigned long arg2,
   unsigned long arg3, unsigned long arg4,
@@ -477,7 +479,7 @@ static inline int allowed_syscall(struct cobalt_process 
*process,
if (process == NULL)
return 0;
 
-   if (thread == NULL && (sysflags & __xn_exec_shadow) != 0)
+   if (thread == NULL && (sysflags & __xn_exec_shadow))
return 0;
 
return cap_raised(current_cap(), CAP_SYS_NICE);
@@ -550,12 +552,13 @@ static int handle_head_syscall(struct ipipe_domain *ipd, 
struct pt_regs *regs)
 * o Whether the caller currently runs in the Linux or Xenomai
 * domain.
 */
-   switched = 0;
 restart:
/*
 * Process adaptive syscalls by restarting them in the
-* opposite domain.
+* opposite domain upon receiving -ENOSYS from the syscall
+* handler.
 */
+   switched = 0;
if (sysflags & __xn_exec_lostage) {
/*
 * The syscall must run from the Linux domain.
@@ -589,15 +592,22 @@ restart:
return KEVENT_PROPAGATE;
}
 
+   /*
+* 'thread' has to be valid from that point: all syscalls
+* regular threads may call have been pipelined to the root
+* handler (lostage ones), or rejected by allowed_syscall().
+*/
+
ret = handler(__xn_reg_arglist(regs));
-   if (ret == -ENOSYS && (sysflags & __xn_exec_adaptive) != 0) {
+   if (ret == -ENOSYS && (sysflags & __xn_exec_adaptive)) {
if (switched) {
-   switched = 0;
ret = xnthread_harden();
-   if (ret)
+   if (ret) {
+   switched = 0;
goto done;
-   }
-
+   }
+   } else /* Mark the primary -> secondary transition. */
+   xnthread_set_localinfo(thread, XNDESCENT);
sysflags ^=
(__xn_exec_lostage | __xn_exec_histage |
 __xn_exec_adaptive);
@@ -620,12 +630,14 @@ done:
xnthread_relax(0, 0);
}
}
-   if (!sigs && (sysflags & __xn_exec_switchback) != 0 && switched)
-   xnthread_harden(); /* -EPERM will be trapped later if needed. */
+   if (!sigs && (sysflags & __xn_exec_switchback) && switched)
+   /* -EPERM will be trapped later if needed. */
+   xnthread_harden();
 
 ret_handled:
/* Update the stats and userland-visible state. */
if (thread) {
+   xnthread_clear_localinfo(thread, XNDESCENT);
xnstat_counter_inc(&threa

[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2016-07-16 Thread git repository hosting
Module: xenomai-3
Branch: next
Commit: 79c3ba8f3432cf20f40741b2d3ace0a6180f94f8
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=79c3ba8f3432cf20f40741b2d3ace0a6180f94f8

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 include/cobalt/uapi/kernel/thread.h |1 +
 kernel/cobalt/posix/syscall.c   |   63 +--
 2 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/include/cobalt/uapi/kernel/thread.h 
b/include/cobalt/uapi/kernel/thread.h
index 8d26f16..e534471 100644
--- a/include/cobalt/uapi/kernel/thread.h
+++ b/include/cobalt/uapi/kernel/thread.h
@@ -77,6 +77,7 @@
 
 #define XNMOVED   0x0001 /**< CPU migration in primary mode occurred */
 #define XNLBALERT 0x0002 /**< Scheduler lock break alert (SIGDEBUG sent) */
+#define XNDESCENT 0x0004 /**< Adaptive transitioning to secondary mode */
 
 /** @} */
 
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 9893b30..6282cc4 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -70,8 +70,10 @@
 #define __xn_exec_downup(__xn_exec_lostage|__xn_exec_switchback)
 /* Shorthand for non-restartable primary syscall. */
 #define __xn_exec_nonrestartable (__xn_exec_primary|__xn_exec_norestart)
-/* Shorthand for domain probing syscall */
+/* Domain probing syscall starting in conforming mode. */
 #define __xn_exec_probing   (__xn_exec_conforming|__xn_exec_adaptive)
+/* Hand over mode selection to syscall.  */
+#define __xn_exec_handover  (__xn_exec_current|__xn_exec_adaptive)
 
 typedef long (*cobalt_syshand)(unsigned long arg1, unsigned long arg2,
   unsigned long arg3, unsigned long arg4,
@@ -477,7 +479,7 @@ static inline int allowed_syscall(struct cobalt_process 
*process,
if (process == NULL)
return 0;
 
-   if (thread == NULL && (sysflags & __xn_exec_shadow) != 0)
+   if (thread == NULL && (sysflags & __xn_exec_shadow))
return 0;
 
return cap_raised(current_cap(), CAP_SYS_NICE);
@@ -550,12 +552,13 @@ static int handle_head_syscall(struct ipipe_domain *ipd, 
struct pt_regs *regs)
 * o Whether the caller currently runs in the Linux or Xenomai
 * domain.
 */
-   switched = 0;
 restart:
/*
 * Process adaptive syscalls by restarting them in the
-* opposite domain.
+* opposite domain upon receiving -ENOSYS from the syscall
+* handler.
 */
+   switched = 0;
if (sysflags & __xn_exec_lostage) {
/*
 * The syscall must run from the Linux domain.
@@ -589,15 +592,22 @@ restart:
return KEVENT_PROPAGATE;
}
 
+   /*
+* 'thread' has to be valid from that point: all syscalls
+* regular threads may call have been pipelined to the root
+* handler (lostage ones), or rejected by allowed_syscall().
+*/
+
ret = handler(__xn_reg_arglist(regs));
-   if (ret == -ENOSYS && (sysflags & __xn_exec_adaptive) != 0) {
+   if (ret == -ENOSYS && (sysflags & __xn_exec_adaptive)) {
if (switched) {
-   switched = 0;
ret = xnthread_harden();
-   if (ret)
+   if (ret) {
+   switched = 0;
goto done;
-   }
-
+   }
+   } else /* Mark the primary -> secondary transition. */
+   xnthread_set_localinfo(thread, XNDESCENT);
sysflags ^=
(__xn_exec_lostage | __xn_exec_histage |
 __xn_exec_adaptive);
@@ -620,12 +630,14 @@ done:
xnthread_relax(0, 0);
}
}
-   if (!sigs && (sysflags & __xn_exec_switchback) != 0 && switched)
-   xnthread_harden(); /* -EPERM will be trapped later if needed. */
+   if (!sigs && (sysflags & __xn_exec_switchback) && switched)
+   /* -EPERM will be trapped later if needed. */
+   xnthread_harden();
 
 ret_handled:
/* Update the stats and userland-visible state. */
if (thread) {
+   xnthread_clear_localinfo(thread, XNDESCENT);
xnstat_counter_inc(&thread->stat.

[Xenomai-git] Philippe Gerum : cobalt/syscalls: allow for handing over mode selection to syscall handlers

2016-07-16 Thread git repository hosting
Module: xenomai-3
Branch: stable-3.0.x
Commit: 62b824afef9bd3085bc37b0d7d7bc39e7788a2e8
URL:
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=62b824afef9bd3085bc37b0d7d7bc39e7788a2e8

Author: Philippe Gerum 
Date:   Thu Jul  7 17:05:16 2016 +0200

cobalt/syscalls: allow for handing over mode selection to syscall handlers

Specific system calls may benefit from dealing with the caller's
runtime mode by themselves, depending on internal information which
the generic syscall dispatcher does not have access to.

To this end, a new syscall mode called "handover" is
introduced. Syscalls bearing this mode bit are always entered from the
current calling domain. The syscall handler may return -ENOSYS to
trigger a switch to the converse domain until all domains have been
visited once, at which point the syscall fails with -ENOSYS
automatically.

---

 include/cobalt/uapi/kernel/thread.h |1 +
 kernel/cobalt/posix/syscall.c   |   68 ---
 2 files changed, 40 insertions(+), 29 deletions(-)

diff --git a/include/cobalt/uapi/kernel/thread.h 
b/include/cobalt/uapi/kernel/thread.h
index 89853e8..100ccee 100644
--- a/include/cobalt/uapi/kernel/thread.h
+++ b/include/cobalt/uapi/kernel/thread.h
@@ -76,6 +76,7 @@
 
 #define XNMOVED   0x0001 /**< CPU migration in primary mode occurred */
 #define XNLBALERT 0x0002 /**< Scheduler lock break alert (SIGDEBUG sent) */
+#define XNDESCENT 0x0004 /**< Adaptive transitioning to secondary mode */
 
 /** @} */
 
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index f7cde92..857f4f7 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -70,8 +70,10 @@
 #define __xn_exec_downup(__xn_exec_lostage|__xn_exec_switchback)
 /* Shorthand for non-restartable primary syscall. */
 #define __xn_exec_nonrestartable (__xn_exec_primary|__xn_exec_norestart)
-/* Shorthand for domain probing syscall */
+/* Domain probing syscall starting in conforming mode. */
 #define __xn_exec_probing   (__xn_exec_conforming|__xn_exec_adaptive)
+/* Hand over mode selection to syscall.  */
+#define __xn_exec_handover  (__xn_exec_current|__xn_exec_adaptive)
 
 typedef long (*cobalt_syshand)(unsigned long arg1, unsigned long arg2,
   unsigned long arg3, unsigned long arg4,
@@ -473,7 +475,7 @@ static inline int allowed_syscall(struct cobalt_process 
*process,
if (process == NULL)
return 0;
 
-   if (thread == NULL && (sysflags & __xn_exec_shadow) != 0)
+   if (thread == NULL && (sysflags & __xn_exec_shadow))
return 0;
 
return cap_raised(current_cap(), CAP_SYS_NICE);
@@ -546,12 +548,13 @@ static int handle_head_syscall(struct ipipe_domain *ipd, 
struct pt_regs *regs)
 * o Whether the caller currently runs in the Linux or Xenomai
 * domain.
 */
-   switched = 0;
 restart:
/*
 * Process adaptive syscalls by restarting them in the
-* opposite domain.
+* opposite domain upon receiving -ENOSYS from the syscall
+* handler.
 */
+   switched = 0;
if (sysflags & __xn_exec_lostage) {
/*
 * The syscall must run from the Linux domain.
@@ -585,15 +588,22 @@ restart:
return KEVENT_PROPAGATE;
}
 
+   /*
+* 'thread' has to be valid from that point: all syscalls
+* regular threads may call have been pipelined to the root
+* handler (lostage ones), or rejected by allowed_syscall().
+*/
+
ret = handler(__xn_reg_arglist(regs));
-   if (ret == -ENOSYS && (sysflags & __xn_exec_adaptive) != 0) {
+   if (ret == -ENOSYS && (sysflags & __xn_exec_adaptive)) {
if (switched) {
-   switched = 0;
ret = xnthread_harden();
-   if (ret)
+   if (ret) {
+   switched = 0;
goto done;
-   }
-
+   }
+   } else /* Mark the primary -> secondary transition. */
+   xnthread_set_localinfo(thread, XNDESCENT);
sysflags ^=
(__xn_exec_lostage | __xn_exec_histage |
 __xn_exec_adaptive);
@@ -616,12 +626,14 @@ done:
xnthread_relax(0, 0);
}
}
-   if (!sigs && (sysflags & __xn_exec_switchback) != 0 && switched)
-   xnthread_harden(); /* -EPERM will be trapped later if needed. */
+   if (!sigs && (sysflags & __xn_exec_switchback) && switched)
+   /* -EPERM will be trapped later if needed. */
+   xnthread_harden();
 
 ret_handled:
/* Update the stats and userland-visible state. */
if (thread) {
+   xnthread_clear_localinfo(thread, XNDESCENT);
xnstat_counter_inc(&threa