[BACK]Return to proc_subr.s CVS log [TXT][DIR] Up to [local] / sys / arch / m68k / m68k

Annotation of sys/arch/m68k/m68k/proc_subr.s, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: proc_subr.s,v 1.2 2003/06/02 23:27:48 millert Exp $   */
                      2: /*     $NetBSD: proc_subr.s,v 1.2 1997/04/25 02:22:01 thorpej Exp $    */
                      3:
                      4: /*
                      5:  * Copyright (c) 1988 University of Utah.
                      6:  * Copyright (c) 1980, 1990, 1993
                      7:  *     The Regents of the University of California.  All rights reserved.
                      8:  *
                      9:  * This code is derived from software contributed to Berkeley by
                     10:  * the Systems Programming Group of the University of Utah Computer
                     11:  * Science Department.
                     12:  *
                     13:  * Redistribution and use in source and binary forms, with or without
                     14:  * modification, are permitted provided that the following conditions
                     15:  * are met:
                     16:  * 1. Redistributions of source code must retain the above copyright
                     17:  *    notice, this list of conditions and the following disclaimer.
                     18:  * 2. Redistributions in binary form must reproduce the above copyright
                     19:  *    notice, this list of conditions and the following disclaimer in the
                     20:  *    documentation and/or other materials provided with the distribution.
                     21:  * 3. Neither the name of the University nor the names of its contributors
                     22:  *    may be used to endorse or promote products derived from this software
                     23:  *    without specific prior written permission.
                     24:  *
                     25:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     26:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     27:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     28:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     29:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     30:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     31:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     32:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     33:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     34:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     35:  * SUCH DAMAGE.
                     36:  *
                     37:  * from: Utah $Hdr: locore.s 1.66 92/12/22$
                     38:  *
                     39:  *     @(#)locore.s    8.6 (Berkeley) 5/27/94
                     40:  */
                     41:
                     42: /*
                     43:  * Assembly routines related to process manipulation.
                     44:  */
                     45:
                     46: /*
                     47:  * NOTICE: This is not a standalone file.  To use it, #include it in
                     48:  * your port's locore.s, like so:
                     49:  *
                     50:  *     #include <m68k/m68k/proc_subr.s>
                     51:  */
                     52:
                     53: /*
                     54:  * The following primitives manipulate the run queues.  _whichqs tells which
                     55:  * of the 32 queues _qs have processes in them.  Setrunqueue puts processes
                     56:  * into queues, remrunqueue removes them from queues.  The running process is
                     57:  * on no queue, other processes are on a queue related to p->p_priority,
                     58:  * divided by 4 actually to shrink the 0-127 range of priorities into the 32
                     59:  * available queues.
                     60:  */
                     61:
                     62: /*
                     63:  * Setrunqueue(p)
                     64:  *
                     65:  * Call should be made at spl6(), and p->p_stat should be SRUN
                     66:  */
                     67: ENTRY(setrunqueue)
                     68:        movl    sp@(4),a0
                     69: #ifdef DIAGNOSTIC
                     70:        tstl    a0@(P_BACK)
                     71:        jne     Lset1
                     72:        tstl    a0@(P_WCHAN)
                     73:        jne     Lset1
                     74:        cmpb    #SRUN,a0@(P_STAT)
                     75:        jne     Lset1
                     76: #endif
                     77:        clrl    d0
                     78:        movb    a0@(P_PRIORITY),d0
                     79:        lsrb    #2,d0
                     80:        movl    _C_LABEL(whichqs),d1
                     81:        bset    d0,d1
                     82:        movl    d1,_C_LABEL(whichqs)
                     83:        lslb    #3,d0
                     84:        addl    #_C_LABEL(qs),d0
                     85:        movl    d0,a0@(P_FORW)
                     86:        movl    d0,a1
                     87:        movl    a1@(P_BACK),a0@(P_BACK)
                     88:        movl    a0,a1@(P_BACK)
                     89:        movl    a0@(P_BACK),a1
                     90:        movl    a0,a1@(P_FORW)
                     91:        rts
                     92: #ifdef DIAGNOSTIC
                     93: Lset1:
                     94:        PANIC("setrunqueue")
                     95: #endif
                     96:
                     97: /*
                     98:  * remrunqueue(p)
                     99:  *
                    100:  * Call should be made at spl6().
                    101:  */
                    102: ENTRY(remrunqueue)
                    103:        movl    sp@(4),a0
                    104:        movb    a0@(P_PRIORITY),d0
                    105: #ifdef DIAGNOSTIC
                    106:        lsrb    #2,d0
                    107:        movl    _C_LABEL(whichqs),d1
                    108:        btst    d0,d1
                    109:        jeq     Lrem2
                    110: #endif
                    111:        movl    a0@(P_BACK),a1
                    112:        clrl    a0@(P_BACK)
                    113:        movl    a0@(P_FORW),a0
                    114:        movl    a0,a1@(P_FORW)
                    115:        movl    a1,a0@(P_BACK)
                    116:        cmpal   a0,a1
                    117:        jne     Lrem1
                    118: #ifndef DIAGNOSTIC
                    119:        lsrb    #2,d0
                    120:        movl    _C_LABEL(whichqs),d1
                    121: #endif
                    122:        bclr    d0,d1
                    123:        movl    d1,_C_LABEL(whichqs)
                    124: Lrem1:
                    125:        rts
                    126: #ifdef DIAGNOSTIC
                    127: Lrem2:
                    128:        PANIC("remrunqueue")
                    129: #endif

CVSweb