Mercurial > hg > Members > taiki > original_os
changeset 10:50e4b9ca4867
add bootstrap source. Go to 64bit mode.
author | Taiki TAIRA <e095767@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 27 Aug 2012 23:45:31 +0900 |
parents | bd2f9ba6f5f8 |
children | 26b76ada8c13 |
files | Makefile bootstrap.S |
diffstat | 2 files changed, 37 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Wed Aug 22 18:30:45 2012 +0900 +++ b/Makefile Mon Aug 27 23:45:31 2012 +0900 @@ -35,4 +35,4 @@ clean: - @rm -rf *.o *.elf + rm -rf *.o *.elf
--- a/bootstrap.S Wed Aug 22 18:30:45 2012 +0900 +++ b/bootstrap.S Mon Aug 27 23:45:31 2012 +0900 @@ -4,6 +4,7 @@ */ #include "multiboot2.h" +#include "boot_header.h" .file "bootstrap.S" @@ -55,6 +56,7 @@ * 6144 = 512*8*6/4 */ + movl $0x01fe9000, %ebx leal pgtable(%ebx), %edi xorl %eax, %eax movl $6144, %ecx @@ -65,9 +67,43 @@ leal 0x1007(%edi), %eax movl %eax, 0(%edi) + /* Build Level 3 */ + leal pgtable + 0x1000(%ebx), %edi + leal 0x1007(%edi), %eax + movl $4, %ecx +1: movl %eax, 0x00(%edi) + addl $0x00001000, %eax + addl $8, %edi + decl %ecx + jnz 1b + /* Build level 2 */ + leal pgtable + 0x2000(%ebx), %edi + movl $0x00000183, %eax + movl $2048, %ecx +1: movl %eax, 0(%edi) + addl $0x00200000, %eax + addl $8, %edi + decl %ecx + jnz 1b + + /* Enable the boot page talbes */ + leal pgtable(%ebx), %eax + movl %eax, %cr3 + + /* Enable Long mode */ + movl $MSR_EFER, %ecx + rdmsr + btsl $EFER_LME, %eax + wrmsr + + jmp start_kernel + +/* jump to kernel. + * push ebx and eax send argument to kernel. + */ start_kernel: pushl %ebx pushl %eax