Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include "mem.h"
2
 
3
/*
4
 * Turn off MMU, then memmove the new kernel to its correct location
5
 * in physical memory.  Then jump to the start of the kernel.
6
 */
7
 
8
TEXT	main(SB),$0
9
	MOVL	p1+0(FP), DI		/* destination */
10
	MOVL	DI, AX			/* entry point */
11
	MOVL	p2+4(FP), SI		/* source */
12
	MOVL	n+8(FP), CX		/* byte count */
13
 
14
/*
15
 * disable paging
16
 */
17
	MOVL	CR0, DX
18
	ANDL	$~0x80000000, DX		/* ~(PG) */
19
	MOVL	DX, CR0
20
	MOVL	$0, DX
21
	MOVL	DX, CR3
22
 
23
/*
24
 * the source and destination may overlap.
25
 * determine whether to copy forward or backwards
26
 */
27
	CMPL	SI, DI
28
	JGT	_forward
29
	MOVL	SI, DX
30
	ADDL	CX, DX
31
	CMPL	DX, DI
32
	JGT	_back
33
 
34
_forward:
35
	CLD
36
	REP;	MOVSB
37
	JMP	_startkernel
38
 
39
_back:
40
	ADDL	CX, DI
41
	ADDL	CX, SI
42
	SUBL	$1, DI
43
	SUBL	$1, SI
44
	STD
45
	REP;	MOVSB
46
	JMP	_startkernel
47
/*
48
 * JMP to kernel entry point.  Note the true kernel entry point is
49
 * the virtual address KZERO|AX, but this must wait until
50
 * the MMU is enabled by the kernel in l.s
51
 */
52
_startkernel:
53
	ORL	AX, AX		/* NOP: avoid link bug */
54
	JMP*	AX