Changeset View
Changeset View
Standalone View
Standalone View
sys/i386/i386/mpboot.s
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | NON_GPROF_ENTRY(MPentry) | ||||
* instruction. | * instruction. | ||||
*/ | */ | ||||
movl $1,%eax | movl $1,%eax | ||||
cpuid /* Retrieve features */ | cpuid /* Retrieve features */ | ||||
movl %cr4,%eax | movl %cr4,%eax | ||||
testl $CPUID_PSE,%edx | testl $CPUID_PSE,%edx | ||||
jz 1f | jz 1f | ||||
orl $CR4_PSE,%eax /* Enable PSE */ | orl $CR4_PSE,%eax /* Enable PSE */ | ||||
1: | 1: testl $CPUID_PGE,%edx | ||||
testl $CPUID_PGE,%edx | jz 2f | ||||
jz 1f | |||||
orl $CR4_PGE,%eax /* Enable PGE */ | orl $CR4_PGE,%eax /* Enable PGE */ | ||||
1: | 2: testl $CPUID_VME,%edx | ||||
testl $CPUID_VME,%edx | jz 3f | ||||
jz 1f | |||||
orl $CR4_VME,%eax /* Enable VME */ | orl $CR4_VME,%eax /* Enable VME */ | ||||
1: | 3: movl %eax,%cr4 | ||||
movl %eax,%cr4 | |||||
/* Now enable paging mode */ | /* Now enable paging mode */ | ||||
#if defined(PAE) || defined(PAE_TABLES) | cmpl $0, pae_mode | ||||
je 4f | |||||
movl IdlePDPT, %eax | movl IdlePDPT, %eax | ||||
movl %eax, %cr3 | movl %eax, %cr3 | ||||
movl %cr4, %eax | movl %cr4, %eax | ||||
orl $CR4_PAE, %eax | orl $CR4_PAE, %eax | ||||
movl %eax, %cr4 | movl %eax, %cr4 | ||||
movl $0x80000000, %eax | movl $0x80000000, %eax | ||||
cpuid | cpuid | ||||
movl $0x80000001, %ebx | movl $0x80000001, %ebx | ||||
cmpl %ebx, %eax | cmpl %ebx, %eax | ||||
jb 1f | jb 5f | ||||
movl %ebx, %eax | movl %ebx, %eax | ||||
cpuid | cpuid | ||||
testl $AMDID_NX, %edx | testl $AMDID_NX, %edx | ||||
je 1f | je 5f | ||||
movl $MSR_EFER, %ecx | movl $MSR_EFER, %ecx | ||||
rdmsr | rdmsr | ||||
orl $EFER_NXE,%eax | orl $EFER_NXE,%eax | ||||
wrmsr | wrmsr | ||||
1: | jmp 5f | ||||
#else | 4: movl IdlePTD_nopae, %eax | ||||
movl IdlePTD, %eax | |||||
movl %eax,%cr3 | movl %eax,%cr3 | ||||
#endif | 5: movl %cr0,%eax | ||||
movl %cr0,%eax | |||||
orl $CR0_PE|CR0_PG,%eax /* enable paging */ | orl $CR0_PE|CR0_PG,%eax /* enable paging */ | ||||
movl %eax,%cr0 /* let the games begin! */ | movl %eax,%cr0 /* let the games begin! */ | ||||
movl bootSTK,%esp /* boot stack end loc. */ | movl bootSTK,%esp /* boot stack end loc. */ | ||||
pushl $mp_begin /* jump to high mem */ | pushl $mp_begin /* jump to high mem */ | ||||
ret | ret | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 159 Lines • Show Last 20 Lines |