mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:07:35 +00:00
Kernel: Update the x86_64 boot code to match i386's code
This commit is contained in:
parent
1979c7d185
commit
19c0498ccc
1 changed files with 28 additions and 18 deletions
|
@ -52,12 +52,12 @@ boot_pd0_pt0:
|
||||||
.skip 4096 * 4
|
.skip 4096 * 4
|
||||||
.global boot_pd3_pts
|
.global boot_pd3_pts
|
||||||
boot_pd3_pts:
|
boot_pd3_pts:
|
||||||
.skip 4096 * 8
|
.skip 4096 * 16
|
||||||
.global boot_pd3_pt1023
|
.global boot_pd3_pt1023
|
||||||
boot_pd3_pt1023:
|
boot_pd3_pt1023:
|
||||||
.skip 4096
|
.skip 4096
|
||||||
|
|
||||||
.section .text
|
.section .boot_text, "ax"
|
||||||
|
|
||||||
.global start
|
.global start
|
||||||
.type start, @function
|
.type start, @function
|
||||||
|
@ -92,7 +92,17 @@ boot_pd3 : 512 pde's
|
||||||
5: boot_pd3_pts[5] (3082-3084MB) (pseudo 512 4KB pages)
|
5: boot_pd3_pts[5] (3082-3084MB) (pseudo 512 4KB pages)
|
||||||
6: boot_pd3_pts[6] (3084-3086MB) (pseudo 512 4KB pages)
|
6: boot_pd3_pts[6] (3084-3086MB) (pseudo 512 4KB pages)
|
||||||
7: boot_pd3_pts[7] (3086-3088MB) (pseudo 512 4KB pages)
|
7: boot_pd3_pts[7] (3086-3088MB) (pseudo 512 4KB pages)
|
||||||
8: boot_pd3_pt1023 (4094-4096MB) (for page table mappings)
|
|
||||||
|
8: boot_pd3_pts[8] (3088-3090MB) (pseudo 512 4KB pages)
|
||||||
|
9: boot_pd3_pts[9] (3090-3076MB) (pseudo 512 4KB pages)
|
||||||
|
10: boot_pd3_pts[10] (3092-3094MB) (pseudo 512 4KB pages)
|
||||||
|
11: boot_pd3_pts[11] (3094-3096MB) (pseudo 512 4KB pages)
|
||||||
|
12: boot_pd3_pts[12] (3096-3098MB) (pseudo 512 4KB pages)
|
||||||
|
13: boot_pd3_pts[13] (3098-3100MB) (pseudo 512 4KB pages)
|
||||||
|
14: boot_pd3_pts[14] (3100-3102MB) (pseudo 512 4KB pages)
|
||||||
|
15: boot_pd3_pts[15] (3102-3104MB) (pseudo 512 4KB pages)
|
||||||
|
|
||||||
|
16: boot_pd3_pt1023 (4094-4096MB) (for page table mappings)
|
||||||
|
|
||||||
the 9 page tables each contain 512 pte's that map individual 4KB pages
|
the 9 page tables each contain 512 pte's that map individual 4KB pages
|
||||||
|
|
||||||
|
@ -146,7 +156,7 @@ start:
|
||||||
|
|
||||||
/* clear pd3's pt's */
|
/* clear pd3's pt's */
|
||||||
movl $(boot_pd3_pts - 0xc0000000), %edi
|
movl $(boot_pd3_pts - 0xc0000000), %edi
|
||||||
movl $(1024 * 9), %ecx
|
movl $(1024 * 17), %ecx
|
||||||
xorl %eax, %eax
|
xorl %eax, %eax
|
||||||
rep stosl
|
rep stosl
|
||||||
|
|
||||||
|
@ -158,7 +168,7 @@ start:
|
||||||
orl $0x3, 0(%edi)
|
orl $0x3, 0(%edi)
|
||||||
|
|
||||||
/* add boot_pd3_pts to boot_pd3 */
|
/* add boot_pd3_pts to boot_pd3 */
|
||||||
movl $8, %ecx
|
movl $16, %ecx
|
||||||
movl $(boot_pd3 - 0xc0000000), %edi
|
movl $(boot_pd3 - 0xc0000000), %edi
|
||||||
movl $(boot_pd3_pts - 0xc0000000), %eax
|
movl $(boot_pd3_pts - 0xc0000000), %eax
|
||||||
|
|
||||||
|
@ -183,8 +193,8 @@ start:
|
||||||
addl $4096, %eax
|
addl $4096, %eax
|
||||||
loop 1b
|
loop 1b
|
||||||
|
|
||||||
/* pseudo identity map the 3072-3090MB range */
|
/* pseudo identity map the 3072-3102MB range */
|
||||||
movl $(512 * 8), %ecx
|
movl $(512 * 16), %ecx
|
||||||
movl $(boot_pd3_pts - 0xc0000000), %edi
|
movl $(boot_pd3_pts - 0xc0000000), %edi
|
||||||
xorl %eax, %eax
|
xorl %eax, %eax
|
||||||
|
|
||||||
|
@ -239,6 +249,7 @@ start:
|
||||||
movl $256, %ecx
|
movl $256, %ecx
|
||||||
movl $(boot_pd0_pt0 - 0xc0000000), %edi
|
movl $(boot_pd0_pt0 - 0xc0000000), %edi
|
||||||
xorl %eax, %eax
|
xorl %eax, %eax
|
||||||
|
|
||||||
1:
|
1:
|
||||||
movl %eax, 0(%edi)
|
movl %eax, 0(%edi)
|
||||||
addl $8, %edi
|
addl $8, %edi
|
||||||
|
@ -317,8 +328,7 @@ apic_ap_start32:
|
||||||
movl $0x80000001, %eax
|
movl $0x80000001, %eax
|
||||||
cpuid
|
cpuid
|
||||||
testl $0x100000, %edx
|
testl $0x100000, %edx
|
||||||
// TODO: Uncomment this
|
je (1f - apic_ap_start + 0x8000)
|
||||||
//je (1f - apic_ap_start + 0x8000)
|
|
||||||
/* turn on IA32_EFER.NXE */
|
/* turn on IA32_EFER.NXE */
|
||||||
movl $0xc0000080, %ecx
|
movl $0xc0000080, %ecx
|
||||||
rdmsr
|
rdmsr
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue