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 /* move stack below destination */
26 /* load CS with 32bit code segment */
27 PUSHQ $SELECTOR(3, SELGDT, 0)
33 TEXT _warp32<>(SB), 1, $-4
35 /* load 32bit data segments */
36 MOVL $SELECTOR(2, SELGDT, 0), AX
45 ANDL $0x7fffffff, AX /* ~(PG) */
51 /* disable long mode */
52 MOVL $0xc0000080, CX /* Extended Feature Enable */
54 ANDL $0xfffffeff, AX /* Long Mode Disable */
59 ANDL $0xffffff5f, AX /* ~(PAE|PGE) */
62 MOVL BX, CX /* byte count */
63 MOVL DI, AX /* save entry point */
66 * the source and destination may overlap.
67 * determine whether to copy forward or backwards
81 /* jump to entry point */
93 TEXT _gdt<>(SB), 1, $-4
98 /* (KESEG) 64 bit long mode exec segment */
100 LONG $(SEGL|SEGG|SEGP|(0xF<<16)|SEGPL(0)|SEGEXEC|SEGR)
102 /* 32 bit data segment descriptor for 4 gigabytes (PL 0) */
104 LONG $(SEGG|SEGB|(0xF<<16)|SEGP|SEGPL(0)|SEGDATA|SEGW)
106 /* 32 bit exec segment descriptor for 4 gigabytes (PL 0) */
108 LONG $(SEGG|SEGD|(0xF<<16)|SEGP|SEGPL(0)|SEGEXEC|SEGR)
110 TEXT _gdtptr64p<>(SB), 1, $-4
114 TEXT _idtptr64p<>(SB), 1, $-4