- # Fill page directory with zeroes.
- subl %eax, %eax
- movl $0x400, %ecx
- rep stosl
-
- # Set PDEs for 0 and LOADER_PHYS_BASE to point to the
- # page table.
- movl $0x11000 | PG_U | PG_W | PG_P, %eax
- movl %eax, 0x10000
- movl %eax, 0x10000 | (LOADER_PHYS_BASE >> 20)
-
- # Initialize page table.
- movl $PG_U | PG_W | PG_P, %eax
- movl $0x400, %ecx
-1: stosl
- addl $0x1000, %eax
- loop 1b
-
- # Turn on paging and kernel write-protect.
- movl %cr0, %eax
- orl $CR0_PG | CR0_WP, %eax
- movl %eax, %cr0
- jmp 1f
-1:
-
-##### Turn on EM bit in CR0, forcing most floating-point instructions
-##### to trap. We don't support floating-point or MMX.
-
- movl %cr0, %eax
- orl $CR0_EM, %eax
- movl %eax, %cr0
-
-##### Jump to kernel entry point.
-
- movl $LOADER_PHYS_BASE + 0x20000, %esp