userret.h revision 1.1
11.1Sfvdl/* $NetBSD: userret.h,v 1.1 2003/04/26 18:39:49 fvdl Exp $ */ 21.1Sfvdl 31.1Sfvdl/* 41.1Sfvdl * XXXfvdl same as i386 counterpart, but should probably be independent. 51.1Sfvdl */ 61.1Sfvdl 71.1Sfvdl/*- 81.1Sfvdl * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. 91.1Sfvdl * All rights reserved. 101.1Sfvdl * 111.1Sfvdl * This code is derived from software contributed to The NetBSD Foundation 121.1Sfvdl * by Charles M. Hannum. 131.1Sfvdl * 141.1Sfvdl * Redistribution and use in source and binary forms, with or without 151.1Sfvdl * modification, are permitted provided that the following conditions 161.1Sfvdl * are met: 171.1Sfvdl * 1. Redistributions of source code must retain the above copyright 181.1Sfvdl * notice, this list of conditions and the following disclaimer. 191.1Sfvdl * 2. Redistributions in binary form must reproduce the above copyright 201.1Sfvdl * notice, this list of conditions and the following disclaimer in the 211.1Sfvdl * documentation and/or other materials provided with the distribution. 221.1Sfvdl * 3. All advertising materials mentioning features or use of this software 231.1Sfvdl * must display the following acknowledgement: 241.1Sfvdl * This product includes software developed by the NetBSD 251.1Sfvdl * Foundation, Inc. and its contributors. 261.1Sfvdl * 4. Neither the name of The NetBSD Foundation nor the names of its 271.1Sfvdl * contributors may be used to endorse or promote products derived 281.1Sfvdl * from this software without specific prior written permission. 291.1Sfvdl * 301.1Sfvdl * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 311.1Sfvdl * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 321.1Sfvdl * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 331.1Sfvdl * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 341.1Sfvdl * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 351.1Sfvdl * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 361.1Sfvdl * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 371.1Sfvdl * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 381.1Sfvdl * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 391.1Sfvdl * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 401.1Sfvdl * POSSIBILITY OF SUCH DAMAGE. 411.1Sfvdl */ 421.1Sfvdl 431.1Sfvdl/*- 441.1Sfvdl * Copyright (c) 1990 The Regents of the University of California. 451.1Sfvdl * All rights reserved. 461.1Sfvdl * 471.1Sfvdl * This code is derived from software contributed to Berkeley by 481.1Sfvdl * William Jolitz. 491.1Sfvdl * 501.1Sfvdl * Redistribution and use in source and binary forms, with or without 511.1Sfvdl * modification, are permitted provided that the following conditions 521.1Sfvdl * are met: 531.1Sfvdl * 1. Redistributions of source code must retain the above copyright 541.1Sfvdl * notice, this list of conditions and the following disclaimer. 551.1Sfvdl * 2. Redistributions in binary form must reproduce the above copyright 561.1Sfvdl * notice, this list of conditions and the following disclaimer in the 571.1Sfvdl * documentation and/or other materials provided with the distribution. 581.1Sfvdl * 3. All advertising materials mentioning features or use of this software 591.1Sfvdl * must display the following acknowledgement: 601.1Sfvdl * This product includes software developed by the University of 611.1Sfvdl * California, Berkeley and its contributors. 621.1Sfvdl * 4. Neither the name of the University nor the names of its contributors 631.1Sfvdl * may be used to endorse or promote products derived from this software 641.1Sfvdl * without specific prior written permission. 651.1Sfvdl * 661.1Sfvdl * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 671.1Sfvdl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 681.1Sfvdl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 691.1Sfvdl * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 701.1Sfvdl * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 711.1Sfvdl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 721.1Sfvdl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 731.1Sfvdl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 741.1Sfvdl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 751.1Sfvdl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 761.1Sfvdl * SUCH DAMAGE. 771.1Sfvdl * 781.1Sfvdl */ 791.1Sfvdl 801.1Sfvdlstatic __inline void userret __P((register struct lwp *)); 811.1Sfvdl 821.1Sfvdl/* 831.1Sfvdl * Define the code needed before returning to user mode, for 841.1Sfvdl * trap and syscall. 851.1Sfvdl */ 861.1Sfvdlstatic __inline void 871.1Sfvdluserret(l) 881.1Sfvdl register struct lwp *l; 891.1Sfvdl{ 901.1Sfvdl int sig; 911.1Sfvdl struct proc *p = l->l_proc; 921.1Sfvdl 931.1Sfvdl while ((sig = CURSIG(l)) != 0) 941.1Sfvdl postsig(sig); 951.1Sfvdl 961.1Sfvdl if (p->p_userret) 971.1Sfvdl (p->p_userret)(l, p->p_userret_arg); 981.1Sfvdl 991.1Sfvdl while (l->l_flag & L_SA_UPCALL) 1001.1Sfvdl sa_upcall_userret(l); 1011.1Sfvdl 1021.1Sfvdl curcpu()->ci_schedstate.spc_curpriority = l->l_priority = l->l_usrpri; 1031.1Sfvdl} 104