Replace magic numbers with architectural defines
All checks were successful
All checks were successful
This commit is contained in:
@@ -401,7 +401,7 @@ ArStartApplicationProcessor:
|
|||||||
|
|
||||||
/* Far return to enter 32-bit protected mode */
|
/* Far return to enter 32-bit protected mode */
|
||||||
leal (ApEnterProtectedMode - ArStartApplicationProcessor)(%ebx), %eax
|
leal (ApEnterProtectedMode - ArStartApplicationProcessor)(%ebx), %eax
|
||||||
pushl $0x08
|
pushl $KGDT_R0_CMCODE
|
||||||
pushl %eax
|
pushl %eax
|
||||||
lretl
|
lretl
|
||||||
|
|
||||||
@@ -410,7 +410,7 @@ ApEnterProtectedMode:
|
|||||||
.code32
|
.code32
|
||||||
|
|
||||||
/* Setup all data segment registers */
|
/* Setup all data segment registers */
|
||||||
movw $0x18, %ax
|
movw $KGDT_R0_DATA, %ax
|
||||||
movw %ax, %ds
|
movw %ax, %ds
|
||||||
movw %ax, %es
|
movw %ax, %es
|
||||||
movw %ax, %ss
|
movw %ax, %ss
|
||||||
@@ -431,19 +431,19 @@ ApEnterProtectedMode:
|
|||||||
movl %eax, %cr3
|
movl %eax, %cr3
|
||||||
|
|
||||||
/* Enable Long Mode and No-Execute */
|
/* Enable Long Mode and No-Execute */
|
||||||
movl $0xC0000080, %ecx
|
movl $X86_MSR_EFER, %ecx
|
||||||
rdmsr
|
rdmsr
|
||||||
orl $0x00000900, %eax
|
orl $(X86_MSR_EFER_LME | X86_MSR_EFER_NXE), %eax
|
||||||
wrmsr
|
wrmsr
|
||||||
|
|
||||||
/* Enable Paging */
|
/* Enable Paging */
|
||||||
movl %cr0, %eax
|
movl %cr0, %eax
|
||||||
orl $0x80000000, %eax
|
orl $CR0_PG, %eax
|
||||||
movl %eax, %cr0
|
movl %eax, %cr0
|
||||||
|
|
||||||
/* Far return to enter 64-bit long mode */
|
/* Far return to enter 64-bit long mode */
|
||||||
leal (ApEnterLongMode - ArStartApplicationProcessor)(%ebx), %eax
|
leal (ApEnterLongMode - ArStartApplicationProcessor)(%ebx), %eax
|
||||||
pushl $0x10
|
pushl $KGDT_R0_CODE
|
||||||
pushl %eax
|
pushl %eax
|
||||||
lretl
|
lretl
|
||||||
|
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ _ArHandleSpuriousInterrupt:
|
|||||||
*/
|
*/
|
||||||
.global _ArStartApplicationProcessor
|
.global _ArStartApplicationProcessor
|
||||||
_ArStartApplicationProcessor:
|
_ArStartApplicationProcessor:
|
||||||
/* Enter 16-bit (real mode) */
|
/* Enter 16-bit real mode */
|
||||||
.code16
|
.code16
|
||||||
|
|
||||||
/* Disable interrupts and clear direction flag */
|
/* Disable interrupts and clear direction flag */
|
||||||
@@ -276,7 +276,7 @@ _ArStartApplicationProcessor:
|
|||||||
|
|
||||||
/* Far return to enter 32-bit protected mode */
|
/* Far return to enter 32-bit protected mode */
|
||||||
leal (ApEnterProtectedMode - _ArStartApplicationProcessor)(%ebx), %eax
|
leal (ApEnterProtectedMode - _ArStartApplicationProcessor)(%ebx), %eax
|
||||||
pushl $0x08
|
pushl $KGDT_R0_CODE
|
||||||
pushl %eax
|
pushl %eax
|
||||||
lretl
|
lretl
|
||||||
|
|
||||||
@@ -285,7 +285,7 @@ ApEnterProtectedMode:
|
|||||||
.code32
|
.code32
|
||||||
|
|
||||||
/* Setup all data segment registers */
|
/* Setup all data segment registers */
|
||||||
movw $0x10, %ax
|
movw $KGDT_R0_DATA, %ax
|
||||||
movw %ax, %ds
|
movw %ax, %ds
|
||||||
movw %ax, %es
|
movw %ax, %es
|
||||||
movw %ax, %ss
|
movw %ax, %ss
|
||||||
@@ -298,7 +298,7 @@ ApEnterProtectedMode:
|
|||||||
|
|
||||||
/* Load CR4 from BSP, but mask PCIDE and PGE */
|
/* Load CR4 from BSP, but mask PCIDE and PGE */
|
||||||
movl PROCESSOR_START_BLOCK_Cr4(%edi), %eax
|
movl PROCESSOR_START_BLOCK_Cr4(%edi), %eax
|
||||||
andl $~0x00020080, %eax
|
andl $~(CR4_PGE | CR4_PCIDE), %eax
|
||||||
movl %eax, %cr4
|
movl %eax, %cr4
|
||||||
|
|
||||||
/* Load the Kernel Page Directory Base from BSP */
|
/* Load the Kernel Page Directory Base from BSP */
|
||||||
@@ -307,7 +307,7 @@ ApEnterProtectedMode:
|
|||||||
|
|
||||||
/* Enable Paging */
|
/* Enable Paging */
|
||||||
movl %cr0, %eax
|
movl %cr0, %eax
|
||||||
orl $0x80000000, %eax
|
orl $CR0_PG, %eax
|
||||||
movl %eax, %cr0
|
movl %eax, %cr0
|
||||||
|
|
||||||
/* Load dedicated Stack for AP */
|
/* Load dedicated Stack for AP */
|
||||||
|
|||||||
Reference in New Issue
Block a user