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

📄 rebootcode.s

📁 这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易于我们学习和理解
💻 S
字号:
#include "mem.h"/* * Turn off MMU, then memmory the new kernel to its correct location * in physical memory.  Then jumps the to start of the kernel. */TEXT	main(SB),$0	MOVL	p1+0(FP), DI		/* destination */	MOVL	DI, AX			/* entry point */	MOVL	p2+4(FP), SI		/* source */	MOVL	n+8(FP), CX		/* byte count *//* * disable paging */	MOVL	CR0, DX	ANDL	$~0x80000000, DX		/* ~(PG) */	MOVL	DX, CR0	MOVL	$0, DX	MOVL	DX, CR3/* * the source and destination may overlap. * determine whether to copy forward or backwards */	CMPL	SI, DI	JGT	_forward	MOVL	SI, DX	ADDL	CX, DX	CMPL	DX, DI	JGT	_back_forward:	CLD	REP;	MOVSB	JMP	_startkernel_back:	ADDL	CX, DI	ADDL	CX, SI	SUBL	$1, DI	SUBL	$1, SI	STD	REP;	MOVSB	JMP	_startkernel/* * JMP to kernel entry point.  Note the true kernel entry point is * the virtual address KZERO|AX, but this must wait until * the MMU is enabled by the kernel in l.s */_startkernel:	ORL	AX, AX		/* NOP: avoid link bug */	JMP*	AX

⌨️ 快捷键说明

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