diff options
Diffstat (limited to 'rt')
| -rw-r--r-- | rt/+x86_64/stage0.s | 19 | ||||
| -rw-r--r-- | rt/+x86_64/stage1.S | 24 | ||||
| -rw-r--r-- | rt/hare.sc | 3 |
3 files changed, 40 insertions, 6 deletions
diff --git a/rt/+x86_64/stage0.s b/rt/+x86_64/stage0.s index 2961a10..e88c3b8 100644 --- a/rt/+x86_64/stage0.s +++ b/rt/+x86_64/stage0.s @@ -56,7 +56,7 @@ a20_ok: # the rest :) load_stage1: # :Start to read at the second sector - mov $0x1, %di + mov entry1_begin, %edi # :Place the result just after us mov $boot_stage1_start, %esi load_stage1_loop: @@ -86,7 +86,24 @@ previous_sector: bios_idtr: .quad 0 +.org 446 + +entry1: +.byte 0x80 +.byte 0x0 +.byte 0x0 +.byte 0x0 +.byte 0x0 # type +.byte 0x0 # last +.byte 0x0 +.byte 0x0 +entry1_begin: +.int 0x0 +.int 512 + .org 510 .word 0xaa55 + + .include "rt/+x86_64/stage1.S" diff --git a/rt/+x86_64/stage1.S b/rt/+x86_64/stage1.S index 4f99d69..a3f35ab 100644 --- a/rt/+x86_64/stage1.S +++ b/rt/+x86_64/stage1.S @@ -74,25 +74,39 @@ pages_fill: or $3, %edi mov %edi, (_p4) + # Recursive map the page 4 + mov $_p4, %edi + or $3, %edi + mov $_p4, %ebx + mov %edi, 4088(%ebx) + mov $_p2, %edi or $3, %edi mov %edi, (_p3) mov $_p1, %edi or $3, %edi - mov %edi, (_p2) - + mov $_p3, %ebx + mov %edi, 8(%ebx) # :Now we are going to fill the first page - mov $0x3, %ebx + mov $(1 << 7| 0x3), %ebx + mov $512, %ecx + mov $_p2, %edi +pages_fill_p2_loop: + mov %ebx, (%edi) + add $0x200000, %ebx + add $8, %edi + loop pages_fill_p2_loop + mov $512, %ecx mov $_p1, %edi pages_fill_p1_loop: mov %ebx, (%edi) - add $0x1000, %ebx + add $0x200000, %ebx add $8, %edi loop pages_fill_p1_loop - + # :Now that the pages are prepared, we must set the %cr3 to point to the level 4 # page table. This register contains the address of the level 4 page mov $_p4, %edi @@ -73,4 +73,7 @@ SECTIONS { boot_end = .; + + . = ALIGN(512); + buildup = .; } |
