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

📄 cpuinit.s

📁 mips架构的bootloader,99左右的版本 但源代码现在没人更新了
💻 S
字号:
/************************************************************* * File: lib/cpuinit.s * Purpose: Part of C runtime library * Author: Phil Bunce (pjb@carmel.com) * Revision History: *	970304	Start of revision history *	980703	Renamed. Was hostinit.s */#include <mips.h>/**************************************************************	Perform Host-specific initialization*	This routine is only callable from assembly because it*	clobbers s7 and generally violates the C calling convention. *	It does this because it is called before RAM is available, and*	so I have to hold info in registers.*	It should be called from your ROM-based startup*	code. It returns:*		s0 = address of cache flush routine*		s1 = CPU type*/	.globl cpuInit	.ent cpuInitcpuInit:   	# first we have to figure out what type of cpu we have	move	s7,ra		# save ra w/o using RAM	jal	getHostType	move	ra,s7		# restore ra	# cpu type is returned in v0	move	s1,v0		# need to return CPU type	/*	* now call the appropriate routine	* if the CPU type is not recognized we just crash off the end of	* the table. But that's okay because the error is unrecoverable	* anyway.	*/	la	t1,cpuInitTbl#ifdef BSO_TASKING	/* This code assumes that the first entry in the copy table	 * contains the info about the first data section. However,	 * this does seem to be true.	 */	la	t5,__lc_cp	lw	t0,4(t5)	# _fdata (dest)	subu	t1,t0	lw	t0,8(t5)	# etext (src)	addu	t1,t0#else	la	t0,_fdata	subu	t1,t0	la	t0,etext#ifdef ALGOR /* Algor's convert aligns the start of .data to 16 bytes */	addu    t0,15	and     t0,~15#endif	addu	t1,t0#endif  1:	lw	t0,(t1)	beq	t0,v0,2f	addu	t1,8	b	1b  2:	lw	t0,4(t1)	or	t0,K1BASE	li	a0,0	# never call C code from here			# so we call with 0 arg to be sure	jr	t0	# never returns here. Goes directly back to who called cpuInit.	.end cpuInit

⌨️ 快捷键说明

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