getintmask.s 1.51 KB
/**************************************************************************
 *									  *
 *		 Copyright (C) 1994, Silicon Graphics, Inc.		  *
 *									  *
 *  These coded instructions, statements, and computer programs  contain  *
 *  unpublished  proprietary  information of Silicon Graphics, Inc., and  *
 *  are protected by Federal copyright law.  They  may  not be disclosed  *
 *  to  third  parties  or copied or duplicated in any form, in whole or  *
 *  in part, without the prior written consent of Silicon Graphics, Inc.  *
 *									  *
 **************************************************************************/

#include <asm.h>
#include <regdef.h>
#include <R4300.h>
#include <rcp.h>
#include <os.h>
#include "threadasm.h"

	.set	noreorder

LEAF(osGetIntMask)
	mfc0	v0,C0_SR
	andi	v0,(SR_IMASK|SR_IE)
	la      t0, __OSGlobalIntMask           # get global interrupt mask
        lw      t1, 0(t0)
        xor     t0, t1, 0xffffffff
        andi    t0, SR_IMASK
        or      v0, t0                          # subtract __OSGlobalIntMask
	lw      t1,PHYS_TO_K1(MI_INTR_MASK_REG) # get rcp interrupt register
	beqz	t1, 1f
        la      t0, __OSGlobalIntMask           # get global interrupt mask
        lw      t0, 0(t0)
        srl     t0, RCP_IMASKSHIFT
        xor     t0, 0xffffffff
        and     t0, 0x3f
	#lw	k0,__osRunningThread
	#lw	t4, T_CONTEXT_RCP(k0)
	#and	t0, t4
        or      t1, t0                          #subtract __OSGlobalIntMask
1:
	sll	t2, t1, RCP_IMASKSHIFT

	or	v0, t2
	j	ra
	nop
END(osGetIntMask)