6 * Turn off MMU, then memmove the new kernel to its correct location
7 * in physical memory. Then jumps the to start of the kernel.
11 MOVL RARG, DI /* destination */
12 MOVL p2+8(FP), SI /* source */
13 MOVL n+16(FP), BX /* byte count */
15 /* load zero length idt */
16 MOVL $_idtptr64p<>(SB), AX
19 /* load temporary gdt */
20 MOVL $_gdtptr64p<>(SB), AX
23 /* load CS with 32bit code segment */
24 PUSHQ $SELECTOR(3, SELGDT, 0)
30 TEXT _warp32<>(SB), 1, $-4
32 /* load 32bit data segments */
33 MOVL $SELECTOR(2, SELGDT, 0), AX
42 ANDL $0x7fffffff, AX /* ~(PG) */
48 /* disable long mode */
49 MOVL $0xc0000080, CX /* Extended Feature Enable */
51 ANDL $0xfffffeff, AX /* Long Mode Disable */
56 ANDL $0xffffff5f, AX /* ~(PAE|PGE) */
59 MOVL BX, CX /* byte count */
60 MOVL DI, AX /* save entry point */
61 MOVL AX, SP /* move stack below entry */
63 /* park cpu for zero entry point */
69 * the source and destination may overlap.
70 * determine whether to copy forward or backwards
84 /* jump to entry point */
100 TEXT _gdt<>(SB), 1, $-4
101 /* null descriptor */
105 /* (KESEG) 64 bit long mode exec segment */
107 LONG $(SEGL|SEGG|SEGP|(0xF<<16)|SEGPL(0)|SEGEXEC|SEGR)
109 /* 32 bit data segment descriptor for 4 gigabytes (PL 0) */
111 LONG $(SEGG|SEGB|(0xF<<16)|SEGP|SEGPL(0)|SEGDATA|SEGW)
113 /* 32 bit exec segment descriptor for 4 gigabytes (PL 0) */
115 LONG $(SEGG|SEGD|(0xF<<16)|SEGP|SEGPL(0)|SEGEXEC|SEGR)
117 TEXT _gdtptr64p<>(SB), 1, $-4
121 TEXT _idtptr64p<>(SB), 1, $-4