⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hosttype.s

📁 mips架构的bootloader,99左右的版本 但源代码现在没人更新了
💻 S
字号:
/************************************************************* * File: lib/hosttype.s * Purpose: Part of C runtime library * Author: Phil Bunce (pjb@carmel.com) * Revision History: *	970304	Start of revision history *	980409	Added 90084 (DCAM) *	980415	Current DCAM chips are 0x1102 (DCAM-101D) *	980616	Added 4102. PrID = 0x2f80. *	980629	Added code to descriminate between 64363 and 64364. *	980704	Added case for 64388 RAP. *	980719	Added case for IDT4650 0x22xx. *	980731	Added 4011c prid=4021 *	980818	Added DCAM RevE prid=1103 *	980818	Added 4011 RevD prid=4031 *	990211	Added DCAM-111 prid=1105 */#include <mips.h>/*** Return machine type: 3000, 3010, 33000, 33050, 33020, 33120, **			33300, 33310 etc*/#if 0--------------------------------------------------------------------		/* this describes the logic */getHostType(){long prid;#ifdef LR3000	if (hasFPU()) return(3010);	else return(3000);#else	prid = mfc0(C0_PRID);	if (prid == 0x0001) return(4010);	else if (prid == 0x0a0a) return(33300);	else if (prid == 0x0b0a) return(33310);	else if (prid == 0x0b20) return(4300); /* nec 4300 */	else if (prid == 0x1000) return(4001);	else if (prid == 0x1100) return(4003); /* warning: no mdu */	else if (prid == 0x1200) return(4002);	else if (prid == 0x2010) return(4101);	else if (prid == 0x2f80) return(4102);	else if (prid == 0x4101) return(4010);	else if (prid == 0x4010) return(64364); /* atm2+ */	else if (prid == 0x4011) return(4011);	else if (prid == 0x4011) return(64388); /* ugh. same code as 4011 */	else if (prid == 0x4021) return(4011);  /* RevC */	else if (prid == 0x4031) return(4011);  /* RevD */	else if ((prid&0xff00) == 0x2200) return(4650); /* idt 4650 */	else if (prid == 0) { /* LR33[01]xx */		if (hasFPU()) return(33050);		else if (hasCP2()) {			if (has33120()) return(33120);			else return(33020);			}			else return(33000);		}#endif}But I need to code this in assembler, so that I can save ra in t9 insteadof on the stack. None of the routines in haswhat.s use t9.--------------------------------------------------------------------#endif	.globl getHostType	.ent getHostTypegetHostType:	move	t9,ra#ifdef LR3000	jal	hasFPU	beq	zero,v0,1f	# 3000+3010	li	v0,3010	b	done1:	# 3000	li	v0,3000	b	done#else#ifdef LR64360 /* ATMizer-I */	li	v0,64360	b	done#else#ifdef LR64364 /* ATMizer-II or ATMizer-II+ */	/* The same board can have either a 64363 or a 64364. This	 * test allows us to tell them apart, since they have the	 * same PRID :-(	 */	li	v0,0xb8000800	# SBCR register	lw	v0,(v0)	li	t0,0xf8000eee	# 64363 value	bne	t0,v0,1f	li	v0,64363	b	done  1:	li	v0,64364	b	done#else#ifdef LR64363 /* ATMizer-II */	li	v0,64363	b	done#else#ifdef LR64008 /* settop */	li	v0,64008	b	done#else#ifdef LR64388 /* RAP */	/* This processor has the same PRID as 4011. So we *must*	 * have a special selection for it. Actually the address	 * map is a little odd too. So we would need one anyway.	 */	li	v0,64388	b	done#else	.set noreorder	mfc0	t6,C0_PRID	nop	.set reorder	bne	t6,0x0a0a,1f	# 33300	li	v0,33300	b	done1:	bne	t6,0x0b0a,1f	# 33310	li	v0,33310	b	done1:	bne	t6,0x1000,1f	# LR4001	li	v0,4001	b	done1:	bne	t6,0x0001,1f	# LR4010	li	v0,4010	b	done1:	bne	t6,0x4101,1f	# LR4010 revb	li	v0,4010	b	done1:	bne	t6,0x4011,1f	# this is also the code for the 64388 RAP :-(	# LR4011/4500	li	v0,4011	b	done1:	bne	t6,0x4021,1f	# LR4011/4500 revC	li	v0,4011	b	done1:	bne	t6,0x4031,1f	# LR4011/4500 revD	li	v0,4011	b	done1:	bne	t6,0x1200,1f	# LR4002	li	v0,4002	b	done1:	bne	t6,0x1100,1f	# LR4003	li	v0,4003	b	done1:	bne	t6,0x2010,1f	# TR4101	li	v0,4101	b	done1:	bne	t6,0x2f80,1f	# LR4102	li	v0,4102	b	done1:	bne	t6,0x0b20,1f	# VR4300	li	v0,4300	b	done1:	and 	v0,t6,0xff00	bne	v0,0x2200,1f	# must ignore the rev field	# IDT4650	#li	v0,4650	li	v0,4300	b	done1:	bne	t6,0x1102,1f	# L9A0084-101 (DCAM-D)	li	v0,90084	b	done1:	bne	t6,0x1103,1f	# L9A0084-101 (DCAM-E)	li	v0,90084	b	done1:	bne	t6,0x1105,1f	# L65066 (DCAM-111)	li	v0,65066	b	done1:	bne	t6,zero,3f	# The following processors all have the same prid value (sigh)	# so we have to use other methods to identify them.	# 33[01]??	jal	hasFPU	beq	zero,v0,1f	# 33050	li	v0,33050	b	done1:	jal	hasCP2	beq	zero,v0,2f	# 33[01]20	jal	has33120	beq	zero,v0,1f	# 33120	li	v0,33120	b	done1:	# 33020	li	v0,33020	b	done2:	# 33000	li	v0,33000	b	done3:	# unknown	li	v0,0	b	done#endif#endif#endif#endif#endif#endifdone:	move	ra,t9	j	ra	.end getHostType

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -