xref: /netbsd-src/share/man/man9/userret.9 (revision 11a6dbe72840351315e0652b2fc6663628c84cad)
1*11a6dbe7Smartin.\"     $NetBSD: userret.9,v 1.9 2008/04/30 13:10:59 martin Exp $
2f84fa2a2Sgmcgarry.\"
3f84fa2a2Sgmcgarry.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
4f84fa2a2Sgmcgarry.\" All rights reserved.
5f84fa2a2Sgmcgarry.\"
6f84fa2a2Sgmcgarry.\" This code is derived from software contributed to The NetBSD Foundation
7f84fa2a2Sgmcgarry.\" by Gregory McGarry.
8f84fa2a2Sgmcgarry.\"
9f84fa2a2Sgmcgarry.\" Redistribution and use in source and binary forms, with or without
10f84fa2a2Sgmcgarry.\" modification, are permitted provided that the following conditions
11f84fa2a2Sgmcgarry.\" are met:
12f84fa2a2Sgmcgarry.\" 1. Redistributions of source code must retain the above copyright
13f84fa2a2Sgmcgarry.\"    notice, this list of conditions and the following disclaimer.
14f84fa2a2Sgmcgarry.\" 2. Redistributions in binary form must reproduce the above copyright
15f84fa2a2Sgmcgarry.\"    notice, this list of conditions and the following disclaimer in the
16f84fa2a2Sgmcgarry.\"    documentation and/or other materials provided with the distribution.
17f84fa2a2Sgmcgarry.\"
18f84fa2a2Sgmcgarry.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19f84fa2a2Sgmcgarry.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20f84fa2a2Sgmcgarry.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21f84fa2a2Sgmcgarry.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22f84fa2a2Sgmcgarry.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23f84fa2a2Sgmcgarry.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24f84fa2a2Sgmcgarry.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25f84fa2a2Sgmcgarry.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26f84fa2a2Sgmcgarry.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27f84fa2a2Sgmcgarry.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28f84fa2a2Sgmcgarry.\" POSSIBILITY OF SUCH DAMAGE.
29f84fa2a2Sgmcgarry.\"
307d7fe4b7Srpaulo.Dd December 20, 2005
31f84fa2a2Sgmcgarry.Dt USERRET 9
32f84fa2a2Sgmcgarry.Os
33f84fa2a2Sgmcgarry.Sh NAME
34f84fa2a2Sgmcgarry.Nm userret
35f84fa2a2Sgmcgarry.Nd return path to user-mode execution
36f84fa2a2Sgmcgarry.Sh SYNOPSIS
377d7fe4b7Srpaulo.In sys/lwp.h
38472351e1Swiz.In sys/sched.h
39f84fa2a2Sgmcgarry.Ft void
407d7fe4b7Srpaulo.Fn userret "struct lwp *l"
41f84fa2a2Sgmcgarry.Sh DESCRIPTION
42f84fa2a2SgmcgarryThe
43f84fa2a2Sgmcgarry.Fn userret
44f84fa2a2Sgmcgarryfunction is executed after processing a trap
4584ce8e96Swiz.Pq e.g., a system call or interrupt
4684ce8e96Swizbefore returning to user-mode execution.
4784ce8e96SwizThe implementation is machine dependent and is never invoked from
4884ce8e96Swizmachine-independent code.
49f84fa2a2SgmcgarryThe function prototype for each architecture may be different to the
50f84fa2a2Sgmcgarryprototype above, however the functionally provided by the
51f84fa2a2Sgmcgarry.Fn userret
52f84fa2a2Sgmcgarryfunction on each architecture is essentially the same.
53f84fa2a2Sgmcgarry.Pp
54f84fa2a2SgmcgarrySpecifically, the
55f84fa2a2Sgmcgarry.Fn userret
56f84fa2a2Sgmcgarryfunction performs the following procedure:
57537ec576Swiz.Bl -bullet -offset indent
58f84fa2a2Sgmcgarry.It
5984ce8e96SwizDetect a change in the signal disposition of the current process and invoke
6084ce8e96Swiz.Xr postsig 9
6184ce8e96Swizto post the signal to the process.
6284ce8e96SwizThis may occur when the outcome of the trap or syscall posted a signal
6384ce8e96Swizto the process
64334bfb30Swiz.Pq e.g., invalid instruction trap .
65f84fa2a2Sgmcgarry.It
66f84fa2a2SgmcgarryCheck the
67f84fa2a2Sgmcgarry.Va want_resched
68f84fa2a2Sgmcgarryflag to see if the scheduler requires the current process to be
69f84fa2a2Sgmcgarrypreempted by invoking
70f84fa2a2Sgmcgarry.Xr preempt 9
71443a5d82Syamt.Pq see Xr cpu_need_resched 9 .
72f84fa2a2SgmcgarryThis may occur if the clock interrupt causes the scheduler to
73f84fa2a2Sgmcgarrydetermine that the current process has completed its time slice.
74f84fa2a2Sgmcgarry.It
75f84fa2a2SgmcgarryUpdate the scheduler state.
76f84fa2a2Sgmcgarry.El
77f84fa2a2Sgmcgarry.Sh SEE ALSO
78443a5d82Syamt.Xr cpu_need_resched 9 ,
79f84fa2a2Sgmcgarry.Xr postsig 9 ,
80f84fa2a2Sgmcgarry.Xr preempt 9 ,
81f84fa2a2Sgmcgarry.Xr scheduler 9
82