Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Webinar.BrainTeaser.Answer.MIPS.STI: (1 Item)
   
Webinar.BrainTeaser.Answer.MIPS.STI  
This my answer to the question posted during the Webinar 
Q>What does STI expand to in the MIPS kernel?
A> file: \svn\trunk\services\system\ker\mips\kernel.S 
line 586: 
#define STI ENABLEINTERRUPTS(t8,t7) 
this further expands to:
file: \svn\trunk\lib\c\public\mips\asm.h
line 193
#define ENABLEINTERRUPTS(x,y)		\
	.extern __shadow_imask ;		\
	mfc0	x,CP0_SREG ;			\
	 li	y,~0xff00 ;					\
	ori	x,x,MIPS_SREG_IE ;			\
	and	x,y ;						\
	lw	y,__shadow_imask ;			\
	lw	y,0(y) ;					\
	or	x,y ;						\
	mtc0	x,CP0_SREG ;			\
	 nop; nop; nop; nop; nop; nop; nop; nop;

that is STI macto on MIPS should result in the following assembly:

	.extern __shadow_imask ;		\
	mfc0	t8,CP0_SREG ;			\
	 li	t7,~0xff00 ;					\
	ori	t8,t8,MIPS_SREG_IE ;			\
	and	t8,t7 ;						\
	lw	t7,__shadow_imask ;			\
	lw	t7,0(t7) ;					\
	or	t8,t7 ;						\
	mtc0	t8,CP0_SREG ;			\
	 nop; nop; nop; nop; nop; nop; nop; nop;


-Vlad Kozin