xref: /plan9/sys/src/9/pcboot/l64p.s (revision 25210b069a6ed8c047fa67220cf1dff32812f121)
1#include "mem.h"
2
3/*
4 * Macro for calculating offset within the page directory base.
5 * Note that this is assembler-specific hence the '<<2'.
6 */
7#define PDO(a)		(((((a))>>22) & 0x03FF)<<2)
8
9TEXT _warp64(SB), $0
10	CLI
11	MOVL	entry+0(FP), BP			/* entry */
12
13	MOVL	CR3, CX				/* load address of PDB */
14	ADDL	$KZERO, CX
15	MOVL	PDO(KZERO)(CX), DX		/* double-map KZERO at 0 */
16	MOVL	DX, PDO(0)(CX)
17
18	MOVL	CR3, CX
19	MOVL	CX, CR3				/* load and flush the mmu */
20
21	MOVL	$_start32id<>-KZERO(SB), AX
22	JMP*	AX				/* jump to identity-map */
23
24TEXT _start32id<>(SB), $0
25	MOVL	CR0, DX				/* turn off paging */
26	ANDL	$~PG, DX
27
28	MOVL	$_stop32pg<>-KZERO(SB), AX
29	MOVL	DX, CR0
30	JMP*	AX				/* forward into the past */
31
32TEXT _stop32pg<>(SB), $0
33	MOVL multibootheader-KZERO(SB), BX
34	MOVL $0x2badb002, AX
35
36	JMP* BP
37